/* ============================================================
   AUTENTICACION — PEUMAYEN (claro por defecto)
============================================================ */

:root {
    --peuma-black: #111111;
    --peuma-red: #ee1c25;
    --peuma-red-hot: #ff2a33;
    --peuma-red-dark: #c4121a;
    --peuma-white: #ffffff;
    --peuma-muted: #5f5f5f;
    --peuma-font-display: "Oswald", Impact, "Arial Narrow", sans-serif;
    --peuma-font-body: "Barlow", "Segoe UI", sans-serif;
}

body.auth-public {
    background:
        radial-gradient(ellipse 70% 50% at 20% 20%, rgba(238, 28, 37, 0.1), transparent 55%),
        radial-gradient(ellipse 55% 45% at 90% 10%, rgba(238, 28, 37, 0.07), transparent 50%),
        linear-gradient(160deg, #f7f7f7 0%, #ececec 45%, #e4e4e4 100%);
    color: var(--peuma-black);
    display: flex;
    flex-direction: column;
    font-family: var(--peuma-font-body);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

body.auth-public::before {
    background:
        repeating-linear-gradient(
            125deg,
            rgba(17, 17, 17, 0.03) 0,
            rgba(17, 17, 17, 0.03) 1px,
            transparent 1px,
            transparent 20px
        );
    content: "";
    inset: 0;
    opacity: 0.7;
    pointer-events: none;
    position: fixed;
    z-index: 0;
}

.auth-public-main {
    align-items: center;
    display: flex;
    flex: 1 1 auto;
    justify-content: center;
    min-height: 0;
    padding:
        max(24px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        12px
        max(16px, env(safe-area-inset-left));
    position: relative;
    z-index: 1;
    width: 100%;
}

.auth-stage {
    align-items: center;
    display: grid;
    gap: clamp(28px, 5vw, 72px);
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, 400px);
    margin: 0 auto;
    max-width: 1040px;
    width: 100%;
}

.auth-stage-brand {
    animation: auth-rise 0.7s ease both;
    display: flex;
    flex-direction: column;
    gap: 22px;
    justify-content: center;
    min-width: 0;
}

.auth-brand-mark {
    display: block;
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.18));
    height: auto;
    max-height: min(52vh, 380px);
    max-width: min(100%, 420px);
    object-fit: contain;
    width: auto;
}

.auth-brand-lead {
    animation: auth-rise 0.85s ease both;
    color: var(--peuma-muted);
    font-size: clamp(1.05rem, 1.6vw, 1.25rem);
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.45;
    margin: 0;
    max-width: 28ch;
}

.auth-stage-form {
    animation: auth-rise 0.9s ease both;
    background: #ffffff;
    border: 1px solid rgba(17, 17, 17, 0.08);
    border-radius: 4px;
    box-shadow:
        0 0 0 1px rgba(238, 28, 37, 0.06),
        0 18px 40px rgba(17, 17, 17, 0.08);
    color: var(--peuma-black);
    padding: clamp(24px, 3vw, 34px);
    position: relative;
}

.auth-stage-form::before {
    background: linear-gradient(90deg, transparent, var(--peuma-red), transparent);
    content: "";
    height: 2px;
    left: 0;
    opacity: 0.95;
    position: absolute;
    right: 0;
    top: 0;
}

.auth-form-heading {
    margin-bottom: 22px;
}

