/* ============================================================
   estilos.css — Sistema de diseño "Red Sanjuanista 2.0"
   Plataforma de Exalumnos - Colegio Nacional San Juan

   Solo cambia la apariencia: se conservan todos los nombres de
   clases usados por las páginas, así que ninguna funcionalidad
   se ve afectada.

   Roles de color:
     rojo   -> acciones (botones principales, activo)
     dorado -> promoción y logros
     verde  -> comunidad / confirmaciones
     tinta  -> texto y tarjetas destacadas
   ============================================================ */

/* Las fuentes se cargan con <link> en cada página (más rápido que @import en celulares). */

:root {
    /* Colores institucionales (mismos nombres que la versión anterior) */
    --rojo: #C24B3B;
    --rojo-oscuro: #A13A2B;
    --dorado: #E8B923;
    --dorado-suave: #FBF0CF;
    --verde: #1F6B3A;
    --azul: #241F1A;          /* "tinta": títulos y superficies oscuras */
    --azul-claro: #A3781A;    /* dorado oscuro: foco de formularios */
    --crema: #FBF8F1;         /* "papel": fondo general */
    --texto: #1E1A15;
    --texto-suave: #5E574C;
    --borde: #E4DAC2;
    --sombra: 0 1px 2px rgba(36, 31, 26, 0.04), 0 4px 14px rgba(36, 31, 26, 0.05);
    --sombra-fuerte: 0 2px 4px rgba(36, 31, 26, 0.06), 0 10px 28px rgba(36, 31, 26, 0.10);
    --radio: 14px;
    --oscuro-footer: #241F1A;

    /* Nuevos */
    --superficie: #FFFFFF;
    --superficie-2: #F4EEDF;
    --tinte-rojo: #F8E6E2;
    --tinte-verde: #E1F0E6;
    --tinte-dorado: #FBF0CF;
    --fuente-titulos: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
    --fuente-texto: "Figtree", "Segoe UI", system-ui, Arial, sans-serif;
    --fuente-datos: "IBM Plex Mono", ui-monospace, Consolas, monospace;
    --alto-barra-inferior: 66px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--crema);
    color: var(--texto);
    font-family: var(--fuente-texto);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--rojo-oscuro); }

h1, h2, h3 { font-family: var(--fuente-titulos); letter-spacing: -0.015em; text-wrap: balance; }

:focus-visible { outline: 3px solid rgba(232, 185, 35, 0.6); outline-offset: 2px; }

/* ------------------------------------------------------------
   Encabezado
   ------------------------------------------------------------ */
.cabecera-franja {
    height: 5px;
    background: linear-gradient(90deg, var(--rojo) 0 33.3%, var(--dorado) 33.3% 66.6%, var(--verde) 66.6% 100%);
    flex-shrink: 0;
}

