/* ==========================================================================
   SECIA — Estilos de Autenticación Unificados (auth.css)
   Paleta oficial:
     - Tinta: #302443
     - Violeta: #764ba2
     - Primario: #667eea
     - Papel / Fondo: #faf7fc
     - Rosa suave: #f7dfe9
     - Bordes: #e7ddeb
   Split-screen en escritorio (>=900px) y apilado compacto responsivo en móviles (<=899px)
   ========================================================================== */

:root {
    --secia-ink: #302443;
    --secia-ink-light: #5e526c;
    --secia-ink-muted: #847992;
    --secia-violet: #764ba2;
    --secia-violet-hover: #633c8b;
    --secia-primary: #667eea;
    --secia-primary-hover: #556cd6;
    --secia-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secia-gradient-hover: linear-gradient(135deg, #5b71db 0%, #683d94 100%);
    --secia-bg-paper: #faf7fc;
    --secia-bg-card: #ffffff;
    --secia-rose: #f7dfe9;
    --secia-rose-text: #912759;
    --secia-border: #e7ddeb;
    --secia-border-focus: #667eea;
    --secia-shadow-sm: 0 2px 8px rgba(48, 36, 67, 0.05);
    --secia-shadow-md: 0 10px 30px rgba(48, 36, 67, 0.08);
    --secia-shadow-lg: 0 20px 48px rgba(48, 36, 67, 0.12);
    --secia-clay-shadow: 12px 14px 28px rgba(118, 75, 162, 0.12), -10px -10px 24px rgba(255, 255, 255, 0.9);
    --secia-radius-sm: 8px;
    --secia-radius-md: 14px;
    --secia-radius-lg: 20px;
    --secia-radius-full: 9999px;
}

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

html, body {
    width: 100%;
    min-height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--secia-ink);
    background-color: var(--secia-bg-paper);
    background-image:
        radial-gradient(circle at 8% 12%, rgba(102, 126, 234, 0.09) 0%, transparent 45%),
        radial-gradient(circle at 92% 88%, rgba(118, 75, 162, 0.09) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(247, 223, 233, 0.35) 0%, transparent 60%);
    background-attachment: fixed;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ── Envoltura principal ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
}

.auth-shell {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 2.25rem;
    align-items: center;
}

/* ── Panel de Presentación (SECIA Estática + 4 Cuadros) ── */
.auth-presentation {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1rem 0.5rem;
}

.panama-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    align-self: flex-start;
    background: var(--secia-rose);
    color: var(--secia-rose-text);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.4rem 0.85rem;
    border-radius: var(--secia-radius-full);
    border: 1px solid rgba(145, 39, 89, 0.15);
    box-shadow: 0 2px 6px rgba(145, 39, 89, 0.06);
}

.hero-visual {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.secia-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
    width: 140px;
    height: 140px;
    border-radius: 28px;
    background: linear-gradient(145deg, #ffffff, #f2e9f8);
    box-shadow: var(--secia-clay-shadow);
    border: 2px solid rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.secia-avatar-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 28px;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.8) 0%, transparent 60%);
    pointer-events: none;
}

.secia-static-hero {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: drop-shadow(0 6px 14px rgba(48, 36, 67, 0.15));
}

.hero-copy h1 {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--secia-ink);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.hero-copy h1 span.gradient-text {
    background: var(--secia-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-copy p {
    font-size: 0.93rem;
    color: var(--secia-ink-light);
    margin-top: 0.35rem;
    line-height: 1.45;
}

/* ── Banner de Beneficio / Prueba Gratis ── */
.trial-banner {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(247, 223, 233, 0.6) 100%);
    border: 1.5px solid var(--secia-border);
    border-radius: var(--secia-radius-md);
    padding: 0.85rem 1.1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.trial-banner-icon {
    font-size: 1.35rem;
    line-height: 1;
    flex-shrink: 0;
}

.trial-banner-content h4 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--secia-violet);
    margin-bottom: 0.2rem;
}

.trial-banner-content p {
    font-size: 0.82rem;
    color: var(--secia-ink-light);
    line-height: 1.4;
}

.trial-banner-content strong {
    color: var(--secia-ink);
}

/* ── 4 Cuadros de Funciones (2x2) ── */
.feature-mini-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
}

.feature-box {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--secia-border);
    border-radius: var(--secia-radius-md);
    padding: 0.85rem 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    box-shadow: var(--secia-shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.feature-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--secia-shadow-md);
    border-color: rgba(118, 75, 162, 0.35);
}

