/* ==========================================================
   Portal de Accesos SGC — sistema de diseño
   ========================================================== */

:root {
    --portal-primary: #4f46e5;
    --portal-primary-dark: #4338ca;
    --portal-primary-light: #eef2ff;
    --portal-ink: #1e1b2e;
    --portal-muted: #6b7280;
    --portal-bg: #f6f7fb;
    --portal-border: #e7e8f2;
    --portal-radius: 14px;
    --portal-radius-sm: 10px;
    --portal-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 12px rgba(16, 24, 40, .06);
    --portal-shadow-lg: 0 12px 32px rgba(79, 70, 229, .14);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--portal-bg) !important;
    color: var(--portal-ink);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 650;
    letter-spacing: -.01em;
}

/* --- Navbar --- */
.navbar.portal-nav {
    background: #fff !important;
    border-bottom: 1px solid var(--portal-border);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
    padding-top: .65rem;
    padding-bottom: .65rem;
}
.navbar.portal-nav .navbar-brand {
    color: var(--portal-ink) !important;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .55rem;
}
.navbar.portal-nav .brand-badge {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--portal-primary), #7c3aed);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.05rem;
    flex: none;
}
.navbar.portal-nav .nav-link {
    color: var(--portal-muted) !important;
    font-weight: 500;
    border-radius: 8px;
    padding: .45rem .75rem !important;
    transition: background .15s ease, color .15s ease;
}
.navbar.portal-nav .nav-link:hover,
.navbar.portal-nav .nav-link.active {
    color: var(--portal-primary) !important;
    background: var(--portal-primary-light);
}
.navbar.portal-nav .nav-link i { margin-right: .35rem; }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--portal-primary-light);
    color: var(--portal-primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
}

/* --- Cards --- */
.card {
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--portal-border);
    font-weight: 600;
}

/* --- Buttons --- */
.btn { border-radius: var(--portal-radius-sm); font-weight: 550; }
.btn-primary {
    background: var(--portal-primary);
    border-color: var(--portal-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--portal-primary-dark);
    border-color: var(--portal-primary-dark);
}
.btn-outline-primary {
    color: var(--portal-primary);
    border-color: var(--portal-primary);
}
.btn-outline-primary:hover {
    background: var(--portal-primary);
    border-color: var(--portal-primary);
}
.btn-outline-secondary { border-color: var(--portal-border); color: var(--portal-muted); }

/* --- Forms --- */
.form-control, .form-select {
    border-radius: var(--portal-radius-sm);
    border-color: var(--portal-border);
    padding-top: .55rem;
    padding-bottom: .55rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15);
}
.form-label { font-weight: 550; font-size: .9rem; color: var(--portal-ink); }

/* --- Tables --- */
.table {
    --bs-table-bg: transparent;
}
.table thead th {
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .04em;
    color: var(--portal-muted);
    border-bottom-width: 1px;
    background: #fafaff;
}
.table > :not(caption) > * > * { border-bottom-color: var(--portal-border); }
.table-hover > tbody > tr:hover > * { background-color: var(--portal-primary-light); }

