/* modern.css - Estilos modernos y utilidades para Poder Judicial */

:root {
    --primary: #2a3eb1;
    --primary-light: #5c6bc0;
    --primary-dark: #1a237e;
    --secondary: #ff4081;
    --success: #43a047;
    --info: #1976d2;
    --warning: #ffa000;
    --danger: #e53935;
    --background: #f4f6fb;
    --surface: #fff;
    --text-main: #23272f;
    --text-light: #fff;
    --border-radius: 0.75rem;
    --shadow: 0 4px 24px rgba(44,62,80,0.08);
    --transition: 0.2s cubic-bezier(.4,0,.2,1);
    --sidebar-width: 260px;
    --sidebar-bg: var(--primary);
    --sidebar-text: #fff;
    --sidebar-active: var(--secondary);
    --input-bg: #f8fafc;
    --input-border: #d1d5db;
    --input-focus: var(--primary);
    --card-bg: var(--surface);
    --card-shadow: var(--shadow);
    --badge-radius: 1rem;
    --badge-font: 0.85rem;
    --z-toast: 2000;
}

[data-theme="dark"] {
    --background: #181a20;
    --surface: #23272f;
    --text-main: #f4f6fb;
    --sidebar-bg: #23272f;
    --sidebar-text: #fff;
    --input-bg: #23272f;
    --input-border: #444857;
    --card-bg: #23272f;
    --card-shadow: 0 4px 24px rgba(20,20,20,0.25);
}

body {
    background: var(--background);
    color: var(--text-main);
    font-family: 'Poppins', 'Roboto', Arial, sans-serif;
    transition: background 0.3s, color 0.3s;
}

.card-modern {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 2rem 1.5rem;
    margin-bottom: 2rem;
    transition: box-shadow 0.2s;
}
.card-modern:hover {
    box-shadow: 0 8px 32px rgba(44,62,80,0.15);
}

.btn-modern {
    border-radius: var(--border-radius);
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    background: var(--primary);
    color: var(--text-light);
    border: none;
    transition: background 0.2s;
}
.btn-modern:hover, .btn-modern:focus {
    background: var(--primary-dark);
    color: var(--text-light);
}

.badge-modern {
    border-radius: var(--badge-radius);
    font-size: var(--badge-font);
    padding: 0.35em 0.9em;
    font-weight: 500;
    background: var(--primary-light);
    color: var(--text-light);
    margin-right: 0.5em;
}
.badge-success { background: var(--success) !important; }
.badge-info { background: var(--info) !important; }
.badge-warning { background: var(--warning) !important; color: #23272f !important; }
.badge-danger { background: var(--danger) !important; }

.input-modern {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 0.7rem 1rem;
    font-size: 1rem;
    transition: border 0.2s, background 0.2s;
    color: var(--text-main);
}
.input-modern:focus {
    border-color: var(--input-focus);
    background: #fff;
    outline: none;
}

.table-modern {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
}
.table-modern th, .table-modern td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #e0e0e0;
}
.table-modern th {
    background: var(--background);
    color: var(--primary-dark);
    font-weight: 600;
}
.table-modern tr:last-child td {
    border-bottom: none;
}

/* Toasts y notificaciones */
.toast-modern {
    position: fixed;
    top: 1.5rem;
    right: 2rem;
    z-index: var(--z-toast);
    background: var(--surface);
    color: var(--text-main);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 1rem 2rem;
    min-width: 250px;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    opacity: 0.98;
    transition: opacity 0.2s;
}

/* Microinteracciones */
.btn-modern:active {
    transform: scale(0.97);
}
.card-modern:active {
    box-shadow: 0 2px 8px rgba(44,62,80,0.10);
}

/* Loader */
.loader-modern {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toggle dark mode */
.toggle-darkmode {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 3000;
    background: var(--surface);
    color: var(--primary);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.toggle-darkmode:hover {
    background: var(--primary);
    color: var(--text-light);
}

/* Main Content Wrapper */
.main-content-wrapper {
    margin-left: 280px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    background-color: #f8f9fa;
    padding: 20px;
    position: relative;
    z-index: 100;
    width: calc(100% - 280px);
    float: right;
}

/* When sidebar is collapsed */
.main-content-wrapper.sidebar-collapsed {
    margin-left: 70px;
    width: calc(100% - 70px);
}

/* For mobile view */
@media (max-width: 768px) {
    .main-content-wrapper {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar:not(.collapsed) + .main-content-wrapper {
        margin-left: 280px;
        width: calc(100% - 280px);
    }
}