/* ============================================================
   VENTANA DE CUENTA (iniciar sesión / crear cuenta)
   Usa el mismo contenedor que el popup "¿Postulaste?", así que todo
   se limita a cuando adentro hay un .auth-gate.
   Se carga después de postula-popup.css.
   ============================================================ */

.postula-popup-overlay:has(.auth-gate) {
    align-items: center;
    padding: 16px;
    background: rgba(5, 5, 5, .55);
    backdrop-filter: blur(2px);
}

.postula-popup:has(.auth-gate) {
    max-width: 420px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    border: 0;
    border-radius: 16px;
    background: #fffdfa;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
    animation: authIn .18s ease-out;
}

@keyframes authIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.auth-gate {
    padding: 20px 20px 22px;
    font-family: var(--font-body);
    color: var(--va-text, #111);
}

.auth-gate[hidden],
.auth-gate [hidden] { display: none !important; }

/* ── Encabezado ── */
.auth-gate-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.auth-gate-title {
    margin: 0 0 4px;
    font: 800 1.25rem/1.2 var(--font-body);
    letter-spacing: -.01em;
}

.auth-gate-sub {
    margin: 0;
    font-size: .85rem;
    line-height: 1.4;
    color: #6b665e;
}

.auth-gate-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin: -6px -8px 0 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #6b665e;
    font-size: 1rem;
    cursor: pointer;
}

.auth-gate-close:hover { background: #f2eee7; color: var(--va-black); }

/* ── Pestañas ── */
.auth-gate-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: #f2eee7;
}

.auth-gate-tab {
    min-height: 38px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #6b665e;
    font: 750 .85rem/1 var(--font-body);
    cursor: pointer;
}

.auth-gate-tab.active {
    background: #fff;
    color: var(--va-black);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

/* ── Formulario ── */
.auth-gate-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-gate-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.auth-gate-field > span:first-child {
    font-size: .78rem;
    font-weight: 700;
    color: #4d4943;
}

.auth-gate-field input {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid #d7d0c4;
    border-radius: 10px;
    background: #fff;
    color: var(--va-black);
    font: 500 16px/1 var(--font-body); /* 16px evita el zoom de iOS */
    box-sizing: border-box;
}

.auth-gate-field input:focus {
    outline: none;
    border-color: var(--va-black);
    box-shadow: 0 0 0 3px rgba(255, 59, 0, .12);
}

.auth-gate-pass {
    position: relative;
    display: block;
}

.auth-gate-pass input { padding-right: 76px; }

.auth-gate-ver {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    min-height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #4d4943;
    font: 700 .78rem/1 var(--font-body);
    cursor: pointer;
}

.auth-gate-ver:hover { background: #f2eee7; }

.auth-gate-error {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fdecea;
    color: #9b2c1c;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.35;
}

.auth-gate-error.is-ok {
    background: #edf5ef;
    color: var(--va-green, #24412f);
}

.auth-gate-submit {
    min-height: 48px;
    margin-top: 2px;
    border: 0;
    border-radius: 10px;
    background: var(--va-black);
    color: #fff;
    font: 800 .9rem/1 var(--font-body);
    cursor: pointer;
}

.auth-gate-submit:hover { background: #222; }

.auth-gate-submit:disabled { opacity: .6; cursor: wait; }

.auth-gate-link {
    align-self: center;
    padding: 4px;
    border: 0;
    background: transparent;
    color: #4d4943;
    font: 600 .82rem/1.2 var(--font-body);
    text-decoration: underline;
    cursor: pointer;
}

.auth-gate-legal {
    margin: 0;
    text-align: center;
    font-size: .76rem;
    color: #8a847a;
}

.auth-gate :focus-visible {
    outline: 2px solid var(--va-orange);
    outline-offset: 2px;
}

/* ── Celular: hoja que sube desde abajo ── */
@media (max-width: 760px) {
    .postula-popup-overlay:has(.auth-gate) {
        align-items: flex-end;
        padding: 0;
    }

    .postula-popup:has(.auth-gate) {
        max-width: none;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
        animation: authUp .22s ease-out;
    }

    .auth-gate { padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }

    @keyframes authUp {
        from { transform: translateY(24px); opacity: .6; }
        to   { transform: none; opacity: 1; }
    }
}
