/* ==========================================================================
    MVP - STYLE CENTRAL UNIFICADO PREMIUM CORREGIDO
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Paleta SaaS Core */
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --success: #10b981;
    --success-dark: #059669;
    --error: #ef4444;
    --warning: #f59e0b;
    
    /* Fondos Neutros */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-sidebar: #0f172a; /* Azul noche ultra-oscuro premium */
    
    /* Tipografías y Bordes */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    /* Sombras Elevadas (Efecto Tarjeta Premium) */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.03);
    
    --font-family: 'Inter', -apple-system, sans-serif;
    --border-radius: 12px;
}

/* RESET GENERAL ACCESIBLE */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: var(--font-family); 
}

body { 
    background: var(--bg-secondary); 
    color: var(--text-primary); 
    min-height: 100vh; 
    line-height: 1.5; 
}

/* LAYOUT ESTRUCTURAL FLEXBOX (Sincronizado con tu Header) */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* HEADER SUPERIOR PREMIUM */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 1001; /* Por encima del sidebar */
    box-shadow: var(--shadow-sm);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 800;
    font-size: 1.25rem;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
}

.user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 2px;
}

/* ==========================================================================
   🎯 CORRECCIÓN INTEGRAL DEL SIDEBAR (Usando .app-sidebar e id="sidebar")
   ========================================================================== */
.app-sidebar, #sidebar {
    width: 260px;
    background-color: var(--bg-sidebar) !important; /* Azul noche oscuro */
    padding: 94px 16px 24px 16px !important; /* Margen para librar el header fijo */
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    min-height: 100vh !important;
    flex-shrink: 0;
    box-sizing: border-box;
    border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
    z-index: 1000;
}

.sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    list-style: none !important;
    width: 100% !important;
}

.sidebar-nav-item {
    width: 100%;
    margin-bottom: 2px;
}

.app-sidebar .sidebar-nav-link,
#sidebar .sidebar-nav-link {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 16px !important;
    color: #94a3b8 !important; /* Letras gris claro para contrastar */
    text-decoration: none !important;
    border-radius: 8px !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box;
}

/* Efectos Interactivos Modernos */
.app-sidebar .sidebar-nav-link:hover,
#sidebar .sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #ffffff !important;
}

.app-sidebar .sidebar-nav-link.active,
#sidebar .sidebar-nav-link.active,
.app-sidebar .sidebar-nav-link:focus,
#sidebar .sidebar-nav-link:focus {
    background: var(--primary) !important; /* Azul eléctrico premium */
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25) !important;
}

/* Iconos de la navegación */
.sidebar-nav-icon {
    width: 18px !important;
    height: 18px !important;
    color: inherit !important; /* Hereda el color del texto activo/inactivo */
    flex-shrink: 0;
}

/* ÁREA DE CONTENIDO PRINCIPAL REAJUSTADA */
.main-content {
    flex: 1;
    padding: 94px 24px 24px 24px; /* Libera el espacio del header fijo */
    background: var(--bg-secondary);
    min-height: 100vh;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* TARJETAS PREMIUM EFFECT */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ELEMENTOS DE FORMULARIOS */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.875rem; color: var(--text-primary); }
.form-control, .form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}
.form-control:focus, .form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* BOTONES SAAS UNIFICADOS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.2s ease;
}
.btn-primary { background: var(--primary); color: white; border: none; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--border-color); color: var(--text-primary); }

/* BADGES DE ESTADO */
.status-badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-flex;
}
.status-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.status-secondary { background: rgba(100, 116, 139, 0.1); color: var(--text-secondary); }

/* TABLAS LIMPIAS */
.table-responsive { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th { padding: 12px 16px; background: var(--bg-secondary); color: var(--text-secondary); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; border-bottom: 1px solid var(--border-color); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); font-size: 0.9rem; }

/* ANIMACIONES */
.fade-in { animation: fadeIn 0.3s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }