/* ═══════════════════════════════════════════════════
   login.css — Estilos Login AESPA
   Orden: Variables → Reset → Body → Animaciones →
          Logo/Títulos → Formulario → Campos →
          Botones → Mensajes → Cámara → Resultados
═══════════════════════════════════════════════════ */

/* ─── VARIABLES ─────────────────────────────────── */
:root {
    --fondo-oscuro:   #0f2027;
    --fondo-medio:    #203a43;
    --fondo-claro:    #2c5364;
    --destacado:      #17b4ff;
    --exito:          #10B981;
    --error:          #EF4444;
    --secundario:     #334155;
}

/* ─── RESET ──────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ─── BODY ───────────────────────────────────────── */
body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--fondo-oscuro), var(--fondo-medio), var(--fondo-claro));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: white;
    /* evita zoom accidental en móvil */
    -webkit-text-size-adjust: 100%;
}

/* ─── ANIMACIONES ────────────────────────────────── */
@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.7); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes bounceIn {
    0%   { opacity: 0; transform: scale(0.3); }
    50%  { opacity: 1; transform: scale(1.08); }
    70%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-8px); }
    75%       { transform: translateX(8px); }
}
@keyframes sacudir {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-10px); }
    40%       { transform: translateX(10px); }
    60%       { transform: translateX(-10px); }
    80%       { transform: translateX(10px); }
}
@keyframes girar {
    to { transform: rotate(360deg); }
}

/* Clases de animación */
.animar-zoom      { animation: zoomIn     0.8s ease-out; }
.animar-aparecer  { animation: fadeInDown 1.2s ease-out; }
.animar-subtitulo { animation: fadeInDown 1.2s ease-out 0.4s both; }
.animar-subir     { animation: fadeInUp   1s  ease-out 1.2s both; }
.animar-bounce    { animation: bounceIn   0.8s ease-out; }
.animar-shake     { animation: shake      0.6s ease-out; }
.animar-sacudir   { animation: sacudir    0.5s ease-out; }

/* ─── PANTALLAS ──────────────────────────────────── */
.pantalla        { display: none; width: 100%; max-width: 420px; flex-direction: column; align-items: center; }
.pantalla.activa { display: flex; }

/* ─── LOGO ───────────────────────────────────────── */
.logo-imagen {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 16px;
}

/* ─── TÍTULOS ────────────────────────────────────── */
.titulo-aespa {
    font-size: 3.5rem;
    font-weight: 700;
    text-shadow:
        0 0 5px  var(--destacado),
        0 0 10px var(--destacado),
        0 0 20px var(--destacado);
    line-height: 1;
    margin-bottom: 8px;
}

.subtitulo-app {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    max-width: 80%;
    margin-bottom: 36px;
}

/* ─── FORMULARIO CONTENEDOR ──────────────────────── */
.formulario-contenedor { width: 100%; }

/* ─── CAMPOS INPUT ───────────────────────────────── */
.campo-input {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 0 20px;
    margin-bottom: 20px;
    height: 52px;
    transition: all 0.3s ease;
}
.campo-input:focus-within {
    border-color: var(--destacado);
    background: rgba(23, 180, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(23, 180, 255, 0.2);
}
.campo-input.error-campo {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.icono-campo {
    width: 22px;
    height: 22px;
    color: rgba(255, 255, 255, 0.5);
    margin-right: 10px;
    flex-shrink: 0;
    transition: color 0.3s;
}
.campo-input:focus-within .icono-campo { color: var(--destacado); }

.campo-input input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    min-width: 0;
    /* evita zoom en iOS */
    font-size: 16px;
}
.campo-input input::placeholder { color: rgba(255, 255, 255, 0.5); }

/* ─── BOTÓN OJO ──────────────────────────────────── */
.boton-ojo {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.boton-ojo:hover { color: rgba(255, 255, 255, 0.9); }
.boton-ojo svg   { width: 20px; height: 20px; display: block; }

/* ─── BOTÓN ENTRAR ───────────────────────────────── */
.boton-entrar {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(to right, var(--destacado), #4a00e0);
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(23, 180, 255, 0.3);
    -webkit-tap-highlight-color: transparent;
}
.boton-entrar:hover    { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(23, 180, 255, 0.5); }
.boton-entrar:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ─── SPINNER ────────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: girar 0.8s linear infinite;
    display: none;
    flex-shrink: 0;
}
.spinner-grande {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(23, 180, 255, 0.3);
    border-top-color: var(--destacado);
    border-radius: 50%;
    animation: girar 0.9s linear infinite;
    margin-top: 10px;
}
.spinner-overlay {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(23, 180, 255, 0.3);
    border-top-color: var(--destacado);
    border-radius: 50%;
    animation: girar 0.9s linear infinite;
}

/* ─── TEXTO "¿NO TIENES CUENTA?" ─────────────────── */
.texto-cuenta  { color: rgba(255, 255, 255, 0.7); font-size: 0.875rem; text-align: center; }
.enlace-cuenta { color: var(--destacado); font-weight: 600; text-decoration: none; }
.enlace-cuenta:hover { text-decoration: underline; }

/* ─── VERSIÓN ────────────────────────────────────── */
.texto-version {
    margin-top: 30px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.75rem;
    text-align: center;
}

/* ─── CAJA MENSAJE ERROR ─────────────────────────── */
.caja-mensaje {
    width: 100%;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 0.875rem;
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    animation: fadeInUp 0.3s ease-out;
}
.caja-mensaje.visible { display: flex; }
.caja-mensaje svg     { width: 20px; height: 20px; flex-shrink: 0; }
.caja-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error);
    color: #FCA5A5;
}

