/* ==========================================================
   SISTEMA DE GESTIÓN ESCOLAR - IESTP ABANCAY
   Design System & Global Stylesheet (app.css)
   ========================================================== */

:root {
    --brand-primary: #1e3a8a;       /* Azul marino académico */
    --brand-primary-light: #3b82f6;
    --brand-dark: #0f172a;          /* Slate oscuro para navbars y textos */
    --brand-bg: #f8fafc;            /* Gris neutro muy claro */
    --brand-card-bg: #ffffff;
    --brand-border: #e2e8f0;
    
    /* Estados Semánticos Suaves */
    --status-success-bg: #dcfce7;
    --status-success-text: #166534;
    --status-warning-bg: #fef9c3;
    --status-warning-text: #854d0e;
    --status-danger-bg: #fee2e2;
    --status-danger-text: #991b1b;
    --status-info-bg: #e0f2fe;
    --status-info-text: #075985;
}

body {
    background-color: var(--brand-bg);
    color: #334155;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==========================================================
   HEADER Y NAVEGACIÓN SUPERIOR
   ========================================================== */
.main-navbar {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 50px;
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
}

.main-navbar .navbar-brand {
    font-weight: 700;
    letter-spacing: -0.5px;
    font-size: 1.05rem;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
}

.main-navbar .nav-link, 
.main-navbar .dropdown-toggle {
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.main-navbar .dropdown-menu {
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 95vw;
}

.main-navbar .dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
}

@media (min-width: 992px) and (max-width: 1400px) {
    .main-navbar .nav-link {
        padding: 0.3rem 0.42rem !important;
        font-size: 0.81rem !important;
    }
    .main-navbar .navbar-brand {
        font-size: 0.95rem !important;
        margin-right: 0.35rem !important;
    }
}

/* ==========================================================
   TARJETAS Y CONTENEDORES
   ========================================================== */
.card-modern {
    background: var(--brand-card-bg);
    border: 1px solid var(--brand-border);
    border-radius: 0.75rem;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-modern:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.kpi-card {
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
}

.kpi-card .kpi-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

/* ==========================================================
   TABLA STICKY (CABECERA Y COLUMNAS FIJAS)
   ========================================================== */
.table-sticky-container {
    max-height: 72vh;
    overflow: auto;
    position: relative;
    border: 1px solid var(--brand-border);
    border-radius: 0.5rem;
    background: #fff;
}

.table-sticky-container thead th {
    position: sticky;
    top: 0;
    z-index: 8;
    box-shadow: inset 0 -1px 0 #334155;
}

/* Fijar columna de orden (Nº) */
.sticky-col-num {
    position: sticky !important;
    left: 0;
    z-index: 9;
    background-color: inherit;
    min-width: 45px;
    max-width: 45px;
}

/* Fijar columna de Nombre del Estudiante */
.sticky-col-student {
    position: sticky !important;
    left: 45px;
    z-index: 9;
    background-color: inherit;
    min-width: 260px;
    box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.15);
}

/* Si la celda está en thead, z-index superior */
thead .sticky-col-num,
thead .sticky-col-student {
    z-index: 10 !important;
}

/* Celda de nota interactiva */
.celda-nota-modern {
    width: 55px;
    text-align: center;
    border: 1px solid transparent;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 3px;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    background: transparent;
}

.celda-nota-modern:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.celda-nota-modern:focus {
    background-color: #ffffff;
    border-color: var(--brand-primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
    outline: none;
}

.nota-saved-flash {
    animation: flashSave 0.8s ease;
}

@keyframes flashSave {
    0% { background-color: #bbf7d0; }
    100% { background-color: transparent; }
}

/* ==========================================================
   BADGES Y CHIPS DE ESTADO
   ========================================================== */
.chip-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.chip-aprobado {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
}

.chip-desaprobado {
    background-color: var(--status-danger-bg);
    color: var(--status-danger-text);
}

.chip-presente {
    background-color: var(--status-success-bg);
    color: var(--status-success-text);
}

.chip-tardanza {
    background-color: var(--status-warning-bg);
    color: var(--status-warning-text);
}

.chip-falta {
    background-color: var(--status-danger-bg);
    color: var(--status-danger-text);
}

/* ==========================================================
   BARRA DE BÚSQUEDA EN VIVO
   ========================================================== */
.search-input-wrap {
    position: relative;
    max-width: 320px;
}

.search-input-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.search-input-wrap input {
    padding-left: 36px;
    border-radius: 20px;
    border: 1px solid var(--brand-border);
    font-size: 0.88rem;
    transition: all 0.2s ease;
}

.search-input-wrap input:focus {
    border-color: var(--brand-primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ==========================================================
   TOAST DE NOTIFICACIÓN FLOTANTE
   ========================================================== */
#toastNotificacion {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    min-width: 250px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ==========================================================
   MICRO-INTERACCIONES Y ANIMACIONES AL PASAR EL CURSOR (HOVER)
   ========================================================== */

/* 1. Menús y Navegación */
.main-navbar .nav-link {
    position: relative;
    border-radius: 6px;
    padding: 0.35rem 0.55rem;
    font-size: 0.84rem;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-navbar .nav-link:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.main-navbar .nav-link i {
    transition: transform 0.2s ease, color 0.2s ease;
}

.main-navbar .nav-link:hover i {
    transform: scale(1.18);
    color: #60a5fa !important;
}

/* Items del Dropdown */
.dropdown-menu-dark .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    margin: 1px 4px;
    width: calc(100% - 8px);
}

.dropdown-menu-dark .dropdown-item i {
    font-size: 0.95rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.25s ease;
}

.dropdown-menu-dark .dropdown-item:hover {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.28) 0%, rgba(59, 130, 246, 0.12) 100%) !important;
    color: #ffffff !important;
    transform: translateX(6px);
}

.dropdown-menu-dark .dropdown-item:hover i {
    transform: scale(1.22) rotate(4deg);
    color: #38bdf8 !important;
}

/* Botones interactivos */
.btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.btn:active {
    transform: translateY(0);
}

.btn i {
    display: inline-block;
    transition: transform 0.2s ease;
}

.btn:hover i {
    transform: scale(1.15);
}

/* Tarjetas y Paneles interactivos */
.card-hover-effect {
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}

.card-hover-effect:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.04);
    border-color: #93c5fd !important;
}

/* Filas de tabla */
.table tbody tr {
    transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

.table tbody tr:hover td {
    background-color: #f8fafc !important;
}

/* ==========================================================
   MODOS DE AJUSTE Y DENSIDAD PARA LA SÁBANA DE NOTAS
   ========================================================== */
/* Modo Compacto: Súper ajustable para ver muchas columnas */
.density-compact .table-notas {
    font-size: 0.75rem !important;
}

.density-compact .table-notas th {
    padding: 3px 4px !important;
    font-size: 0.72rem !important;
}

.density-compact .table-notas td {
    padding: 2px 3px !important;
}

.density-compact .celda-nota-modern {
    width: 44px !important;
    padding: 1px 2px !important;
    font-size: 0.78rem !important;
}

.density-compact .sticky-col-student {
    min-width: 200px !important;
    max-width: 220px !important;
    font-size: 0.78rem !important;
}

.density-compact .chip-status {
    padding: 0.15rem 0.4rem !important;
    font-size: 0.65rem !important;
}

/* Modo Cómodo (Default) */
.density-normal .table-notas {
    font-size: 0.85rem;
}

/* Modo Ancho Completo (Full-Width) */
.density-fullwidth .container-fluid {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    max-width: 100% !important;
}

/* ==========================================================
   ALERTAS DE INASISTENCIA (DPI - Desaprobado por Inasistencia)
   ========================================================== */
.chip-dpi {
    background-color: #ef4444;
    color: #ffffff;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    animation: pulseDPI 2s infinite;
}

@keyframes pulseDPI {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.chip-asistencia-alta {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.chip-asistencia-media {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.chip-asistencia-baja {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