.feature-box-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feature-icon-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #f2e9f8;
    color: var(--secia-violet);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.feature-box h3 {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--secia-ink);
    line-height: 1.25;
}

.feature-box p {
    font-size: 0.77rem;
    color: var(--secia-ink-light);
    line-height: 1.35;
}

/* ── Tarjeta de Autenticación ── */
.auth-card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: var(--secia-bg-card);
    border: 1.5px solid var(--secia-border);
    border-radius: var(--secia-radius-lg);
    padding: 2.25rem 2.25rem 2rem;
    box-shadow: var(--secia-shadow-lg);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--secia-gradient);
}

/* ── Pestañas Selectoras Superiores ── */
.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #f2edf7;
    padding: 4px;
    border-radius: var(--secia-radius-md);
    margin-bottom: 1.5rem;
    gap: 4px;
}

.auth-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--secia-ink-muted);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    text-align: center;
    user-select: none;
}

.auth-tab.active {
    background: #ffffff;
    color: var(--secia-ink);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(48, 36, 67, 0.08);
}

.auth-tab:not(.active):hover {
    color: var(--secia-violet);
    background: rgba(255, 255, 255, 0.5);
}

/* ── Encabezado de la Tarjeta ── */
.auth-header {
    margin-bottom: 1.5rem;
}

.auth-header h2 {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--secia-ink);
    letter-spacing: -0.01em;
}

.auth-header p.sub {
    font-size: 0.86rem;
    color: var(--secia-ink-light);
    margin-top: 0.25rem;
}

/* ── Alertas ── */
.alert-box {
    padding: 0.75rem 1rem;
    border-radius: var(--secia-radius-sm);
    font-size: 0.86rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    line-height: 1.45;
}

.alert-error {
    background: #fff5f5;
    border: 1.5px solid #feb2b2;
    color: #c53030;
}

.alert-ok {
    background: #f0fff4;
    border: 1.5px solid #9ae6b4;
    color: #276749;
}

.alert-ref {
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    color: #1e40af;
}

/* ── Formularios e Inputs ── */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.form-group {
    margin-bottom: 1.1rem;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--secia-ink);
    margin-bottom: 0.4rem;
}

.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.form-label-row label {
    margin-bottom: 0;
}

.auth-link-forgot {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--secia-purple);
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-link-forgot:hover {
    color: var(--secia-purple-hover);
    text-decoration: underline;
}

.form-group label span.req {
    color: #e53e3e;
    margin-left: 2px;
}

.form-group label span.opt {
    color: var(--secia-ink-muted);
    font-weight: 400;
    font-size: 0.76rem;
    margin-left: 4px;
}

.input-with-button {
    position: relative;
    display: flex;
    align-items: center;
}

/* font-size: 16px obligatorio en móvil para evitar zoom forzado en iOS */
.form-control {
    width: 100%;
    font-family: inherit;
    font-size: 16px;
    color: var(--secia-ink);
    background: #ffffff;
    border: 1.5px solid var(--secia-border);
    border-radius: var(--secia-radius-sm);
    padding: 0.72rem 0.95rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(48, 36, 67, 0.03);
}

.input-with-button .form-control {
    padding-right: 2.75rem;
}

.form-control:focus {
    border-color: var(--secia-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.22);
}

.form-control::placeholder {
    color: #a499b1;
    font-size: 0.88rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--secia-ink-muted);
    cursor: pointer;
    padding: 0.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.password-toggle-btn:hover {
    color: var(--secia-violet);
    background: rgba(118, 75, 162, 0.08);
}

.password-toggle-btn:focus-visible {
    outline: 2px solid var(--secia-violet);
}

/* ── Indicador de Requisitos de Contraseña ── */
.password-requirements {
    background: #fbf9fd;
    border: 1px solid var(--secia-border);
    border-radius: var(--secia-radius-sm);
    padding: 0.65rem 0.85rem;
    margin-top: 0.45rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.req-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.77rem;
    color: var(--secia-ink-muted);
    transition: color 0.2s ease;
}

.req-item .req-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e7ddeb;
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.req-item.valid {
    color: #22543d;
    font-weight: 600;
}

.req-item.valid .req-icon {
    background: #38a169;
    content: '✓';
    transform: scale(1.05);
}