.auth-form-kicker {
    color: var(--peuma-red);
    font-family: var(--peuma-font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    line-height: 1;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.auth-form-heading h1 {
    color: var(--peuma-black);
    font-family: var(--peuma-font-display);
    font-size: clamp(1.7rem, 2.4vw, 2.1rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    margin: 0;
    text-transform: uppercase;
}

.auth-alert {
    border-radius: 4px;
    margin-bottom: 16px;
}

.auth-login-message {
    line-height: 1.35;
    margin-bottom: 16px;
}

.auth-email-form,
.auth-login-form,
.auth-token-form {
    display: grid;
    gap: 16px;
}

.auth-field {
    display: grid;
    gap: 8px;
}

.auth-password-wrap {
    position: relative;
}

.auth-password-wrap .form-control {
    padding-right: 3.1rem;
}

.auth-password-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    color: #6b6b6b;
    display: inline-flex;
    font-size: 1.2rem;
    height: 100%;
    justify-content: center;
    padding: 0 14px;
    position: absolute;
    right: 0;
    top: 0;
    transition: color .15s ease;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
    color: var(--peuma-black);
    outline: none;
}

.auth-password-toggle[aria-pressed="true"] {
    color: var(--peuma-red);
}

.auth-field-label {
    color: #3a3a3a;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
}

.auth-field-hint {
    color: #777;
    font-size: 0.78rem;
    line-height: 1.3;
}

.auth-stage-form .form-control,
.auth-token-panel .form-control {
    background: #fafafa;
    border: 1px solid #d5d5d5;
    border-radius: 4px;
    color: var(--peuma-black);
    font-size: 1rem;
    min-height: 52px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-stage-form .form-control::placeholder {
    color: #8a8a8a;
}

.auth-stage-form .form-control:focus {
    background: #fff;
    border-color: var(--peuma-red);
    box-shadow: 0 0 0 3px rgba(238, 28, 37, 0.16);
    color: var(--peuma-black);
}

.auth-altcha-block {
    background: #f6f6f6;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
}

.auth-altcha-block altcha-widget {
    --altcha-border-radius: 4px;
    --altcha-color-active: #ee1c25;
    --altcha-color-base: transparent;
    --altcha-color-border: #cfcfcf;
    --altcha-color-border-focus: #ee1c25;
    --altcha-color-footer-bg: transparent;
    --altcha-color-text: #333;
    --altcha-max-width: 100%;
    display: block;
}

.auth-lan-captcha {
    align-items: center;
    color: #333;
    cursor: pointer;
    display: flex;
    font-size: 0.95rem;
    font-weight: 600;
    gap: 0.65rem;
    margin: 0;
}

.auth-lan-captcha input {
    accent-color: var(--peuma-red);
    height: 1.15rem;
    margin: 0;
    width: 1.15rem;
}

.auth-lan-captcha-hint {
    color: #666;
    font-size: 0.78rem;
    line-height: 1.35;
    margin: 0.55rem 0 0;
}

.auth-submit-button {
    align-items: center;
    background: var(--peuma-red);
    border: 1px solid var(--peuma-red);
    border-radius: 4px;
    color: #ffffff;
    display: inline-flex;
    font-family: var(--peuma-font-display);
    font-size: 1.05rem;
    font-weight: 700;
    gap: 10px;
    justify-content: center;
    letter-spacing: 0.08em;
    line-height: 1;
    margin-top: 4px;
    min-height: 54px;
    padding: 14px 18px;
    text-transform: uppercase;
    transition:
        background-color .15s ease,
        border-color .15s ease,
        box-shadow .15s ease,
        transform .15s ease;
    width: 100%;
}

.auth-submit-button:hover:not(:disabled) {
    background: var(--peuma-red-hot);
    border-color: var(--peuma-red-hot);
    box-shadow: 0 8px 24px rgba(238, 28, 37, 0.28);
    transform: translateY(-1px);
}

.auth-submit-button:disabled {
    background: #c9898c;
    border-color: #c9898c;
    cursor: not-allowed;
}

.auth-submit-button.is-loading i {
    animation: auth-spin .8s linear infinite;
}

.auth-email-form.is-submitting,
.auth-login-form.is-submitting {
    opacity: 0.78;
    pointer-events: none;
}

.auth-email-form.is-submitting .auth-submit-button,
.auth-login-form.is-submitting .auth-submit-button {
    pointer-events: auto;
}

.auth-email-form.is-submitting input,
.auth-email-form.is-submitting altcha-widget,
.auth-login-form.is-submitting input,
.auth-login-form.is-submitting altcha-widget {
    filter: grayscale(0.25);
}

.auth-submit-feedback {
    background: #f6f6f6;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #555;
    margin-top: 2px;
    padding: 14px;
}

.auth-submit-feedback[hidden] {
    display: none;
}

.auth-submit-feedback strong {
    color: var(--peuma-black);
    display: block;
    line-height: 1.2;
    margin-bottom: 8px;
}

.auth-submit-feedback ul {
    display: grid;
    gap: 7px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.auth-submit-feedback li {
    align-items: flex-start;
    display: grid;
    font-size: 0.9rem;
    gap: 8px;
    grid-template-columns: 18px 1fr;
    line-height: 1.35;
}

.auth-submit-feedback li i {
    color: var(--peuma-red);
    line-height: 1.25;
}

.auth-theme-fab {
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    color: #333;
    display: inline-flex;
    font-size: 1.05rem;
    gap: 8px;
    min-height: 44px;
    min-width: 44px;
    padding: 10px 14px;
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    top: max(12px, env(safe-area-inset-top));
    z-index: 20;
}

.auth-theme-fab span {
    font-size: 0.82rem;
    font-weight: 700;
}

@keyframes auth-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes auth-rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.auth-public footer {
    color: rgba(17, 17, 17, 0.45) !important;
    flex-shrink: 0;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    padding-top: 4px !important;
    position: relative;
    z-index: 1;
}

/* ---------- Dark mode (opcional) ---------- */
html[data-bs-theme="dark"] body.auth-public {
    background:
        radial-gradient(ellipse 70% 55% at 28% 40%, rgba(238, 28, 37, 0.22), transparent 62%),
        radial-gradient(ellipse 50% 40% at 85% 15%, rgba(238, 28, 37, 0.18), transparent 55%),
        #050505;
    color: #fff;
}

html[data-bs-theme="dark"] body.auth-public::before {
    background:
        repeating-linear-gradient(
            125deg,
            rgba(255, 255, 255, 0.03) 0,
            rgba(255, 255, 255, 0.03) 1px,
            transparent 1px,
            transparent 20px
        );
    opacity: 0.55;
}

html[data-bs-theme="dark"] .auth-brand-lead,
html[data-bs-theme="dark"] body.auth-public footer {
    color: rgba(255, 255, 255, 0.72) !important;
}

html[data-bs-theme="dark"] .auth-stage-form {
    background: linear-gradient(180deg, rgba(22, 22, 22, 0.92), rgba(10, 10, 10, 0.96));
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
    color: #f2f2f2;
}

html[data-bs-theme="dark"] .auth-form-heading h1,
html[data-bs-theme="dark"] .auth-field-label {
    color: #fff;
}

html[data-bs-theme="dark"] .auth-field-hint {
    color: rgba(255, 255, 255, 0.55);
}

html[data-bs-theme="dark"] .auth-stage-form .form-control {
    background: #0a0a0a;
    border-color: #333;
    color: #fff;
}

html[data-bs-theme="dark"] .auth-stage-form .form-control:focus {
    background: #0a0a0a;
    color: #fff;
}

html[data-bs-theme="dark"] .auth-altcha-block {
    background: rgba(255, 255, 255, 0.03);
    border-color: #2c2c2c;
}

html[data-bs-theme="dark"] .auth-altcha-block altcha-widget {
    --altcha-color-text: #e8e8e8;
    --altcha-color-border: #444;
}

html[data-bs-theme="dark"] .auth-lan-captcha {
    color: #e8e8e8;
}

html[data-bs-theme="dark"] .auth-lan-captcha-hint {
    color: #9a9a9a;
}

html[data-bs-theme="dark"] .auth-password-toggle {
    color: #9a9a9a;
}

html[data-bs-theme="dark"] .auth-password-toggle:hover,
html[data-bs-theme="dark"] .auth-password-toggle:focus-visible {
    color: #fff;
}

html[data-bs-theme="dark"] .auth-theme-fab {
    background: #111;
    border-color: #333;
    color: #fff;
}

@media (max-width: 900px) {
    .auth-public-main {
        align-items: stretch;
        justify-content: flex-start;
        padding-top: max(56px, calc(env(safe-area-inset-top) + 48px));
        padding-bottom: 8px;
    }

    .auth-stage {
        align-content: start;
        gap: 14px;
        grid-template-columns: 1fr;
        max-width: 420px;
        width: 100%;
    }

    .auth-stage-brand {
        align-items: center;
        gap: 8px;
        text-align: center;
    }

    .auth-brand-mark {
        margin-inline: auto;
        max-height: 112px;
        max-width: 168px;
    }

    .auth-brand-lead {
        font-size: 0.95rem;
        line-height: 1.35;
        max-width: 32ch;
    }

    .auth-stage-form {
        padding: 18px 16px 16px;
    }

    .auth-form-heading {
        margin-bottom: 14px;
    }

    .auth-form-heading h1 {
        font-size: 1.45rem;
    }

    .auth-email-form,
    .auth-login-form,
    .auth-token-form {
        gap: 12px;
    }

    .auth-field {
        gap: 6px;
    }

    .auth-stage-form .form-control,
    .auth-token-panel .form-control {
        font-size: 16px; /* evita zoom forzado en iOS */
        min-height: 48px;
        padding-bottom: 0.65rem;
        padding-top: 0.65rem;
    }

    .auth-stage-form .form-control-lg {
        font-size: 16px;
        min-height: 48px;
        padding: 0.65rem 0.85rem;
    }

    .auth-password-wrap .form-control-lg {
        padding-right: 3rem;
    }

    .auth-altcha-block {
        padding: 10px;
    }

    .auth-submit-button {
        font-size: 0.98rem;
        min-height: 50px;
        padding: 12px 16px;
    }

    .auth-theme-fab {
        justify-content: center;
        padding: 0;
    }

    .auth-theme-fab span {
        display: none;
    }

    body.auth-public footer {
        font-size: 0.72rem;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    body.auth-public footer small {
        display: block;
        line-height: 1.3;
    }
}

@media (max-width: 480px) {
    .auth-public-main {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    .auth-brand-mark {
        max-height: 88px;
        max-width: 140px;
    }

    .auth-brand-lead {
        font-size: 0.88rem;
        max-width: 28ch;
    }

    .auth-form-kicker {
        font-size: 0.72rem;
        margin-bottom: 6px;
    }

    .auth-form-heading h1 {
        font-size: 1.3rem;
        letter-spacing: 0.03em;
    }

    .auth-lan-captcha-hint {
        font-size: 0.72rem;
    }
}

/* Teléfonos en horizontal: logo + form en dos columnas compactas */
@media (max-width: 900px) and (max-height: 480px) {
    .auth-public-main {
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .auth-stage {
        align-items: center;
        gap: 16px;
        grid-template-columns: minmax(96px, 140px) minmax(0, 1fr);
        max-width: 720px;
    }

    .auth-stage-brand {
        align-items: center;
        gap: 6px;
    }

    .auth-brand-mark {
        max-height: 72px;
        max-width: 110px;
    }

    .auth-brand-lead {
        display: none;
    }

    .auth-stage-form {
        padding: 14px 14px 12px;
    }

    .auth-form-heading {
        margin-bottom: 10px;
    }

    .auth-email-form,
    .auth-login-form,
    .auth-token-form {
        gap: 10px;
    }

    .auth-theme-fab {
        top: max(8px, env(safe-area-inset-top));
        right: max(8px, env(safe-area-inset-right));
    }

    body.auth-public footer {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-stage-brand,
    .auth-brand-lead,
    .auth-stage-form {
        animation: none;
    }
}