.cabecera-app {
    /* Sin backdrop-filter: crearía un contenedor para la barra fija inferior del móvil */
    background: #FFFFFF;
    border-bottom: 1px solid var(--borde);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.cabecera-contenido {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px 20px;
}

.cabecera-marca {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: auto;
}

.cabecera-logo {
    width: 42px;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.cabecera-textos { line-height: 1.2; white-space: nowrap; }
.cabecera-titulo {
    display: block;
    font-family: var(--fuente-titulos);
    font-weight: 800;
    color: var(--texto);
    font-size: 17px;
    letter-spacing: -0.02em;
}
.cabecera-titulo-rojo { color: var(--rojo); }
.cabecera-subtitulo { display: block; font-size: 11.5px; color: var(--texto-suave); line-height: 1.3; margin-top: 2px; }

/* Acciones de la derecha (sitio principal, panel, salir) */
.cabecera-acciones { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.enlace-sitio-principal,
.btn-cabecera,
.btn-salir {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 10px;
    white-space: nowrap;
    border: 1px solid var(--borde);
    background: var(--superficie);
    color: var(--texto-suave);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.enlace-sitio-principal svg, .btn-cabecera svg, .btn-salir svg { width: 16px; height: 16px; flex-shrink: 0; }
.enlace-sitio-principal:hover, .btn-cabecera:hover { background: var(--superficie-2); color: var(--texto); }
.btn-cabecera.activo { background: var(--azul); color: #fff; border-color: var(--azul); }
.btn-salir { color: var(--rojo-oscuro); border-color: #EFD2CB; }
.btn-salir:hover { background: var(--tinte-rojo); }

/* Navegación principal con texto
   - Escritorio/tablet: pestañas en la cabecera
   - Móvil: barra fija abajo, al alcance del pulgar */
.nav-app {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--superficie-2);
    border-radius: 12px;
    padding: 4px;
}
.nav-app a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 9px;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--texto-suave);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-app a svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-app a:hover { color: var(--texto); }
.nav-app a.activo { background: var(--superficie); color: var(--rojo); box-shadow: 0 1px 4px rgba(36, 31, 26, 0.10); }

.badge-contador {
    background: var(--rojo);
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Acciones de la cabecera: solo ícono (el texto queda en el "title") salvo en pantallas muy anchas */
.enlace-sitio-principal .texto-boton, .btn-cabecera .texto-boton, .btn-salir .texto-salir { display: none; }
.enlace-sitio-principal, .btn-cabecera, .btn-salir { padding: 8px 9px; }
@media (min-width: 1600px) {
    .enlace-sitio-principal .texto-boton, .btn-cabecera .texto-boton, .btn-salir .texto-salir { display: inline; }
    .enlace-sitio-principal, .btn-cabecera, .btn-salir { padding: 8px 12px; }
}
@media (max-width: 1400px) {
    .cabecera-subtitulo { display: none; }
}
@media (max-width: 1080px) and (min-width: 901px) {
    .nav-app a svg { display: none; }
    .nav-app a { padding: 9px 11px; }
}

/* Tablet vertical y móvil: barra inferior */
@media (max-width: 900px) {
    .cabecera-contenido { padding: 8px 14px; }
    .cabecera-logo { width: 36px; }
    .cabecera-titulo { font-size: 16px; }
    .nav-app {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 120;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0;
        border-radius: 0;
        padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px));
        background: #FFFFFF;
        border-top: 1px solid var(--borde);
        box-shadow: 0 -4px 18px rgba(36, 31, 26, 0.06);
    }
    .nav-app a {
        flex-direction: column;
        gap: 3px;
        padding: 6px 2px;
        font-size: 11px;
        font-weight: 700;
        border-radius: 10px;
        justify-content: center;
    }
    .nav-app a svg { width: 22px; height: 22px; }
    .nav-app a.activo { background: transparent; box-shadow: none; color: var(--rojo); }
    .nav-app a.activo::before {
        content: "";
        position: absolute;
        top: -6px; left: 28%; right: 28%;
        height: 3px;
        border-radius: 0 0 3px 3px;
        background: var(--rojo);
    }
    .nav-app .badge-contador {
        position: absolute;
        top: 1px;
        left: calc(50% + 5px);
        border: 2px solid #fff;
        height: 20px;
        min-width: 20px;
    }

    /* Espacio para que la barra inferior no tape el contenido.
       Se usa la clase .con-nav del encabezado (funciona también en
       celulares con navegadores antiguos que no soportan :has). */
    .cabecera-app.con-nav ~ footer.pie-institucional {
        padding-bottom: calc(30px + var(--alto-barra-inferior) + env(safe-area-inset-bottom, 0px));
    }
    .cabecera-app.con-nav ~ main .barra-guardar,
    .cabecera-app.con-nav ~ .contenedor .barra-guardar {
        bottom: calc(var(--alto-barra-inferior) + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 380px) {
    .cabecera-titulo { font-size: 14.5px; }
}

/* ------------------------------------------------------------
   Contenedor principal
   ------------------------------------------------------------ */
.contenedor {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 22px 16px 44px;
    flex: 1;
}
@media (min-width: 700px) {
    .contenedor { max-width: 680px; padding-top: 32px; }
}
@media (min-width: 1024px) {
    .contenedor { max-width: 960px; padding-top: 40px; }
}

.contenedor-angosto { max-width: 440px; }
@media (min-width: 700px) {
    .contenedor-angosto { max-width: 470px; }
}

/* ------------------------------------------------------------
   Encabezados de página
   ------------------------------------------------------------ */
.titulo-pagina {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    gap: 10px;
    flex-wrap: wrap;
}
.titulo-pagina h1 {
    font-family: var(--fuente-titulos);
    font-size: clamp(26px, 5vw, 34px);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.08;
    margin: 0;
    color: var(--azul);
}
.titulo-pagina .enlace-volver {
    font-size: 14px;
    font-weight: 700;
    color: var(--texto-suave);
    text-decoration: none;
    padding: 7px 12px;
    border-radius: 10px;
    border: 1px solid var(--borde);
    background: var(--superficie);
}
.titulo-pagina .enlace-volver:hover { color: var(--rojo); border-color: #EFD2CB; }

/* Etiqueta pequeña tipo "eyebrow" */
.etiqueta-seccion {
    font-family: var(--fuente-datos);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rojo-oscuro);
}

/* ------------------------------------------------------------
   Tarjetas / paneles
   ------------------------------------------------------------ */
.panel {
    background: var(--superficie);
    border: 1px solid var(--borde);
    border-radius: 18px;
    box-shadow: var(--sombra);
    padding: 22px;
    margin-bottom: 16px;
}

.rejilla-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 700px) {
    .rejilla-2 { grid-template-columns: 1fr 1fr; gap: 14px; }
}

/* ------------------------------------------------------------
   Formularios
   ------------------------------------------------------------ */
fieldset {
    border: 1px solid var(--borde);
    border-radius: 18px;
    margin-bottom: 18px;
    padding: 18px;
    background: var(--superficie);
    box-shadow: var(--sombra);
}
legend { font-family: var(--fuente-titulos); font-weight: 700; font-size: 16px; padding: 0 8px; color: var(--azul); }

label { display: block; margin-top: 16px; font-size: 14.5px; color: var(--texto); font-weight: 700; }

input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number],
input[type=url], input[type=date], input[type=search],
input[type=file], select, textarea {
    width: 100%;
    padding: 13px 14px;
    margin-top: 7px;
    border: 1.5px solid var(--borde);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    background: var(--superficie);
    color: var(--texto);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: #9A9181; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--dorado);
    box-shadow: 0 0 0 4px rgba(232, 185, 35, 0.22);
}
input[disabled] { background: var(--superficie-2); color: #8A8274; }
input[type=file] { padding: 10px; background: var(--crema); border-style: dashed; }
input[type=checkbox], input[type=radio] { accent-color: var(--rojo); width: 18px; height: 18px; }

.fila-dinamica { display: flex; gap: 8px; margin-top: 6px; }
.fila-dinamica input { flex: 1; }

/* ------------------------------------------------------------
   Acordeón (secciones de formulario tipo "pasos")
   ------------------------------------------------------------ */
.acordeon {
    border: 1px solid var(--borde);
    border-radius: 18px;
    background: var(--superficie);
    box-shadow: var(--sombra);
    margin-bottom: 14px;
    overflow: hidden;
}
.acordeon > summary {
    list-style: none;
    cursor: pointer;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--fuente-titulos);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
    color: var(--azul);
    background: var(--superficie);
    transition: background 0.15s ease;
}
.acordeon > summary::-webkit-details-marker { display: none; }
.acordeon > summary:hover { background: var(--crema); }
.acordeon[open] > summary { border-bottom: 1px solid var(--borde); }

.acordeon-numero {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--azul); color: var(--dorado);
    font-family: var(--fuente-titulos);
    font-size: 14px; font-weight: 800; margin-right: 12px; flex-shrink: 0;
}
.acordeon-titulo { display: flex; align-items: center; flex: 1; }
.acordeon-chevron {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--superficie-2);
    transition: transform 0.2s ease; color: var(--texto-suave); font-size: 14px;
}
.acordeon[open] .acordeon-chevron { transform: rotate(180deg); }

.acordeon-cuerpo { padding: 18px 18px 24px; }
.acordeon-cuerpo fieldset { border: none; box-shadow: none; padding: 0; margin: 0; background: transparent; }
.acordeon-cuerpo legend { display: none; }
.acordeon-cuerpo > label:first-child { margin-top: 0; }

.fila-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* ------------------------------------------------------------
   Botones
   Las reglas base usan :where() (especificidad 0) para que los
   estilos propios de cada página sigan mandando.
   ------------------------------------------------------------ */
:where(.btn, button, input[type=submit]) {
    display: inline-block;
    padding: 14px 18px;
    border: 1.5px solid var(--borde);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    background: var(--superficie);
    color: var(--texto);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease;
}
:where(.btn, button):active { transform: scale(0.985); }

/* Botón principal: rojo institucional */
.btn-primario,
button[type=submit].espaciador,
button[type=submit]:not([class]),
input[type=submit] {
    width: 100%;
    background: var(--rojo);
    border-color: var(--rojo);
    color: #fff;
    box-shadow: 0 2px 0 var(--rojo-oscuro);
}
.btn-primario:hover,
button[type=submit].espaciador:hover,
button[type=submit]:not([class]):hover,
input[type=submit]:hover { background: var(--rojo-oscuro); border-color: var(--rojo-oscuro); color: #fff; }

.btn-secundario {
    background: var(--superficie);
    color: var(--azul);
    border: 1.5px solid var(--azul);
}
.btn-secundario:hover { background: var(--superficie-2); }

.btn-terciario, .btn-chico {
    background: var(--superficie-2);
    color: var(--texto);
    border: 1px solid var(--borde);
    font-size: 14px;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 10px;
}
.btn-terciario:hover { background: #ECE3CD; }

.btn-bloque { display: block; width: 100%; }

/* Guardar perfil: mismo estilo que el botón principal */
body button.btn-guardar-perfil {
    background: var(--rojo);
    border-color: var(--rojo);
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 0 var(--rojo-oscuro);
}
body button.btn-guardar-perfil:hover { background: var(--rojo-oscuro); border-color: var(--rojo-oscuro); color: #fff; }

/* ------------------------------------------------------------
   Mensajes de estado
   ------------------------------------------------------------ */
.alerta {
    padding: 14px 16px 14px 44px;
    border-radius: 14px;
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.55;
    position: relative;
}
.alerta::before {
    position: absolute; left: 14px; top: 13px;
    width: 20px; height: 20px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 800; color: #fff;
}
.alerta-error { background: var(--tinte-rojo); color: #8f1d1d; border: 1px solid #F0CFC8; }
.alerta-error::before { content: "!"; background: var(--rojo); }
.alerta-exito { background: var(--tinte-verde); color: #16603a; border: 1px solid #C3E3CD; }
.alerta-exito::before { content: "✓"; background: var(--verde); }

/* ------------------------------------------------------------
   Avatares
   ------------------------------------------------------------ */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--fuente-titulos);
    font-weight: 800;
    color: var(--dorado);
    background: var(--azul);
}
.avatar-chico { width: 42px; height: 42px; font-size: 15px; }
.avatar-mediano { width: 56px; height: 56px; font-size: 19px; }
.avatar-grande { width: 80px; height: 80px; font-size: 26px; }

/* ------------------------------------------------------------
   Pie de página
   ------------------------------------------------------------ */
footer.pie-institucional {
    text-align: center;
    font-size: 13px;
    color: #CFC6B4;
    padding: 26px 16px 30px;
    flex-shrink: 0;
    line-height: 1.7;
    background: var(--oscuro-footer);
    margin-top: auto;
    border-top: 5px solid transparent;
    border-image: linear-gradient(90deg, var(--rojo) 0 33.3%, var(--dorado) 33.3% 66.6%, var(--verde) 66.6% 100%) 1;
}
.pie-desarrollador {
    display: block;
    font-size: 12px;
    color: #968B7B;
    margin-top: 4px;
}
.pie-desarrollador a { color: var(--dorado); text-decoration: none; font-weight: 700; }
.pie-desarrollador a:hover { color: #fff; }

/* ------------------------------------------------------------
   Utilidades
   ------------------------------------------------------------ */
.texto-centrado { text-align: center; }
.texto-suave { color: var(--texto-suave); font-size: 14.5px; }
.espaciador-chico { margin-top: 10px; }
.espaciador { margin-top: 22px; }

/* ------------------------------------------------------------
   Llamado a la acción (invitación a registrarse)
   ------------------------------------------------------------ */
.cta-registro {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    background: var(--azul);
    border-radius: 18px;
    padding: 18px 20px; margin-top: 18px;
    position: relative; overflow: hidden;
}
.cta-registro::after {
    content: "1854";
    position: absolute; right: -6px; bottom: -22px;
    font-family: var(--fuente-titulos); font-weight: 800; font-size: 76px;
    color: rgba(255, 255, 255, 0.06); letter-spacing: -0.05em; pointer-events: none;
}
.cta-registro-texto { font-size: 14.5px; color: #CFC6B4; line-height: 1.45; position: relative; z-index: 1; }
.cta-registro-texto strong { display: block; color: #fff; font-family: var(--fuente-titulos); font-size: 17px; margin-bottom: 3px; }
.cta-registro-boton {
    display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
    background: var(--dorado); color: var(--azul); font-size: 14.5px; font-weight: 800;
    padding: 11px 18px; border-radius: 12px; text-decoration: none; border: none;
    white-space: nowrap; position: relative; z-index: 1;
    transition: background 0.15s ease, transform 0.12s ease;
}
.cta-registro-boton:hover { background: #F2C94A; transform: translateY(-1px); }
.cta-registro-boton svg { width: 17px; height: 17px; }

@media (max-width: 420px) {
    .cta-registro { flex-direction: column; align-items: stretch; text-align: center; }
    .cta-registro-boton { justify-content: center; }
}

/* ------------------------------------------------------------
   Navegación secundaria ("Volver")
   ------------------------------------------------------------ */
.enlace-volver-central {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 22px; font-size: 14.5px; font-weight: 700; color: var(--texto-suave);
    text-decoration: none; transition: color 0.15s ease;
}
.enlace-volver-central:hover { color: var(--rojo); }
.enlace-volver-central svg { width: 17px; height: 17px; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* Botones de solo ícono (gestión de usuarios): sin relleno para que el ícono quede centrado */
button.btn-icono-usuario { padding: 0; }
