/* Variables de color actualizadas para una interfaz más moderna */
:root {
    --primary-color: #4f46e5;                  /* Indigo moderno */
    --primary-dark: #3730a3;                   /* Indigo más oscuro */
    --primary-light: #6366f1;                  /* Indigo claro */
    --secondary-color: #64748b;                /* Slate gris */
    --accent-color: #10b981;                   /* Emerald verde */
    --danger-color: #ef4444;                   /* Red moderno */
    --warning-color: #f59e0b;                  /* Amber */
    --info-color: #3b82f6;                     /* Blue */
    
    --sidebar-bg: #1e293b;                     /* Slate dark para sidebar */
    --sidebar-text: #cbd5e1;                   /* Slate light para texto */
    --sidebar-hover-bg: #334155;               /* Slate hover */
    --sidebar-active-bg: var(--primary-color); /* Primary para activo */
    --sidebar-active-text: #ffffff;            /* Blanco para texto activo */

    --header-bg: #ffffff;                      /* Blanco para header */
    --header-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --body-bg: #f8fafc;                        /* Slate muy claro */
    --content-bg: transparent;                 
    --card-bg: #ffffff;                        
    --border-color: #e2e8f0;                   /* Slate border */
    
    --text-primary: #1e293b;                   /* Texto principal */
    --text-secondary: #64748b;                 /* Texto secundario */
    --text-muted: #94a3b8;                     /* Texto muted */
}

/* Reset y estilos base */
* {
    box-sizing: border-box;
}

body {
    display: flex;
    min-height: 100vh;
    background-color: var(--body-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.6;
    font-size: 14px;
}

/* Sidebar moderno */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #0f172a 100%);
    color: var(--sidebar-text);
    padding: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    position: sticky;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    border-right: 1px solid rgba(148, 163, 184, 0.1);
}

/* Estado colapsado del sidebar */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed h2 {
    font-size: 0;
    margin-bottom: 20px;
}

.sidebar.collapsed h2 i {
    font-size: 1.5rem;
}

.sidebar.collapsed .sidebar-text {
    display: none;
}

.sidebar.collapsed ul li a {
    justify-content: center;
    padding: 14px 0;
}

.sidebar.collapsed ul li a i {
    margin-right: 0;
}

/* Logo del sidebar */
.sidebar h2 {
    text-align: center;
    margin: 0;
    padding: 24px 16px;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar h2 i {
    color: var(--primary-light);
    margin-right: 8px;
}

/* Lista del sidebar */
.sidebar ul {
    list-style: none;
    padding: 16px 0;
    margin: 0;
}

.sidebar ul li {
    margin-bottom: 4px;
    padding: 0 12px;
}

.sidebar ul li a {
    display: flex;
    align-items: center;
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.sidebar ul li a:hover {
    background-color: var(--sidebar-hover-bg);
    color: #ffffff;
    transform: translateX(2px);
}

.sidebar ul li a.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.sidebar ul li a i {
    margin-right: 12px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Badge en sidebar */
.sidebar .badge {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* Contenedor principal */
.main-content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: transparent;
}

/* Header moderno */
.main-header {
    background-color: var(--header-bg);
    padding: 16px 24px;
    box-shadow: var(--header-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

/* Botón toggle sidebar */
.sidebar-toggle-btn {
    background-color: transparent;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    color: var(--primary-color);
    background-color: var(--primary-color);
    background-opacity: 0.1;
}

/* Dropdown de usuario - CORREGIDO */
.user-info {
    position: relative;
}

.user-info .dropdown-toggle {
    background: none !important;
    border: none !important;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info .dropdown-toggle:hover {
    background-color: var(--body-bg) !important;
    color: var(--primary-color);
}

.user-info .dropdown-toggle::after {
    margin-left: 8px;
}

.user-info .dropdown-menu {
    border: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 8px;
    min-width: 200px;
    margin-top: 8px;
}

.user-info .dropdown-header {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 12px;
    margin-bottom: 4px;
}

.user-info .dropdown-item {
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-size: 14px;
}

.user-info .dropdown-item:hover {
    background-color: var(--primary-color);
    color: white;
}

.user-info .dropdown-item i {
    margin-right: 8px;
    width: 16px;
}

/* Contenido principal */
.contenido {
    flex-grow: 1;
    padding: 32px;
    background-color: var(--content-bg);
    min-height: calc(100vh - 80px);
    width: 100%;
}

/* Títulos mejorados */
.contenido h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.2;
}

.contenido .lead {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
}

/* Cards modernos */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 24px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 16px 24px;
    border-bottom: none;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* Botones modernos */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 10px 20px;
    font-size: 14px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

.btn-outline-primary {
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-color) 0%, #059669 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Formularios modernos */
.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 14px;
}

.form-control, .form-select {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    transition: all 0.2s ease;
    background-color: white;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

/* Alerts modernos */
.alert {
    border: none;
    border-radius: 12px;
    padding: 16px 20px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-left: 4px solid var(--accent-color);
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-left: 4px solid var(--info-color);
}

/* Badges modernos */
.badge {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.bg-primary { background: var(--primary-color) !important; }
.bg-success { background: var(--accent-color) !important; }
.bg-danger { background: var(--danger-color) !important; }
.bg-warning { background: var(--warning-color) !important; color: white !important; }
.bg-info { background: var(--info-color) !important; }
.bg-secondary { background: var(--secondary-color) !important; }

/* Tablas modernas */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background-color: var(--body-bg);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    padding: 16px;
    font-size: 14px;
}

.table tbody td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: var(--body-bg);
    transform: scale(1.001);
    transition: all 0.2s ease;
}

/* Timeline mejorado */
.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-left: 2px solid var(--border-color);
}

.timeline-item:last-child {
    border-left: none;
}

.timeline-marker {
    position: absolute;
    left: -8px;
    top: 0;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.timeline-content {
    margin-left: 24px;
    background-color: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar .sidebar-text {
        display: none;
    }
    
    .contenido {
        padding: 20px;
    }
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card, .alert {
    animation: fadeInUp 0.5s ease;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--body-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}