/* =====================================================================
   Sistema Escolar - IEST Antenor Orrego
   Sistema de diseño: sidebar + tarjetas claras (estilo panel SaaS),
   acento morado/índigo.
   ===================================================================== */

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

:root {
    --morado: #6C5CE7;
    --morado-2: #7B61FF;
    --azul: #4FA9F0;
    --verde: #5CE5C0;
    --texto: #1D1533;
    --texto-suave: #6B6480;
    --exito: #2FB380;
    --peligro: #E6435A;
    --advertencia: #E6A23C;

    --bg-pagina: #EFEDFB;
    --superficie: #FFFFFF;
    --borde: #ECEAF9;
    --sombra-card: 0 4px 24px rgba(30, 20, 60, .06);
    --sidebar-ancho: 240px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    color: var(--texto);
    background: var(--bg-pagina);
}

/* ---------- Tarjetas ("glass" ahora es una tarjeta blanca de verdad) ---------- */

.glass {
    background: var(--superficie);
    border: 1px solid var(--borde);
    box-shadow: var(--sombra-card);
    border-radius: 20px;
}

/* ---------- Layout de la app: sidebar + contenido ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
    align-items: flex-start;
}

.sidebar {
    width: var(--sidebar-ancho);
    flex-shrink: 0;
    background: var(--superficie);
    min-height: 100vh;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    border-right: 1px solid var(--borde);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 24px;
    font-weight: 800;
    font-size: 15px;
    line-height: 1.2;
}

.sidebar-logo .icono {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--morado), var(--morado-2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    color: var(--texto-suave);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background .15s ease, color .15s ease;
}

.sidebar-nav a .emoji {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-nav a:hover {
    background: rgba(108, 92, 231, .08);
    color: var(--texto);
}

.sidebar-nav a.activo {
    background: rgba(108, 92, 231, .12);
    color: var(--morado);
    font-weight: 700;
}

.sidebar-separador {
    margin: 14px 12px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--texto-suave);
    opacity: .7;
}

.sidebar-footer {
    border-top: 1px solid var(--borde);
    padding-top: 12px;
    margin-top: 12px;
}

.app-main {
    flex: 1;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    background: var(--bg-pagina);
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
}

.topbar-usuario {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--morado), var(--azul));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.contenido-app {
    padding: 0 32px 48px;
}

/* ---------- Layout genérico (login y páginas fuera de la app) ---------- */

.pagina-centrada {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.contenedor {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 0;
}

/* ---------- Tipografía ---------- */

h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
p { margin: 0 0 12px; color: var(--texto-suave); }

.puntos-pixel {
    font-family: 'Press Start 2P', monospace;
    letter-spacing: 1px;
}

/* ---------- Formularios ---------- */

.campo { margin-bottom: 18px; }

.campo label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--texto);
}

.campo input[type="text"],
.campo input[type="email"],
.campo input[type="password"],
.campo input[type="number"],
.campo input[type="date"],
.campo input[type="datetime-local"],
.campo select,
.campo textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--texto);
    background: #F7F6FD;
    border: 1px solid var(--borde);
    border-radius: 12px;
    outline: none;
    transition: box-shadow .15s ease, border-color .15s ease;
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
    border-color: var(--morado);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, .18);
}

/* ---------- Botones ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}

.btn:active { transform: scale(.97); }

.btn-primario {
    color: #fff;
    background: linear-gradient(135deg, var(--morado), var(--morado-2));
    box-shadow: 0 6px 16px rgba(108, 92, 231, .35);
}

.btn-primario:hover { box-shadow: 0 8px 20px rgba(108, 92, 231, .45); }

.btn-secundario {
    color: var(--texto);
    background: #F1F0FA;
    border: 1px solid var(--borde);
}

.btn-secundario:hover { background: #E9E7F8; }

.btn-peligro {
    color: #fff;
    background: linear-gradient(135deg, #E6435A, #C22C42);
}

.btn-ancho { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Segmented control ---------- */

.segmentado {
    display: inline-flex;
    padding: 4px;
    gap: 4px;
    background: #F1F0FA;
    border: 1px solid var(--borde);
    border-radius: 999px;
}

.segmentado button {
    border: none;
    background: transparent;
    padding: 8px 20px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--texto-suave);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.segmentado button.activo {
    background: #fff;
    color: var(--morado);
    box-shadow: 0 4px 12px rgba(30, 20, 60, .12);
}

/* ---------- Alertas ---------- */

.alerta {
    padding: 12px 18px;
    border-radius: 14px;
    font-size: 14px;
    margin-bottom: 18px;
}

.alerta-error {
    background: rgba(230, 67, 90, .1);
    color: #A32240;
    border: 1px solid rgba(230, 67, 90, .25);
}

.alerta-exito {
    background: rgba(47, 179, 128, .1);
    color: #1B7A54;
    border: 1px solid rgba(47, 179, 128, .25);
}

/* ---------- Utilidades ---------- */

.texto-centro { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ---------- Responsive: sidebar se apila arriba en pantallas chicas ---------- */

@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .sidebar {
        width: 100%;
        min-height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--borde);
    }
    .sidebar-logo { padding: 4px 8px; }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar-footer { border-top: none; margin: 0; padding: 0; }
    .topbar { padding: 16px 20px; }
    .contenido-app { padding: 0 20px 32px; }
}