/* ─── CÁMARA — títulos ───────────────────────────── */
.camara-titulo {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
}
.camara-subtitulo {
    font-size: 0.875rem;
    color: #94A3B8;
    text-align: center;
    margin-bottom: 28px;
    padding: 0 12px;
}

/* ─── CÁMARA — contenedor ────────────────────────── */
.camara-contenedor {
    position: relative;
    width: min(280px, calc(100vw - 2rem));
    aspect-ratio: 7 / 9;
    border-radius: 20px;
    overflow: hidden;
    background: #1E293B;
}

#video-camara {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* espejo frontal */
}

/* ─── CÁMARA — guía óvalo ────────────────────────── */
.guia-ovalo {
    position: absolute;
    top: 100%; left: 69%;
    width: 76%; height: 89%;
    border-radius:100%;
    border: 2px dashed var(--destacado);
    pointer-events: none;
    transition: all 0.4s ease;
}
.guia-ovalo.activo {
    border: 3px solid #FCD34D;
    border-style: solid;
}

/* ─── CÁMARA — overlay verificando ──────────────── */
.overlay-verificando {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}
.overlay-verificando.visible { display: flex; }
.overlay-verificando p       { color: white; font-size: 0.95rem; }

/* ─── CÁMARA — sin acceso ────────────────────────── */
.sin-camara {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 10px;
    color: #64748B;
}
.sin-camara.visible { display: flex; }
.sin-camara svg     { width: 50px; height: 50px; }
.sin-camara p       { font-size: 0.8rem; }

/* ─── BOTONES DE ACCIÓN (cámara / resultado) ─────── */
.fila-botones {
    display: flex;
    gap: 14px;
    margin-top: 28px;
    flex-wrap: wrap;
    justify-content: center;
}

.boton-principal {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--destacado);
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    padding: 13px 24px;
    cursor: pointer;
    min-height: 48px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.boton-principal:hover { filter: brightness(1.15); transform: translateY(-1px); }

.boton-secundario {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--secundario);
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    padding: 13px 24px;
    cursor: pointer;
    min-height: 48px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.boton-secundario:hover { filter: brightness(1.2); transform: translateY(-1px); }

/* ─── PANTALLAS RESULTADO (aprobado / rechazado) ─── */
.icono-resultado        { margin-bottom: 20px; }
.icono-resultado svg    { width: 110px; height: 110px; }
.resultado-titulo       { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 8px; }
.resultado-subtitulo    { font-size: 0.875rem; color: #94A3B8; text-align: center; margin-bottom: 20px; padding: 0 12px; }

/* ─── RESPONSIVO MÓVIL ───────────────────────────── */
@media (max-width: 380px) {
    .titulo-aespa          { font-size: 2.75rem; }
    .camara-titulo         { font-size: 1.25rem; }
    .boton-principal,
    .boton-secundario      { padding: 11px 18px; font-size: 0.875rem; }
    .fila-botones          { gap: 10px; }
}

/* Safe area para iPhones con notch */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}