/* ── Checkbox de Términos ── */
.checkbox-group {
    margin: 1.15rem 0 1.35rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.81rem;
    color: var(--secia-ink-light);
    line-height: 1.45;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin-top: 2px;
    accent-color: var(--secia-violet);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-label a {
    color: var(--secia-violet);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.checkbox-label a:hover {
    color: var(--secia-primary);
}

/* ── Botón Principal con Gradiente Violeta ── */
.btn-submit {
    width: 100%;
    min-height: 48px;
    padding: 0.85rem 1.25rem;
    background: var(--secia-gradient);
    color: #ffffff;
    border: none;
    border-radius: var(--secia-radius-sm);
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, background 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-submit:disabled,
.btn-submit[disabled] {
    background: #cbd5e1 !important;
    background-image: none !important;
    color: #64748b !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    transform: none !important;
    opacity: 0.65 !important;
    filter: grayscale(0.85);
    pointer-events: none !important;
}

.btn-submit:not(:disabled):hover {
    background: var(--secia-gradient-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.45);
}

.btn-submit:not(:disabled):active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-submit:focus-visible {
    outline: 2px solid var(--secia-violet);
    outline-offset: 3px;
}

/* ── Bloque Informativo Inferior (Prueba Gratis / Registro) ── */
.auth-subbox {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--secia-border);
    text-align: center;
}

.auth-subbox p {
    font-size: 0.83rem;
    color: var(--secia-ink-light);
    line-height: 1.45;
}

.auth-subbox a.subbox-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--secia-violet);
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-subbox a.subbox-link:hover {
    color: var(--secia-primary);
    text-decoration: underline;
}

/* ── Enlaces del Pie (Volver al inicio & Instagram) ── */
.auth-footer-links {
    margin-top: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--secia-ink-muted);
}

.auth-footer-links a {
    color: var(--secia-ink-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: color 0.15s ease;
}

.auth-footer-links a:hover {
    color: var(--secia-violet);
}

.auth-footer-links span.dot {
    opacity: 0.4;
}

/* ── Estilos Específicos para Login 2FA ── */
.auth-2fa-shell {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

.totp-input {
    font-size: 1.9rem !important;
    letter-spacing: 0.35em !important;
    text-align: center !important;
    font-weight: 700;
    padding: 0.75rem 0.5rem !important;
    color: var(--secia-ink);
}

.icon-2fa-shield {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secia-violet);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* ── Cloudflare Turnstile Centrado ── */
.cf-turnstile {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
}

/* ==========================================================================
   RESPONSIVE DESIGN (<= 899px Celulares y Tablets)
   En celular se apila de forma compacta sin ocultar a SECIA ni los 4 cuadros:
   1. Cabecera con avatar estático de SECIA y título
   2. Formulario principal para acceso rápido inmediato
   3. 4 cuadros pequeños de funciones (grid 2x2) y banner de prueba gratis
   ========================================================================== */

@media (max-width: 899px) {
    .auth-page {
        padding: 1rem 0.75rem 2.25rem;
        align-items: flex-start;
    }

    .auth-shell {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
    }

    /* Permite que los grupos internos se reordenen en el flex padre */
    .auth-presentation {
        display: contents;
    }

    /* 1. Cabecera compacta con SECIA arriba */
    .auth-hero-group {
        order: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.75rem;
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
    }

    .panama-badge {
        font-size: 0.72rem;
        padding: 0.3rem 0.75rem;
        margin: 0 auto;
    }

    .hero-visual {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        text-align: left;
        gap: 0.85rem;
        width: 100%;
    }

    .secia-avatar-wrapper {
        width: 80px;
        height: 80px;
        border-radius: 20px;
        flex-shrink: 0;
    }

    .hero-copy h1 {
        font-size: 1.35rem;
    }

    .hero-copy p {
        font-size: 0.8rem;
        margin-top: 0.2rem;
    }

    /* 2. El formulario va justo debajo de la cabecera para acceso rápido */
    .auth-card-wrapper {
        order: 2;
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
    }

    .auth-card {
        padding: 1.5rem 1.25rem 1.35rem;
        border-radius: var(--secia-radius-md);
    }

    .auth-header h2 {
        font-size: 1.25rem;
    }

    .form-grid-2 {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* 3. Los 4 cuadros y el banner van abajo del formulario sin scroll previo */
    .auth-features-group {
        order: 3;
        display: flex;
        flex-direction: column;
        gap: 0.85rem;
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
    }

    .feature-mini-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.65rem;
    }

    .feature-box {
        padding: 0.7rem 0.75rem;
    }

    .feature-box h3 {
        font-size: 0.8rem;
    }

    .feature-box p {
        font-size: 0.72rem;
    }

    .trial-banner {
        padding: 0.75rem 0.9rem;
    }
}

/* Pantallas muy pequeñas (< 360px) */
@media (max-width: 359px) {
    .feature-mini-grid {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 1.25rem 0.95rem;
    }
}
