@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ============================================================
   VARIABLES DEL TEMA — MiSalón
   ============================================================ */
:root {
    --sidebar-bg:       #1e2a3a;
    --sidebar-hover:    #2d3f56;
    --sidebar-active:   #4361ee;
    --sidebar-width:    240px;
    --sidebar-text:     #b8c7d9;
    --sidebar-text-bright: #ffffff;
    --content-bg:       #f4f6f9;
    --accent-blue:      #4361ee;
    --accent-hover:     #3651d4;
    --card-shadow:      0 2px 10px rgba(0, 0, 0, 0.07);
    --card-radius:      12px;
    --table-stripe:     #f5f7ff;
}

/* ============================================================
   RESET Y BASE
   ============================================================ */
html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--content-bg);
    height: 100%;
    margin: 0;
}

h1:focus { outline: none; }

a { color: var(--accent-blue); }

.btn-link { color: var(--accent-blue); }

/* ============================================================
   LAYOUT GENERAL DE LA APP
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar-fixed {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}

/* Logo / nombre de la app */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 20px 20px;
    color: var(--sidebar-text-bright);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

.sidebar-brand-icon {
    font-size: 1.4rem;
    color: var(--accent-blue);
}

.sidebar-brand-text {
    font-size: 1.3rem;
}

/* Separador dentro del sidebar */
.sidebar-divider {
    border-color: rgba(255,255,255,0.1);
    margin: 4px 16px;
}

/* ============================================================
   NAVEGACIÓN DEL SIDEBAR
   ============================================================ */
.sidebar-nav {
    flex: 1;
    padding: 8px 0;
}

.sidebar-nav-section {
    padding: 4px 0;
}

.sidebar-nav-section-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(184,199,217,0.5);
    padding: 8px 20px 4px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text-bright);
    border-left-color: var(--accent-blue);
}

.sidebar-nav-link.active {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text-bright);
    border-left-color: var(--accent-blue);
}

.sidebar-nav-icon {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* Ítem deshabilitado (secciones futuras) */
.disabled-nav {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Badge "Próximo" */
.sidebar-nav-badge {
    margin-left: auto;
    font-size: 0.65rem;
    background-color: rgba(255,255,255,0.1);
    color: var(--sidebar-text);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

/* ============================================================
   PIE DEL SIDEBAR (usuario + logout)
   ============================================================ */
.sidebar-footer {
    padding: 8px 0 16px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    color: var(--sidebar-text);
    font-size: 0.82rem;
    overflow: hidden;
    text-decoration: none;
    cursor: pointer;
    border-radius: 6px;
    margin: 0 8px;
    transition: background 0.15s;
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-user-icon {
    flex-shrink: 0;
    font-size: 0.9rem;
}

.sidebar-user-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.15s, background 0.15s;
}

.sidebar-logout-btn:hover {
    color: #ff6b6b;
    background-color: rgba(255,107,107,0.1);
}

/* ============================================================
   ÁREA DE CONTENIDO PRINCIPAL
   ============================================================ */
.content-area {
    margin-left: var(--sidebar-width);
    flex: 1;
    background-color: var(--content-bg);
    min-height: 100vh;
    padding: 28px;
}

/* ============================================================
   TARJETAS DEL DASHBOARD
   ============================================================ */
.card-dashboard {
    background: #ffffff;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
    border: 1px solid rgba(0,0,0,0.04);
}

/* Wrapper enlace para tarjetas KPI clickeables del dashboard */
.card-dashboard-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--card-radius);
    transition: transform 0.15s, box-shadow 0.15s;
}

.card-dashboard-link:hover {
    text-decoration: none;
    color: inherit;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67,97,238,0.13);
}

.card-dashboard-link:hover .card-dashboard {
    border-color: rgba(67,97,238,0.25);
}

/* Encabezado de sección dentro de la tarjeta */
.card-dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef0f4;
}

.card-dashboard-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

/* Título de página */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 6px;
}

