/* =====================================================================
   Classio — estilos de la aplicación (complementan Bootstrap 5)
   ===================================================================== */

:root {
    --app-sidebar-width: 264px;
    --app-topbar-height: 64px;
    --app-primary: #2f5bea;
    --app-sidebar-bg: #ffffff;
    --app-body-bg: #f4f6fb;
    --bs-primary: #2f5bea;
    --bs-primary-rgb: 47, 91, 234;
    --bs-link-color: #2f5bea;
    --bs-link-color-rgb: 47, 91, 234;
}

.btn-primary {
    --bs-btn-bg: #2f5bea;
    --bs-btn-border-color: #2f5bea;
    --bs-btn-hover-bg: #2549c4;
    --bs-btn-hover-border-color: #2549c4;
    --bs-btn-active-bg: #1f3ea8;
    --bs-btn-active-border-color: #1f3ea8;
    --bs-btn-disabled-bg: #2f5bea;
    --bs-btn-disabled-border-color: #2f5bea;
}
.btn-outline-primary {
    --bs-btn-color: #2f5bea;
    --bs-btn-border-color: #2f5bea;
    --bs-btn-hover-bg: #2f5bea;
    --bs-btn-hover-border-color: #2f5bea;
    --bs-btn-active-bg: #2549c4;
}

/* ---------- Estructura ---------- */
/* Lo visual moderno va bajo .app-body / .auth-body: los impresos (body.reporte) no cambian. */
.app-body {
    --app-primary: #4361ee;
    --app-primary-hover: #3651d4;
    --app-primary-soft: #eef1fe;
    --app-tinta: #0f172a;
    --app-texto: #334155;
    --app-borde: #e6e9f2;
    --app-body-bg: #f4f6fb;
    --app-sidebar-bg: #0f172a;
    --app-sidebar-bg-2: #172036;
    --bs-primary: #4361ee;
    --bs-primary-rgb: 67, 97, 238;
    --bs-link-color: #4361ee;
    --bs-link-color-rgb: 67, 97, 238;
    --bs-link-hover-color: #3651d4;
    --bs-body-color: #334155;
    --bs-border-color: #e6e9f2;
    --bs-border-radius: .6rem;
    --bs-border-radius-sm: .45rem;
    --bs-border-radius-lg: .9rem;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--app-body-bg);
    color: var(--app-texto);
}