/* --- Badges & alerts --- */
.badge.bg-light { background: #f1f1f8 !important; color: var(--portal-muted); }
.alert { border-radius: var(--portal-radius-sm); border: none; }
.alert-success { background: #ecfdf3; color: #067647; }
.alert-danger  { background: #fef3f2; color: #b42318; }
.alert-warning { background: #fffaeb; color: #b54708; }
.alert-info    { background: var(--portal-primary-light); color: var(--portal-primary-dark); }

/* --- Auth pages (login / recuperar / cambiar password) --- */
.auth-wrapper {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-card {
    border: 1px solid var(--portal-border);
    border-radius: 20px;
    box-shadow: var(--portal-shadow-lg);
    overflow: hidden;
}
.auth-card .auth-badge {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--portal-primary), #7c3aed);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 1rem;
}

/* --- Dashboard: tarjetas de sistemas --- */
.system-card {
    border-radius: var(--portal-radius);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.system-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--portal-shadow-lg) !important;
    border-color: var(--portal-primary);
}
.system-icon-badge {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

/* --- Sala de Computación: grilla semanal --- */
.schedule-wrap  { overflow-x: auto; }
.schedule-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12px; }
.schedule-table th {
    background: var(--portal-primary);
    color: #fff;
    padding: 8px 4px;
    text-align: center;
    font-weight: 600;
}
.schedule-table td { border: 1px solid var(--portal-border); padding: 4px; vertical-align: top; }
.time-label { font-size: 11px; color: var(--portal-muted); text-align: center; white-space: nowrap; }

.sched-cell {
    border-radius: var(--portal-radius-sm);
    padding: 8px 6px;
    min-height: 52px;
    cursor: pointer;
    transition: transform .12s ease;
    text-align: center;
}
.sched-cell:hover { transform: scale(1.03); }
.sala-solo-lectura .sched-cell:hover { transform: none; }
.sched-cell.empty      { background: #fff; border: 1px dashed var(--portal-border); color: var(--portal-muted); }
.sched-cell.empty.mi-clase { background: #eafbf0; border: 1px dashed #86e0a8; color: #15803d; }
.sched-cell.empty.mi-clase:hover { background: #d9f7e4; }
.sched-cell.pendiente  { background: #fff8e6; border-left: 3px solid #f59e0b; cursor: pointer; }
.sched-cell.aprobada   { background: var(--portal-primary-light); border-left: 3px solid var(--portal-primary); cursor: pointer; }
.sched-cell.evento     { background: #f3ecfd; border-left: 3px solid #8b5cf6; color: #5b21b6; cursor: default; }
.sala-solo-lectura .sched-cell { cursor: default !important; }
.sched-cell.pasada     { background: #f4f4f6; color: var(--portal-muted); cursor: not-allowed; opacity: .55; }
.sched-cell.feriado    { background: repeating-linear-gradient(45deg, #fef2f2, #fef2f2 6px, #fde2e2 6px, #fde2e2 12px); color: #991b1b; cursor: not-allowed; text-align: center; font-size: 11px; font-weight: 600; }
.sched-cell.clase      { background: var(--portal-primary-light); border-left: 3px solid var(--portal-primary-dark); }
.sched-cell.descanso   { background: #fafaff; color: var(--portal-muted); text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .04em; cursor: default; }

/* --- Vista compacta: grilla "Mi horario" del dashboard --- */
.horario-compacto .schedule-table { font-size: 11px; }
.horario-compacto .schedule-table th { padding: 5px 3px; font-size: 11px; }
.horario-compacto .schedule-table td { padding: 2px; }
.horario-compacto .time-label { font-size: 10px; }
.horario-compacto .sched-cell { padding: 4px; min-height: 30px; }
.horario-compacto .sched-cell .sched-curso { display: block; font-size: 10px; color: var(--portal-muted); }
.horario-compacto .sched-cell strong { font-size: 11px; }
.horario-compacto .sched-break { padding: 2px; font-size: 10px; }

.entrada-salida-dia {
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-sm);
    padding: 6px 8px;
    text-align: center;
}
.entrada-salida-hoy { border-color: #f5c453; background: #fffdf6; }

.sched-break {
    text-align: center;
    background: #fafaff;
    color: var(--portal-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
}

.month-cell {
    min-height: 120px;
    border-radius: var(--portal-radius-sm);
    padding: 6px;
    border: 1px solid var(--portal-border);
}
.month-cell.fuera-de-mes { background: #fafafa; color: var(--portal-muted); }
.month-cell.hoy { border-color: var(--portal-primary); box-shadow: 0 0 0 1px var(--portal-primary); }
.month-cell-feriado { background: repeating-linear-gradient(45deg, #fef2f2, #fef2f2 6px, #fde2e2 6px, #fde2e2 12px); border-color: #f3b4b4; }
.month-cell a { text-decoration: none; }

.month-day-list {
    max-height: 100px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
}
.month-day-item {
    font-size: 10px;
    line-height: 1.3;
    padding: 1px 4px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.month-day-item.pendiente { background: #fff8e6; color: #92400e; }
.month-day-item.aprobada  { background: var(--portal-primary-light); color: var(--portal-primary-dark); }
.month-day-item.evento    { background: #f3ecfd; color: #5b21b6; }
.month-day-item.feriado   { background: #fde2e2; color: #991b1b; font-weight: 600; }

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
}
.legend-dot.empty { background: #fff; border: 1px dashed var(--portal-border); }
.legend-dot.empty.mi-clase { background: #eafbf0; border: 1px dashed #86e0a8; }
.legend-dot.pendiente { background: #fff8e6; border-left: 3px solid #f59e0b; }
.legend-dot.aprobada { background: var(--portal-primary-light); border-left: 3px solid var(--portal-primary); }
.legend-dot.evento { background: #f3ecfd; border-left: 3px solid #8b5cf6; }
.legend-dot.feriado { background: repeating-linear-gradient(45deg, #fef2f2, #fef2f2 3px, #fde2e2 3px, #fde2e2 6px); border: 1px solid #f3b4b4; }

.ranking-bar-track {
    height: 10px;
    border-radius: 5px;
    background: var(--portal-bg);
    overflow: hidden;
}
.ranking-bar-fill {
    height: 100%;
    border-radius: 5px;
    min-width: 4px;
}
.ranking-bar-profesores { background: var(--portal-primary); }
.ranking-bar-asignaturas { background: #1baf7a; }

/* --- Dashboard: actividades del día / de la semana --- */
.card-destacada-hoy { border: 1px solid #f5c453; box-shadow: 0 1px 2px rgba(245, 158, 11, .08), 0 4px 14px rgba(245, 158, 11, .12); }
.card-header-hoy {
    background: #fff8e6;
    color: #92400e;
    border-bottom: 1px solid #f5c453;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.actividad-apoderados { border-left: 3px solid #4a3aa7; }
.actividad-salacomp    { border-left: 3px solid #1baf7a; }

.semana-dia {
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-sm);
    padding: 10px 12px;
    height: 100%;
}
.semana-dia-hoy { border-color: #f5c453; background: #fffdf6; }
.semana-dia-titulo { font-weight: 600; margin-bottom: 6px; }

/* --- Dashboard: mis solicitudes de Soporte TI --- */
.card-destacada-soporteti { border: 1px solid #67c3d6; box-shadow: 0 1px 2px rgba(8, 145, 178, .08), 0 4px 14px rgba(8, 145, 178, .12); }
.card-header-soporteti {
    background: #e6f7fa;
    color: #0891b2;
    border-bottom: 1px solid #67c3d6;
}
.card-header-soporteti .btn-outline-light { color: #0891b2; border-color: #0891b2; }
.card-header-soporteti .btn-outline-light:hover { background: #0891b2; color: #fff; }

.card-header[data-bs-toggle="collapse"] .bi-chevron-down { transition: transform .15s ease; }
.card-header[data-bs-toggle="collapse"][aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }

/* --- Impresión: oculta navegación/acciones, deja solo el contenido (grillas, calendarios, informes) --- */
@media print {
    .portal-nav, .btn, .btn-group, .modal, .no-print { display: none !important; }
    body { padding: 0 !important; background: #fff !important; }
    main.container { max-width: 100% !important; padding: 0 !important; }
    .schedule-wrap { overflow: visible !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* --- Panel TI (administrador general): tarjetas resumen --- */
.stat-card .card-body { display: flex; align-items: center; gap: .9rem; padding: 1.1rem 1.25rem; }
.stat-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex: none;
    background: var(--portal-primary-light);
    color: var(--portal-primary);
}
.stat-card-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; color: var(--portal-ink); }
.stat-card-label { font-size: .8rem; color: var(--portal-muted); font-weight: 500; }
.stat-card-warning .stat-card-icon { background: #fff8e6; color: #92400e; }
.stat-card-warning .stat-card-value { color: #92400e; }
.stat-card-danger .stat-card-icon { background: #fde8e8; color: #b91c1c; }
.stat-card-danger .stat-card-value { color: #b91c1c; }
.stat-card-info .stat-card-icon { background: #e6f7fa; color: #0891b2; }

.barra-conteo { height: 8px; border-radius: 4px; background: var(--portal-bg); overflow: hidden; }
.barra-conteo > span { display: block; height: 100%; background: var(--portal-primary); border-radius: 4px; }

/* --- Banner de consentimiento de cookies (ley de privacidad de datos) --- */
/* Bloqueo estricto: cubre la pantalla completa. El bloqueo real es de
   servidor (todo POST se rechaza sin consentimiento); esto es la parte visible. */
.cookie-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .6);
    z-index: 1080;
}
.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1081;
    padding: 1rem;
    display: flex;
    justify-content: center;
}
.cookie-banner .card {
    width: 100%;
    max-width: 720px;
    border: none;
    border-radius: 12px;
}
.politica-contenido h2 { font-size: 1.25rem; margin-top: 1.75rem; }
.politica-contenido h3 { font-size: 1.1rem; margin-top: 1.5rem; }
.politica-contenido table { width: 100%; margin: 1rem 0; }
.politica-contenido th, .politica-contenido td { border: 1px solid var(--portal-border, #dee2e6); padding: .5rem .75rem; }