.page-subtitle {
    font-size: 0.88rem;
    color: #7f8c8d;
    margin-bottom: 24px;
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn-accent {
    background-color: var(--accent-blue);
    color: #ffffff;
    border: none;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
}

.btn-accent:hover {
    background-color: var(--accent-hover);
    color: #ffffff;
    transform: translateY(-1px);
}

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

.btn-outline-accent {
    border: 2px solid var(--accent-blue);
    color: var(--accent-blue);
    background: transparent;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-outline-accent:hover {
    background-color: var(--accent-blue);
    color: #ffffff;
}

/* ============================================================
   TABLAS
   ============================================================ */
.table-dashboard {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table-dashboard thead th {
    background-color: #f8f9ff;
    color: #5a6a7e;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 12px 16px;
    border-bottom: 2px solid #eef0f4;
    white-space: nowrap;
}

.table-dashboard tbody tr {
    transition: background 0.12s;
}

.table-dashboard tbody tr:nth-child(odd) {
    background-color: var(--table-stripe);
}

.table-dashboard tbody tr:hover {
    background-color: #eef2ff;
}

.table-dashboard tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    color: #3d4f60;
    border-bottom: 1px solid #f0f2f8;
    font-size: 0.9rem;
}

/* ============================================================
   BADGES DE ESTADO (semáforo)
   ============================================================ */
.badge-activo {
    background-color: #d4edda;
    color: #1a7a3f;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
}

.badge-inactivo {
    background-color: #f8d7da;
    color: #842029;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
}

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-label {
    font-weight: 600;
    font-size: 0.88rem;
    color: #4a5568;
    margin-bottom: 4px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 0.2rem rgba(67,97,238,0.15);
}

.form-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eef0f4;
}

/* Mensajes de validación */
.validation-message {
    color: #dc3545;
    font-size: 0.82rem;
    margin-top: 4px;
}

.valid.modified:not([type=checkbox]) { outline: 1px solid #28a745; }
.invalid { outline: 1px solid #dc3545; }

/* ============================================================
   BUSCADOR
   ============================================================ */
.search-input-wrapper {
    position: relative;
}

.search-input-wrapper .oi-magnifying-glass {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa5b4;
    font-size: 0.85rem;
}

.search-input-wrapper input {
    padding-left: 36px;
}

/* ============================================================
   GRÁFICAS DEL DASHBOARD (Fase 8.5 Parte 2)
   ============================================================ */

/* Contenedor que le da altura fija al canvas de Chart.js
   (Chart.js necesita un contenedor con height definida cuando maintainAspectRatio=false) */
.grafica-contenedor {
    position: relative;
    height: 260px;
}

/* Título de cada gráfica — subtítulo discreto encima del canvas */
.grafica-titulo {
    font-weight: 600;
    font-size: .88rem;
    color: var(--text-secondary, #6c757d);
    margin-bottom: .6rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Mensaje cuando no hay datos suficientes para mostrar la gráfica */
.grafica-sin-datos {
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #6c757d);
    font-size: .9rem;
    background: var(--content-bg, #f4f6f9);
    border-radius: 8px;
    border: 1px dashed var(--border-color, #e8ecf0);
}

/* ============================================================
   TARJETA DE ALUMNOS EN RIESGO (Fase 8.5)
   ============================================================ */

/* Badge con el total de alumnos en riesgo en el encabezado */
.badge-riesgo-total {
    background: #dc3545;
    color: #ffffff;
    font-size: .78rem;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 999px;
}

/* Fila de cada alumno en riesgo — enlace completo, estilo discreto */
.riesgo-fila {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color, #e8ecf0);
    text-decoration: none !important;
    color: var(--text-primary, #1e293b);
    transition: background 0.12s;
}

.riesgo-fila:hover {
    background: var(--content-bg, #f4f6f9);
    color: var(--text-primary, #1e293b);
    border-radius: 6px;
    padding-left: 6px;
    padding-right: 6px;
}

/* Nombre del alumno */
.riesgo-nombre {
    font-weight: 500;
    font-size: .9rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Contenedor de badges de criterios de riesgo */
.riesgo-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Badge rojo para promedio bajo */
.badge-riesgo-promedio {
    background: #fee2e2;
    color: #b91c1c;
    font-size: .75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Badge naranja para faltas */
.badge-riesgo-faltas {
    background: #fff3cd;
    color: #92400e;
    font-size: .75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Modo oscuro: ajustar los badges para que sean legibles */
[data-tema="oscuro"] .badge-riesgo-promedio {
    background: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
}

[data-tema="oscuro"] .badge-riesgo-faltas {
    background: rgba(234, 179, 8, 0.15);
    color: #fcd34d;
}

/* ============================================================
   PÁGINA DE LOGIN — DISEÑO DE DOS COLUMNAS
   Formulario a la izquierda (40%), marca a la derecha (60%)
   ============================================================ */

/* Contenedor principal: pantalla completa dividida en dos paneles */
.login-split {
    display: flex;
    min-height: 100vh;
}

/* ── Panel izquierdo (40%): formulario ── */
.login-panel-left {
    width: 40%;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    flex-direction: column;
}

/* Contenedor interno del formulario */
.login-form-wrap {
    width: 100%;
    max-width: 360px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Logo en la parte superior del formulario */
.login-logo-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
}

.login-logo-icon {
    font-size: 1.5rem;
    color: var(--accent-blue);
}

.login-logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e2a3a;
    letter-spacing: 0.5px;
}

.login-form-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e2a3a;
    margin-bottom: 6px;
}

/* Texto al pie del formulario */
.login-footer-text {
    text-align: center;
    font-size: 0.78rem;
    color: #b0b8c1;
    margin-top: 40px;
    margin-bottom: 0;
}

/* Ícono prefijo del input (candado, correo) */
.login-input-icon {
    background-color: #ffffff !important;
    border-right: none !important;
    color: #9aa5b4;
    padding-right: 8px;
}

/* Campo del formulario sin borde izquierdo (fusionado con el ícono) */
.login-field {
    border-left: none !important;
    border-right: none !important;
    padding-left: 4px !important;
    box-shadow: none !important;
}

/* Cuando el grupo recibe foco: resaltar el borde completo en azul */
.login-input-group:focus-within .login-input-icon,
.login-input-group:focus-within .login-field,
.login-input-group:focus-within .login-toggle-pw {
    border-color: var(--accent-blue);
}

/* Botón de mostrar/ocultar contraseña */
.login-toggle-pw {
    background-color: #ffffff !important;
    border-left: none !important;
    cursor: pointer;
    user-select: none;
    padding: 0 14px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #6c757d;
    letter-spacing: 0.3px;
    transition: background 0.15s, color 0.15s;
}

.login-toggle-pw:hover {
    background-color: #f0f3ff !important;
    color: var(--accent-blue);
}

/* ── Panel derecho (60%): marca y beneficios ── */
.login-panel-right {
    width: 60%;
    background: linear-gradient(135deg, #1a3a6b 0%, #4361ee 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
}

/* Contenido centrado del panel de marca */
.login-brand-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 440px;
}

.login-brand-emoji {
    font-size: 5rem;
    margin-bottom: 24px;
    line-height: 1;
}

.login-brand-title {
    font-size: 3rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 1px;
    margin-bottom: 12px;
    line-height: 1.1;
}

.login-brand-subtitle {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 40px;
    letter-spacing: 0.3px;
}

/* Lista de beneficios */
.login-benefits {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.login-benefits li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px 0;
}

.login-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Responsivo: pantallas pequeñas (<768px) ── */
@media (max-width: 767px) {
    .login-panel-right {
        display: none;
    }

    .login-panel-left {
        width: 100%;
        min-height: 100vh;
        padding: 24px;
    }
}

/* ============================================================
   ALERTAS Y MENSAJES
   ============================================================ */
.alert-exito {
    background-color: #d4edda;
    color: #1a7a3f;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.alert-error {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

/* ============================================================
   MODAL DE CONFIRMACIÓN
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.modal-confirmacion,
.modal-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumb-wrapper {
    font-size: 0.82rem;
}

.breadcrumb-wrapper .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-wrapper .breadcrumb-item a {
    color: #7f8c8d;
    text-decoration: none;
}

.breadcrumb-wrapper .breadcrumb-item a:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

.breadcrumb-wrapper .breadcrumb-item.active {
    color: #4a5568;
}

.breadcrumb-wrapper .breadcrumb-item + .breadcrumb-item::before {
    color: #b0b8c4;
}

/* ============================================================
   DARK MODE — variables y overrides
   ============================================================ */
html.dark-mode {
    --content-bg:    #141929;
    --sidebar-bg:    #0e1520;
    --sidebar-hover: #1a2437;
    --table-stripe:  #1a2236;
    --card-shadow:   0 2px 10px rgba(0,0,0,0.4);
}

html.dark-mode body {
    background-color: var(--content-bg);
    color: #c8d6e8;
}

html.dark-mode .card-dashboard {
    background: #1b2438;
    border-color: rgba(255,255,255,0.06);
}

html.dark-mode .page-title {
    color: #dce9f7;
}

html.dark-mode .page-subtitle,
html.dark-mode .text-muted {
    color: #7a90a8 !important;
}

html.dark-mode .card-dashboard-title {
    color: #dce9f7;
}

html.dark-mode .table-dashboard thead th {
    background-color: #212d44;
    color: #8fa5c0;
    border-bottom-color: #2a3856;
}

html.dark-mode .table-dashboard tbody tr:nth-child(odd) {
    background-color: var(--table-stripe);
}

html.dark-mode .table-dashboard tbody tr:hover {
    background-color: #223050;
}

html.dark-mode .table-dashboard tbody td {
    color: #c0d0e4;
    border-bottom-color: #1e2d46;
}

html.dark-mode .form-control,
html.dark-mode .form-select {
    background-color: #1b2438;
    border-color: #2e3d56;
    color: #c8d6e8;
}

html.dark-mode .form-control:focus,
html.dark-mode .form-select:focus {
    background-color: #1b2438;
    color: #c8d6e8;
    border-color: var(--accent-blue);
}

html.dark-mode .form-control::placeholder {
    color: #4f6480;
}

html.dark-mode .form-section-title {
    color: #8fa5c0;
    border-bottom-color: #2e3d56;
}

html.dark-mode .modal-confirmacion,
html.dark-mode .modal-card {
    background: #1b2438;
    color: #c8d6e8;
}

html.dark-mode .modal-overlay {
    background: rgba(0,0,0,0.7);
}

html.dark-mode .breadcrumb-wrapper .breadcrumb-item a {
    color: #6b8ca8;
}

html.dark-mode .breadcrumb-wrapper .breadcrumb-item.active {
    color: #8fa5c0;
}

html.dark-mode .alert-exito {
    background-color: #1a3a28;
    color: #5db87a;
    border-color: #2a5a3e;
}

html.dark-mode .alert-error {
    background-color: #3a1a1a;
    color: #e87a7a;
    border-color: #5a2a2a;
}

html.dark-mode .badge-activo {
    background-color: #1a3a28;
    color: #5db87a;
}

html.dark-mode .badge-inactivo {
    background-color: #3a1a1a;
    color: #e87a7a;
}

/* Botón de modo oscuro en el sidebar */
.dark-mode-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    font-size: 0.88rem;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    transition: color 0.15s, background 0.15s;
}

.dark-mode-btn:hover {
    color: var(--sidebar-text-bright);
    background-color: var(--sidebar-hover);
}

/* Contexto de grupo y ciclo debajo del logo */
.sidebar-context {
    padding: 0 20px 12px;
    font-size: 0.78rem;
    color: rgba(184,199,217,0.65);
    line-height: 1.4;
}

.sidebar-context strong {
    color: rgba(184,199,217,0.9);
    font-size: 0.82rem;
}

/* ============================================================
   BLAZOR ERROR UI (mantener del template)
   ============================================================ */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Ocurrió un error inesperado."
}

/* ============================================================
   FASE 7.11 — Fuente Inter más moderna y legible
   ============================================================ */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont,
        'Segoe UI', sans-serif !important;
}

/* ============================================================
   FASE 7.11 — Botones más redondeados
   ============================================================ */
.btn {
    border-radius: 8px !important;
}

.btn-primary {
    border-radius: 8px !important;
}

.btn-sm {
    border-radius: 6px !important;
}

/* ============================================================
   FASE 7.11 — Header superior: buscador, campanita y usuario
   ============================================================ */

/* Variables necesarias para el header (con fallback si no existen) */
:root {
    --card-bg:        #ffffff;
    --border-color:   #e8ecf0;
    --text-primary:   #1e293b;
    --text-secondary: #6c757d;
}

/* En modo oscuro, definir los valores correspondientes */
html.dark-mode {
    --card-bg:        #1a2437;
    --border-color:   rgba(255,255,255,0.08);
    --text-primary:   #dce9f7;
    --text-secondary: #7a90a8;
}

/* ============================================================
   FASE 7.12 — Sistema de notificaciones Toast
   ============================================================ */

/* Área fija en la esquina inferior derecha donde se apilan los toasts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
    pointer-events: none;
}

/* Cada toast individual — nombre de clase .toast-item evita conflicto con Bootstrap .toast */
.toast-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: toastEntrada 0.3s ease;
    min-width: 280px;
    pointer-events: auto;
    opacity: 1;
}

/* Colores por tipo */
.toast-exito       { background: #22c55e; }
.toast-error       { background: #ef4444; }
.toast-advertencia { background: #f59e0b; }
.toast-info        { background: #3b82f6; }

/* Ícono emoji al inicio del toast */
.toast-icono {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Texto del mensaje — ocupa el espacio disponible */
.toast-mensaje { flex: 1; }

/* Botón de cierre manual */
.toast-cerrar {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.toast-cerrar:hover { color: #ffffff; }

/* Animación de entrada desde la derecha */
@keyframes toastEntrada {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Wrapper que agrupa el header + el cuerpo de la página */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--content-bg);
}

/* El .content-area dentro del wrapper ya no necesita su propio margin-left */
.main-wrapper .content-area {
    margin-left: 0;
}

/* Barra horizontal fija en la parte superior del contenido */
.top-header {
    height: 60px;
    background: var(--card-bg, #ffffff);
    border-bottom: 1px solid var(--border-color, #e8ecf0);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 99;
    flex-shrink: 0;
}

/* Barra de búsqueda — contenedor visual del input */
.top-header .search-input {
    flex: 1;
    max-width: 380px;
    background: var(--content-bg, #f4f6f9);
    border: 1px solid var(--border-color, #e8ecf0);
    border-radius: 8px;
    padding: 7px 14px;
    color: var(--text-secondary, #6c757d);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Sección derecha: campanita, avatar y nombre */
.top-header .header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Campanita de notificaciones */
.top-header .bell-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-secondary, #6c757d);
    cursor: pointer;
    padding: 4px;
}

/* Círculo de avatar con inicial del nombre */
.top-header .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #4361ee;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Columna nombre + rol */
.top-header .user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

/* Nombre completo de la maestra */
.top-header .user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    white-space: nowrap;
}

/* Rol debajo del nombre */
.top-header .user-role {
    font-size: 0.75rem;
    color: var(--text-secondary, #6c757d);
}

/* ============================================================
   HEADER — Dropdown de usuario y botón de tema
   ============================================================ */

/* Wrapper: position:relative anclado para el panel absoluto;
   display:flex mantiene el alineado vertical dentro del header */
.user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

/* Área clickeable: avatar + nombre */
.user-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 8px;
    padding: 4px 8px;
    transition: background 0.15s;
}

.user-dropdown-trigger:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Panel desplegable — se ancla al borde inferior del trigger hacia abajo */
.user-dropdown-panel {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e8ecf0);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    z-index: 300;
    overflow: hidden;
}

/* Sección superior: info de la maestra con fondo diferenciado */
.user-dropdown-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--content-bg, #f4f6f9);
}

/* Avatar circular dentro del panel */
.user-dropdown-info-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-blue, #4361ee);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Columna con nombre y rol */
.user-dropdown-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.user-dropdown-info-nombre {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-info-rol {
    font-size: 0.75rem;
    color: var(--text-secondary, #6c757d);
}

/* Separador entre la info y las opciones */
.user-dropdown-sep {
    margin: 0;
    border-color: var(--border-color, #e8ecf0);
}

/* Opción dentro del dropdown */
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary, #3d4f60);
    text-decoration: none !important;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}

.user-dropdown-item:hover {
    background: var(--content-bg, #f4f6f9);
    color: var(--accent-blue, #4361ee);
    text-decoration: none !important;
}

/* Variante roja para cerrar sesión */
.user-dropdown-item-danger {
    color: #dc3545 !important;
}

.user-dropdown-item-danger:hover {
    background: #fff5f5 !important;
    color: #b02a37 !important;
}

/* ============================================================
   FASE 7.12 — Botones de acciones en tabla de actividades
   Evita que los botones se partan en dos filas
   ============================================================ */
.acciones-tabla {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: center;
}

/* ============================================================
   FASE 7.14 — Campanilla de notificaciones
   Componente CampanillaNotificaciones.razor en el header
   ============================================================ */

/* Wrapper con position:relative para que el panel se posicione debajo del botón */
.campanilla-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Badge rojo encima de la campana con el número de no leídas */
.campanilla-btn {
    position: relative;
}

.badge-notif {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: #ffffff;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    pointer-events: none;
}

/* Panel desplegable de notificaciones — alineado a la derecha del botón */
.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-width: 92vw;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e8ecf0);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 200;
    max-height: 440px;
    overflow-y: auto;
}

/* Encabezado del panel con título y botón "marcar todas" */
.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--border-color, #e8ecf0);
    position: sticky;
    top: 0;
    background: var(--card-bg, #ffffff);
    z-index: 1;
}

.notif-panel-titulo {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
}

.notif-marcar-todas {
    font-size: 0.75rem;
    color: var(--accent-blue, #4361ee);
    text-decoration: none;
}

.notif-marcar-todas:hover {
    text-decoration: underline;
}

/* Cada elemento de la lista de notificaciones */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--border-color, #e8ecf0);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--content-bg, #f4f6f9);
}

/* Fondo destacado para notificaciones no leídas */
.notif-no-leida {
    background: rgba(67, 97, 238, 0.05);
}

.notif-no-leida:hover {
    background: rgba(67, 97, 238, 0.1);
}

/* Ícono de la notificación */
.notif-icono {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Columna con título, mensaje y tiempo */
.notif-contenido {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.notif-titulo {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-mensaje {
    font-size: 0.75rem;
    color: var(--text-secondary, #6c757d);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-tiempo {
    font-size: 0.7rem;
    color: var(--text-secondary, #6c757d);
    opacity: 0.8;
}

/* Mensaje cuando no hay notificaciones */
.notif-vacio {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-secondary, #6c757d);
    font-size: 0.875rem;
    margin: 0;
}

/* ============================================================
   FASE 7.12 — Estilos de impresión
   Oculta la navegación y ajusta el layout al imprimir
   ============================================================ */

/* El encabezado de impresión está oculto en pantalla — solo aparece al imprimir */
.print-header {
    display: none;
}

@media print {
    /* Ocultar TODO excepto el contenido principal
       Cubre el sidebar (sidebar-fixed), el header y cualquier variante de clase */
    .sidebar-fixed,
    .sidebar,
    nav,
    .top-header,
    header,
    .btn-imprimir,
    .no-print,
    [class*="sidebar"],
    [class*="nav-menu"] {
        display: none !important;
        visibility: hidden !important;
    }

    /* El contenido ocupa toda la página al eliminar el margen del sidebar */
    .main-wrapper,
    .main-content,
    [class*="main-content"] {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 !important;
    }

    .content-area,
    [class*="content-area"] {
        padding: 8px !important;
        width: 100% !important;
    }

    /* Fondo blanco y texto negro en todos los elementos */
    * {
        background: #ffffff !important;
        color: #000000 !important;
        box-shadow: none !important;
        border-color: #cccccc !important;
    }

    /* Tablas con bordes visibles y fuente compacta */
    table {
        border-collapse: collapse !important;
        width: 100% !important;
        font-size: 11px !important;
    }

    th, td {
        border: 1px solid #000000 !important;
        padding: 4px 6px !important;
    }

    th {
        background: #eeeeee !important;
        font-weight: bold !important;
    }

    /* Encabezado de impresión — visible solo al imprimir */
    .print-header {
        display: block !important;
        text-align: center !important;
        margin-bottom: 12px !important;
        font-size: 13px !important;
        font-weight: bold !important;
        color: #000000 !important;
    }

    /* Forzar salto de página antes del elemento */
    .page-break {
        page-break-before: always !important;
    }

    /* Los colores del semáforo no tienen sentido en blanco y negro */
    .text-success, .text-warning, .text-danger {
        color: #000000 !important;
    }
}

/* ============================================================
   FASE 7.13 — Búsqueda global
   Componente BusquedaGlobal.razor en el header
   ============================================================ */

/* El contenedor hereda los estilos de .search-input;
   position:relative permite que el panel se posicione debajo del input */
.busqueda-global {
    position: relative;
}

/* Campo de texto real sin estilos nativos del navegador */
.busqueda-input-campo {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary, #1e293b);
    font-size: 0.875rem;
    font-family: inherit;
    min-width: 0;
}

.busqueda-input-campo::placeholder {
    color: var(--text-secondary, #6c757d);
}

/* Panel de resultados — dropdown con sombra debajo del input */
.busqueda-resultados {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 380px;
    max-width: 480px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e8ecf0);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 200;
    max-height: 420px;
    overflow-y: auto;
    padding: 6px 0;
}

/* Fondo transparente que cubre la pantalla para cerrar el panel al hacer clic fuera */
.busqueda-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    background: transparent;
}

/* Sección dentro del panel (Alumnos / Campos Formativos / Actividades) */
.busqueda-seccion {
    padding: 4px 0;
}

.busqueda-seccion + .busqueda-seccion {
    border-top: 1px solid var(--border-color, #e8ecf0);
}

/* Encabezado de cada sección con ícono y nombre de categoría */
.busqueda-seccion-titulo {
    padding: 6px 16px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary, #6c757d);
}

/* Elemento individual de resultado — botón sin estilos nativos */
.busqueda-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 16px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-primary, #1e293b);
    font-size: 0.875rem;
    transition: background 0.1s;
}

.busqueda-item:hover {
    background: var(--content-bg, #f4f6f9);
}

/* Nombre del resultado en negrita */
.busqueda-item-nombre {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Subtítulo del resultado (grupo, materia) en gris más pequeño */
.busqueda-item-sub {
    font-size: 0.75rem;
    color: var(--text-secondary, #6c757d);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Mensaje cuando no hay resultados */
.busqueda-sin-resultados {
    padding: 16px;
    color: var(--text-secondary, #6c757d);
    font-size: 0.875rem;
    text-align: center;
    margin: 0;
}

/* El spinner no debe crecer ni encogerse dentro del flex */
.busqueda-spinner {
    flex-shrink: 0;
}