.app-shell { display: flex; min-height: 100vh; }
.app-columna { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.app-main { flex: 1 1 auto; }

/* Menú lateral oscuro a toda altura */
.app-sidebar {
    background: linear-gradient(180deg, var(--app-sidebar-bg) 0%, var(--app-sidebar-bg-2) 100%);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
}
@media (min-width: 992px) {
    .app-sidebar {
        width: var(--app-sidebar-width);
        flex-shrink: 0;
        position: sticky;
        top: 0;
        height: 100vh;
    }
}
@media (max-width: 991.98px) {
    .app-sidebar { --bs-offcanvas-width: 280px; --bs-offcanvas-bg: var(--app-sidebar-bg); }
}
.app-marca { display: flex; align-items: center; padding: 1.1rem 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.app-marca-logo { width: 38px; height: 38px; border-radius: .7rem; background: #fff; display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(67, 97, 238, .35); }
.app-marca-texto { color: #fff; font-weight: 700; font-size: 1.1rem; letter-spacing: .01em; }
.app-sidebar-cuerpo { flex: 1 1 auto !important; display: block !important; overflow-y: auto !important; padding: .75rem 0 1rem !important; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.app-sidebar-pie { padding: .75rem 1.25rem; font-size: .72rem; color: #64748b; border-top: 1px solid rgba(255, 255, 255, .06);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Barra superior del área de trabajo */
.app-topbar {
    height: var(--app-topbar-height);
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1rem;
    position: sticky; top: 0; z-index: 1020;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--app-borde);
}
@media (min-width: 992px) { .app-topbar { padding: 0 1.5rem; } }
.app-topbar-fecha { font-size: .85rem; color: #64748b; }
.app-btn-icono { color: var(--app-tinta); border: 0; padding: .25rem .4rem; }
.app-usuario { background: #fff; border: 1px solid var(--app-borde); border-radius: 999px; padding: .25rem .75rem .25rem .3rem; }
.app-usuario:hover, .app-usuario:focus { background: var(--app-primary-soft); border-color: #d5dcfb; }

/* ---------- Menú lateral ---------- */
.app-nav { padding: 0 .75rem; }
.app-nav-titulo {
    font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: #64748b; padding: 1.1rem .75rem .4rem;
}
.app-nav-link, .app-nav-cabecera {
    display: flex; align-items: center; gap: .75rem; width: 100%;
    padding: .55rem .75rem; margin: 2px 0;
    border-radius: .6rem; border: 0; background: transparent;
    color: #cbd5e1; font-size: .9rem; text-decoration: none; text-align: left;
    transition: background-color .15s, color .15s;
}
.app-nav-link i, .app-nav-cabecera i { font-size: 1.05rem; width: 1.25rem; text-align: center; flex-shrink: 0; }
.app-nav-link:hover, .app-nav-cabecera:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.app-nav-link.active {
    background: linear-gradient(90deg, rgba(67, 97, 238, .95), rgba(99, 102, 241, .85));
    color: #fff; font-weight: 600;
    box-shadow: 0 6px 16px rgba(67, 97, 238, .35);
}
.app-nav-link.disabled { color: #475569; }
.app-nav-link .badge { font-size: .6rem; font-weight: 500; background: rgba(255,255,255,.08); color: #94a3b8; }
.app-nav-cabecera { font-weight: 600; color: #e2e8f0; margin-top: .35rem; }
.app-nav-cabecera span { flex: 1 1 auto; }
.app-nav-flecha { font-size: .75rem !important; transition: transform .2s; opacity: .7; }
.app-nav-cabecera:not(.collapsed) .app-nav-flecha { transform: rotate(180deg); }
.app-nav-grupo.contiene-activo > .app-nav-cabecera { color: #fff; }
.app-nav-grupo > ul { position: relative; margin-left: 1.35rem; padding-left: .35rem; border-left: 1px solid rgba(255, 255, 255, .08); }
.app-nav-hijo { font-size: .86rem; padding: .42rem .7rem; }
.app-nav-hijo i { font-size: .95rem; }

/* ---------- Componentes ---------- */
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--app-primary); color: #fff;
    font-weight: 600; font-size: .9rem;
}

.card { border-radius: .75rem; }
.card-header:first-child { border-radius: .75rem .75rem 0 0; }

.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: .75rem;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { font-size: .8rem; color: var(--bs-secondary-color); }

.table > thead th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--bs-secondary-color);
    font-weight: 600;
}

/* ---------- Componentes con estilo moderno (sólo en la aplicación) ---------- */
.app-body .avatar { background: linear-gradient(135deg, #4361ee, #7c3aed); }
.app-body h1.h4, .app-body .h4 { color: var(--app-tinta); font-weight: 700; letter-spacing: -.01em; }
.app-body .card { border-radius: 1rem; }
.app-body .card.shadow-sm, .app-body .card.border-0 { box-shadow: 0 0 0 1px rgba(15, 23, 42, .05), 0 2px 8px rgba(15, 23, 42, .05) !important; }
.app-body .card-header { background: transparent; }
.app-body .card-header .h6, .app-body .card-header h2 { color: var(--app-tinta); font-weight: 600; }
.app-body .stat-card .stat-icon { border-radius: .9rem; }
.app-body .stat-card .stat-value { color: var(--app-tinta); }

.app-body .btn { border-radius: .6rem; font-weight: 500; }
.app-body .btn-sm { border-radius: .5rem; }
.app-body .btn-primary {
    --bs-btn-bg: #4361ee; --bs-btn-border-color: #4361ee;
    --bs-btn-hover-bg: #3651d4; --bs-btn-hover-border-color: #3651d4;
    --bs-btn-active-bg: #2d45b8; --bs-btn-active-border-color: #2d45b8;
    --bs-btn-disabled-bg: #4361ee; --bs-btn-disabled-border-color: #4361ee;
    box-shadow: 0 2px 6px rgba(67, 97, 238, .25);
}
.app-body .btn-outline-primary {
    --bs-btn-color: #4361ee; --bs-btn-border-color: #c9d2fb;
    --bs-btn-hover-bg: #4361ee; --bs-btn-hover-border-color: #4361ee;
    --bs-btn-active-bg: #3651d4; --bs-btn-active-border-color: #3651d4;
}
.app-body .btn-outline-secondary { --bs-btn-color: #475569; --bs-btn-border-color: #d7dce7; --bs-btn-hover-bg: #f1f4f9; --bs-btn-hover-color: #0f172a; --bs-btn-hover-border-color: #c6cddc; }

.app-body .form-control, .app-body .form-select { border-color: #dfe3ec; border-radius: .6rem; }
.app-body .form-control-sm, .app-body .form-select-sm { border-radius: .5rem; }
.app-body .form-control:focus, .app-body .form-select:focus { border-color: #8da0f5; box-shadow: 0 0 0 .2rem rgba(67, 97, 238, .15); }
.app-body .form-check-input:checked { background-color: #4361ee; border-color: #4361ee; }
.app-body .form-label { font-weight: 500; color: #475569; }
.app-body .input-group-text { background: #f6f8fc; border-color: #dfe3ec; }

.app-body .table { --bs-table-hover-bg: #f6f8fd; }
.app-body .table > thead th { background: #f8fafc; color: #64748b; font-size: .72rem; letter-spacing: .05em; border-bottom-color: var(--app-borde); }
.app-body .table > :not(caption) > * > * { border-bottom-color: #eef1f6; }
.app-body .list-group-item { border-color: #eef1f6; }

.app-body .badge { font-weight: 600; letter-spacing: .01em; }
.app-body .alert { border-radius: .8rem; border: 0; border-left: 4px solid currentColor; }
.app-body .dropdown-menu { border: 1px solid var(--app-borde); border-radius: .8rem; padding: .4rem; }
.app-body .dropdown-item { border-radius: .5rem; padding: .45rem .75rem; }
.app-body .nav-tabs .nav-link.active { font-weight: 600; }
.app-body .pagination { --bs-pagination-border-radius: .6rem; }
.app-body .modal-content { border: 0; border-radius: 1rem; box-shadow: 0 20px 50px rgba(15, 23, 42, .2); }

/* Botón de apariencia: muestra el ícono de la preferencia actual */
.app-tema i { display: none; font-size: 1.15rem; }
[data-tema="claro"] .app-tema .icono-claro, [data-tema="oscuro"] .app-tema .icono-oscuro,
[data-tema="auto"] .app-tema .icono-auto, html:not([data-tema]) .app-tema .icono-auto { display: inline-block; }

/* ---------- Modo oscuro (sólo la aplicación; los impresos siguen claros) ---------- */
[data-bs-theme="dark"] .app-body {
    --app-tinta: #f1f5f9;
    --app-texto: #cbd5e1;
    --app-borde: #243047;
    --app-body-bg: #0b1120;
    --app-primary-soft: rgba(67, 97, 238, .16);
    --app-sidebar-bg: #070b16;
    --app-sidebar-bg-2: #0d1426;
    --bs-body-color: #cbd5e1;
    --bs-body-bg: #111a2e;
    --bs-secondary-bg: #172238;
    --bs-tertiary-bg: #152036;
    --bs-border-color: #243047;
    --bs-link-color: #8ea2ff;
    --bs-link-color-rgb: 142, 162, 255;
    --bs-link-hover-color: #b4c1ff;
    --bs-emphasis-color: #f8fafc;
    color-scheme: dark;
}
[data-bs-theme="dark"] .app-body .app-topbar { background: rgba(11, 17, 32, .8); }
[data-bs-theme="dark"] .app-body .app-topbar-fecha { color: #94a3b8; }
[data-bs-theme="dark"] .app-body .app-btn-icono { color: #e2e8f0; }
[data-bs-theme="dark"] .app-body .app-usuario { background: #111a2e; border-color: var(--app-borde); color: #e2e8f0; }
[data-bs-theme="dark"] .app-body .app-usuario:hover { background: #172238; border-color: #33415c; }
[data-bs-theme="dark"] .app-body .card.shadow-sm, [data-bs-theme="dark"] .app-body .card.border-0 {
    box-shadow: 0 0 0 1px rgba(148, 163, 184, .1), 0 4px 14px rgba(0, 0, 0, .25) !important;
}
[data-bs-theme="dark"] .app-body .table { --bs-table-bg: transparent; --bs-table-hover-bg: rgba(148, 163, 184, .07); --bs-table-color: #cbd5e1; }
[data-bs-theme="dark"] .app-body .table > thead th { background: #0f172a; color: #94a3b8; }
[data-bs-theme="dark"] .app-body .table > :not(caption) > * > * { border-bottom-color: #1e293b; }
[data-bs-theme="dark"] .app-body .table-light { --bs-table-bg: #0f172a; --bs-table-color: #cbd5e1; --bs-table-border-color: #243047; --bs-table-striped-bg: #131d33; --bs-table-hover-bg: #172238; }
[data-bs-theme="dark"] .app-body .list-group-item { border-color: #1e293b; }
[data-bs-theme="dark"] .app-body .form-control, [data-bs-theme="dark"] .app-body .form-select { background-color: #0d1527; border-color: #2a3650; color: #e2e8f0; }
[data-bs-theme="dark"] .app-body .form-control::placeholder { color: #64748b; }
[data-bs-theme="dark"] .app-body .form-control:disabled, [data-bs-theme="dark"] .app-body .form-select:disabled { background-color: #131c30; }
[data-bs-theme="dark"] .app-body .input-group-text { background: #152036; border-color: #2a3650; color: #94a3b8; }
[data-bs-theme="dark"] .app-body .form-label { color: #94a3b8; }
[data-bs-theme="dark"] .app-body .btn-outline-secondary { --bs-btn-color: #cbd5e1; --bs-btn-border-color: #334155; --bs-btn-hover-bg: #1e293b; --bs-btn-hover-color: #f8fafc; --bs-btn-hover-border-color: #475569; --bs-btn-active-bg: #1e293b; --bs-btn-active-color: #fff; }
[data-bs-theme="dark"] .app-body .btn-outline-primary { --bs-btn-color: #8ea2ff; --bs-btn-border-color: #3a4a8a; }
[data-bs-theme="dark"] .app-body .btn-light { --bs-btn-bg: #1e293b; --bs-btn-color: #e2e8f0; --bs-btn-border-color: #334155; --bs-btn-hover-bg: #273449; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .app-body .bg-light { background-color: var(--bs-tertiary-bg) !important; }
[data-bs-theme="dark"] .app-body .text-bg-light { background-color: #243047 !important; color: #e2e8f0 !important; }
[data-bs-theme="dark"] .app-body .dropdown-menu { --bs-dropdown-bg: #111a2e; --bs-dropdown-link-hover-bg: #1e293b; --bs-dropdown-link-active-bg: #4361ee; }
[data-bs-theme="dark"] .app-body .modal-content { background: #111a2e; }
[data-bs-theme="dark"] .app-body .nav-tabs { --bs-nav-tabs-link-active-bg: #111a2e; --bs-nav-tabs-link-active-border-color: #243047 #243047 #111a2e; }
[data-bs-theme="dark"] .app-body .planilla-notas .input-nota.cambiada { background: rgba(255, 193, 7, .16); }
[data-bs-theme="dark"] .app-body .sticky-bottom.bg-body { background-color: var(--bs-body-bg) !important; }

/* ---------- Login / errores ---------- */
.auth-body {
    background:
        radial-gradient(circle at 15% 20%, rgba(124, 58, 237, .35), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(67, 97, 238, .45), transparent 45%),
        linear-gradient(135deg, #0f172a 0%, #172554 100%);
    min-height: 100vh;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.auth-wrapper {
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 1.5rem 1rem;
}
.auth-card { width: 100%; max-width: 420px; border: 0; border-radius: 1.25rem; box-shadow: 0 25px 60px rgba(2, 6, 23, .45) !important; }
.auth-card .btn-primary { --bs-btn-bg: #4361ee; --bs-btn-border-color: #4361ee; --bs-btn-hover-bg: #3651d4; --bs-btn-hover-border-color: #3651d4; border-radius: .6rem; }
.auth-card .form-control, .auth-card .input-group-text, .auth-card .btn { border-radius: .6rem; }
.auth-body .text-body-secondary.small.mt-3, .auth-wrapper > p { color: rgba(255, 255, 255, .6) !important; }

/* ---------- Asistencia y calificaciones ---------- */
.btn-asistencia { min-width: 2.75rem; padding-top: .45rem; padding-bottom: .45rem; }

.planilla-notas th, .planilla-notas td { vertical-align: middle; }
.planilla-notas .col-estudiante { position: sticky; left: 0; background: var(--bs-body-bg); z-index: 2; min-width: 13rem; }
.planilla-notas thead .col-estudiante { z-index: 3; }
.planilla-notas .th-actividad { min-width: 5.5rem; max-width: 9rem; font-size: .75rem; text-transform: none; letter-spacing: 0; white-space: normal; }
.planilla-notas .input-nota { width: 4.5rem; text-align: center; margin: 0 auto; padding: .25rem .35rem; }
.planilla-notas .input-nota.nota-baja { color: var(--bs-danger); font-weight: 600; }
.planilla-notas .input-nota.cambiada { background: #fff8e1; }
.planilla-notas .fila-inactiva { opacity: .6; }
.planilla-notas .col-promedio { min-width: 6.5rem; }
.tarjeta-acceso { transition: transform .1s, box-shadow .1s; }
.tarjeta-acceso:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(0,0,0,.08) !important; }

/* Pestañas: desplazamiento horizontal en pantallas angostas, sin barra vertical */
.pestanas-desplazables { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }

/* Foto del estudiante (ficha y formulario) */
.foto-estudiante { width: 132px; height: 160px; object-fit: cover; }
.foto-estudiante-mini { width: 72px; height: 88px; object-fit: cover; }

/* Asistencia docente: calendario del mes */
.calendario-docente { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: .8rem; }
.calendario-docente .cab { font-weight: 600; color: var(--bs-secondary-color); }
.calendario-docente .dia { display: block; padding: .2rem 0; border-radius: .25rem; text-decoration: none; color: inherit; border: 1px solid transparent; }
.calendario-docente .dia:hover { border-color: var(--bs-primary); }
.calendario-docente .dia.actual { border-color: var(--bs-primary); font-weight: 700; }
.calendario-docente .con-registro, .leyenda.con-registro { background: rgba(25, 135, 84, .18); }
.calendario-docente .pendiente, .leyenda.pendiente { background: rgba(255, 193, 7, .3); }
.calendario-docente .no-habil, .leyenda.no-habil { background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); }
.leyenda { display: inline-block; width: .8rem; height: .8rem; border-radius: .2rem; vertical-align: middle; }

/* Gestión de archivos: árbol de carpetas */
.archivos-arbol-item {
    display: flex;
    align-items: center;
    gap: .25rem;
    min-width: 0;
    padding: .35rem .5rem;
    border-radius: .375rem;
    color: var(--bs-body-color);
    font-size: .875rem;
    text-decoration: none;
}
.archivos-arbol-item:hover { background: var(--bs-tertiary-bg); }
.archivos-arbol-item.active { background: var(--bs-primary); color: #fff; }
.archivos-fragmento { color: var(--bs-secondary-color); overflow-wrap: anywhere; }
.archivos-busqueda { flex: 1 1 18rem; width: auto; }
.archivos-documento { min-width: 12rem; }
