/* AutoSocialProof - auth pages (login, sign-up, password + activation pages).
   Loaded only by views/auth_wrapper.php, after the theme bootstrap + custom.css.
   Palette: Ink Navy #1E1B4B, Proof Violet #6D28D9, Buzz Pink #EC4899, Panda Rust #C2552B.
   Theme follows body[data-theme-style] (set by the server, the OS preference or the theme switch).
   Logical properties keep RTL languages mirrored. */

body.auth-page {
    --a-bg: #f6f4fe;
    --a-surface: #ffffff;
    --a-ink: #1e1b4b;
    --a-ink-2: #3f3b68;
    --a-muted: #5b5780;
    --a-line: #dedaf0;
    --a-input-bg: #ffffff;
    --a-input-line: #cdc8e4;
    --a-link: #6d28d9;
    --a-link-hover: #5b21b6;
    --a-focus: #6d28d9;
    --a-focus-ring: rgba(109, 40, 217, .22);
    --a-btn-from: #6d28d9;
    --a-btn-to: #be185d;
    --a-soft: #f1ecff;
    --a-soft-ink: #5b21b6;
    --a-shadow: 0 1px 2px rgba(30, 27, 75, .06), 0 12px 32px -12px rgba(30, 27, 75, .18);
    --a-radius: 12px;

    margin: 0;
    min-height: 100vh;
    background: var(--a-bg) !important;
    color: var(--a-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.auth-page[data-theme-style="dark"] {
    --a-bg: #0e0c22;
    --a-surface: #17142f;
    --a-ink: #f3f1ff;
    --a-ink-2: #d4d0ee;
    --a-muted: #aca7cf;
    --a-line: #2e2a52;
    --a-input-bg: #100e26;
    --a-input-line: #3d3868;
    --a-link: #c4b5fd;
    --a-link-hover: #ddd6fe;
    --a-focus: #c4b5fd;
    --a-focus-ring: rgba(196, 181, 253, .28);
    --a-btn-from: #7c3aed;
    --a-btn-to: #be185d;
    --a-soft: #241f45;
    --a-soft-ink: #ddd6fe;
    --a-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -16px rgba(0, 0, 0, .7);
}

.auth-page *, .auth-page *::before, .auth-page *::after { box-sizing: border-box; }

/* Skip link */
.auth-skip {
    position: absolute;
    inset-inline-start: 12px;
    top: -60px;
    z-index: 1000;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--a-surface);
    color: var(--a-ink) !important;
    font-weight: 600;
    box-shadow: var(--a-shadow);
}
.auth-skip:focus { top: 12px; }

/* Visible focus everywhere on these pages */
.auth-page a:focus-visible,
.auth-page button:focus-visible,
.auth-page [role="button"]:focus-visible,
.auth-page .btn:focus-visible {
    outline: 3px solid var(--a-focus);
    outline-offset: 2px;
    box-shadow: none;
}
.auth-brand a:focus-visible,
.auth-brand button:focus-visible { outline-color: #fff; }
.auth-content:focus { outline: none; }

/* ---------- Shell ---------- */
.auth-shell {
    display: grid;
    grid-template-columns: minmax(400px, 44%) minmax(0, 1fr);
    min-height: 100vh;
}

/* ---------- Brand panel ---------- */
.auth-brand {
    position: relative;
    min-width: 0;
    overflow: clip;
    color: #fff;
    background:
        radial-gradient(700px 480px at 100% 0%, rgba(236, 72, 153, .35), transparent 60%),
        radial-gradient(640px 520px at 0% 100%, rgba(109, 40, 217, .75), transparent 65%),
        linear-gradient(160deg, #1e1b4b 0%, #2e1a6e 50%, #4c1d95 100%);
    isolation: isolate;
}
.auth-brand__inner {
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 600px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 36px clamp(28px, 4vw, 56px);
}
.auth-brand::before { /* soft dot grid */
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(rgba(255, 255, 255, .13) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
    mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
    pointer-events: none;
}
.auth-brand__glow {
    position: absolute;
    z-index: -1;
    width: 420px;
    height: 420px;
    inset-inline-end: -120px;
    bottom: 22%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(236, 72, 153, .28), transparent 70%);
    pointer-events: none;
}

.auth-brand__logo { display: inline-block; border-radius: 6px; }
.auth-brand__logo img { display: block; width: 210px; height: auto; }

.auth-brand__body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.auth-brand__eyebrow {
    display: inline-flex;
    align-self: flex-start;
    margin: 0 0 12px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .22);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.auth-brand__headline {
    margin: 0 0 12px;
    max-width: 18ch;
    font-size: clamp(1.75rem, 2.6vw, 2.5rem);
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #fff;
}
.auth-brand__lead {
    margin: 0;
    max-width: 42ch;
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, .86);
}

.auth-brand__hero {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    margin: 8px 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.auth-brand__hero img {
    display: block;
    width: auto;
    height: 100%;
    max-height: 360px;
    max-width: 300px;
    object-fit: contain;
    filter: drop-shadow(0 22px 30px rgba(10, 6, 40, .45));
}

/* Decorative example popup (aria-hidden) */
.auth-toast {
    position: absolute;
    inset-inline-start: 0;
    bottom: 18%;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 260px;
    padding: 10px 16px 10px 10px;
    border-radius: 14px;
    background: #fff;
    color: #1e1b4b;
    box-shadow: 0 14px 34px -10px rgba(10, 6, 40, .55);
    animation: auth-float 6s ease-in-out infinite;
}
.auth-toast__icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, #6d28d9, #db2777);
}
.auth-toast__text { display: flex; flex-direction: column; line-height: 1.25; }
.auth-toast__text strong { font-size: .85rem; font-weight: 700; white-space: nowrap; }
.auth-toast__text small { font-size: .72rem; color: #5b5780; }

@keyframes auth-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Rotating lines */
.auth-quotes {
    position: relative;
    padding: 20px 22px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .16);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.auth-quotes__mark { position: absolute; top: 16px; inset-inline-end: 18px; font-size: 1.4rem; color: rgba(255, 255, 255, .25); }
.auth-quotes__viewport { min-height: 5.6em; }
.auth-brand .auth-quote { margin: 0; padding: 0; border: 0; background: none; font-style: normal; color: #fff; box-shadow: none; }
.auth-quote[hidden] { display: none; }
.auth-quote.is-active { animation: auth-quote-in .5s ease both; }
.auth-quote p {
    margin: 0 0 8px;
    padding-inline-end: 28px;
    font-size: 1.06rem;
    line-height: 1.5;
    font-weight: 600;
    color: #fff;
}
.auth-quote footer { font-size: .82rem; color: rgba(255, 255, 255, .78); }
.auth-quote footer::before { content: "\2014\00a0"; }
@keyframes auth-quote-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.auth-quotes__controls { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.auth-quotes__dots { display: flex; gap: 2px; }
.auth-quotes__dot {
    position: relative;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}
.auth-quotes__dot::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .45);
    transition: width .25s ease, margin .25s ease, background-color .25s ease;
}
.auth-quotes__dot.is-active::after { width: 18px; margin-left: -9px; background: #fff; }
.auth-quotes__pause {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .3);
    background: transparent;
    color: #fff;
    font-size: .75rem;
    cursor: pointer;
}
.auth-quotes__pause:hover { background: rgba(255, 255, 255, .12); }

/* ---------- Form side ---------- */
.auth-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}
.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px clamp(16px, 4vw, 40px);
}
.auth-topbar__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 4px;
    border-radius: 8px;
    color: var(--a-muted) !important;
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none !important;
}
.auth-topbar__back:hover { color: var(--a-ink) !important; }
.auth-topbar__theme {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--a-line);
    background: var(--a-surface);
    color: var(--a-ink-2);
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease;
}
.auth-topbar__theme:hover { color: var(--a-link); border-color: var(--a-link); }
.auth-topbar__theme .fa-sun { color: #b45309; }

.auth-content {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px clamp(16px, 4vw, 40px) 32px;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    padding: clamp(24px, 4vw, 40px);
    border-radius: 20px;
    background: var(--a-surface);
    border: 1px solid var(--a-line);
    box-shadow: var(--a-shadow);
}
.auth-page--register .auth-card { max-width: 480px; }

.auth-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    padding: 16px clamp(16px, 4vw, 40px) 24px;
    font-size: .8rem;
    color: var(--a-muted);
}

/* Heading */
.auth-head { margin-bottom: 24px; }
.auth-head__icon {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    border-radius: 14px;
    background: var(--a-soft);
    color: var(--a-soft-ink);
    font-size: 1.2rem;
}
.auth-head__title {
    margin: 0 0 6px;
    font-size: 1.75rem;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--a-ink);
}
.auth-head__sub { margin: 0; font-size: .95rem; line-height: 1.55; color: var(--a-muted); }
.auth-head__sub strong { color: var(--a-ink); word-break: break-all; }

/* Alerts */
.auth-alerts:empty { display: none; }
.auth-alerts .alert { border-radius: var(--a-radius); font-size: .9rem; margin-bottom: 16px; }

/* Fields */
.auth-form .form-group { margin-bottom: 18px; }
.auth-form label {
    margin-bottom: 6px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--a-ink-2);
}
.auth-form .form-control {
    height: 48px;
    padding: 10px 14px;
    border-radius: var(--a-radius);
    border: 1px solid var(--a-input-line);
    background-color: var(--a-input-bg);
    color: var(--a-ink);
    font-size: 1rem; /* 16px avoids iOS zoom */
    transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-form .form-control::placeholder { color: var(--a-muted); opacity: .85; }
.auth-form .form-control:hover { border-color: var(--a-muted); }
.auth-form .form-control:focus {
    border-color: var(--a-focus);
    box-shadow: 0 0 0 4px var(--a-focus-ring);
    background-color: var(--a-input-bg);
    color: var(--a-ink);
    outline: none;
}
.auth-form .form-control.is-invalid { border-color: #dc2626; }
body.auth-page[data-theme-style="dark"] .auth-form .form-control.is-invalid { border-color: #f87171; }
.auth-form .invalid-feedback { font-size: .82rem; margin-top: 6px; }
body.auth-page[data-theme-style="dark"] .auth-form .invalid-feedback { color: #fca5a5; }
.auth-help { display: block; margin-top: 6px; font-size: .8rem; color: var(--a-muted); }

/* Password show/hide (added by custom.js into the label) */
.auth-form [data-password-toggle-view] label a[role="button"] {
    display: inline-grid;
    place-items: center;
    min-width: 32px;
    min-height: 28px;
    border-radius: 6px;
    color: var(--a-muted) !important;
}
.auth-form [data-password-toggle-view] label a[role="button"]:hover { color: var(--a-link) !important; }

/* One-time code */
.auth-form .auth-otp {
    height: 56px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: .4em;
    font-variant-numeric: tabular-nums;
}

/* Captcha (basic image / recaptcha / hcaptcha / turnstile) */
.auth-captcha img#captcha { display: block; max-width: 100%; height: auto; border: 1px solid var(--a-line); border-radius: 10px !important; }
.auth-captcha > div, .auth-captcha iframe { max-width: 100%; }

/* Remember me + links row */
.auth-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-top: 4px;
}
.auth-row__links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .88rem; color: var(--a-muted); }

.auth-page .auth-row__links a,
.auth-page .auth-switch a,
.auth-page .auth-checks a,
.auth-page .auth-card a:not(.btn) {
    color: var(--a-link);
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
}
.auth-page .auth-card a:not(.btn):hover { color: var(--a-link-hover); text-decoration: underline; }

/* Checkboxes */
.auth-form .custom-control { min-height: 24px; padding-inline-start: 1.9rem; }
.auth-form .custom-control-label {
    font-size: .88rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--a-muted);
    cursor: pointer;
}
.auth-form .custom-control-label::before,
.auth-form .custom-control-label::after { top: .1rem; left: -1.9rem; width: 1.15rem; height: 1.15rem; }
.rtl .auth-form .custom-control-label::before,
.rtl .auth-form .custom-control-label::after { left: auto; right: -1.9rem; }
.auth-form .custom-control-label::before { border-radius: 6px !important; border: 1.5px solid var(--a-input-line); background-color: var(--a-input-bg); }
.auth-form .custom-control-input:checked ~ .custom-control-label::before { border-color: var(--a-btn-from); background-color: var(--a-btn-from); }
.auth-form .custom-control-input:focus ~ .custom-control-label::before { box-shadow: 0 0 0 4px var(--a-focus-ring); }
.auth-form .custom-control-input:focus-visible ~ .custom-control-label::before { outline: 3px solid var(--a-focus); outline-offset: 2px; }
.auth-checks { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }

/* Primary button */
.auth-page .auth-submit {
    min-height: 50px;
    padding: 12px 20px;
    border: 0;
    border-radius: var(--a-radius);
    background: linear-gradient(120deg, var(--a-btn-from) 0%, #9d174d 100%);
    background: linear-gradient(120deg, var(--a-btn-from) 0%, var(--a-btn-to) 100%);
    color: #fff !important;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .01em;
    box-shadow: 0 10px 24px -10px rgba(109, 40, 217, .65);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.auth-page .auth-submit:hover { filter: brightness(1.07); box-shadow: 0 14px 28px -10px rgba(109, 40, 217, .75); }
.auth-page .auth-submit:active { transform: translateY(1px); }
.auth-page .auth-submit:disabled,
.auth-page .auth-submit.disabled { opacity: .6; filter: grayscale(.25); box-shadow: none; }

/* Divider + social buttons */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 16px;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--a-muted);
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--a-line); }
.auth-social { display: grid; gap: 10px; }
.auth-page .auth-social__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    margin: 0 !important;
    border-radius: var(--a-radius);
    border: 1px solid var(--a-line);
    background: var(--a-surface);
    color: var(--a-ink) !important;
    font-weight: 600;
    font-size: .92rem;
}
.auth-page .auth-social__btn:hover { border-color: var(--a-link); background: var(--a-soft); }
.auth-social__btn img { width: 18px; height: 18px; margin: 0 !important; }

.auth-switch { margin: 24px 0 0; text-align: center; font-size: .92rem; color: var(--a-muted); }

/* Redeem-code block (HTML comes from the register_form_fields hook) */
.auth-page .custom-redeem-fields {
    margin: 4px 0 20px;
    padding: 4px 16px;
    border-radius: var(--a-radius);
    border: 1px dashed var(--a-input-line);
    background: var(--a-soft);
}
.auth-page .custom-redeem-fields > :first-child { margin-top: 10px; }
.auth-page .custom-redeem-fields > :last-child { margin-bottom: 10px; }
.auth-page .custom-redeem-fields button,
.auth-page .custom-redeem-fields .btn,
.auth-page .custom-redeem-fields summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 0;
    border: 0;
    background: transparent;
    color: var(--a-soft-ink) !important;
    font-size: .9rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
}
.auth-page .custom-redeem-fields summary { display: list-item; list-style-position: inside; }
.auth-page .custom-redeem-fields summary:focus-visible { outline: 3px solid var(--a-focus); outline-offset: 2px; border-radius: 6px; }
.auth-page .custom-redeem-fields input::placeholder { font-size: .9rem; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; letter-spacing: 0; color: var(--a-muted); }
.auth-page .custom-redeem-fields button:hover,
.auth-page .custom-redeem-fields summary:hover { text-decoration: underline; }
.auth-page .custom-redeem-fields label { font-size: .84rem; font-weight: 600; color: var(--a-ink-2); }
.auth-page .custom-redeem-fields input[type="text"],
.auth-page .custom-redeem-fields input:not([type]),
.auth-page .custom-redeem-fields .form-control {
    width: 100%;
    height: 44px;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--a-input-line);
    background: var(--a-input-bg);
    color: var(--a-ink);
    font-size: 1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    text-overflow: ellipsis;
    letter-spacing: .04em;
}
.auth-page .custom-redeem-fields input:focus {
    border-color: var(--a-focus);
    box-shadow: 0 0 0 4px var(--a-focus-ring);
    outline: none;
}
.auth-page .custom-redeem-fields small,
.auth-page .custom-redeem-fields .text-muted { color: var(--a-muted) !important; font-size: .8rem; }

/* Bootstrap dark theme alerts keep their own colors; make close icons tappable */
.auth-alerts .alert .close { min-width: 32px; min-height: 32px; }

/* ---------- Tablet: stacked, brand becomes a banner ---------- */
@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .auth-brand__inner {
        position: static;
        height: auto;
        min-height: 0;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "top hero" "body hero" "quotes hero";
        column-gap: 24px;
        row-gap: 14px;
        padding: 24px clamp(16px, 5vw, 40px);
    }
    .auth-brand__top { grid-area: top; }
    .auth-brand__body { grid-area: body; display: contents; }
    .auth-brand__copy { grid-area: body; }
    .auth-brand__hero { grid-area: hero; align-self: end; margin: 0; }
    .auth-brand__hero img { height: auto; width: 170px; max-height: none; }
    .auth-quotes { grid-area: quotes; }
    .auth-toast { display: none; }
    .auth-brand__headline { font-size: 1.75rem; max-width: 22ch; }
    .auth-brand__eyebrow { margin-bottom: 8px; }
    .auth-brand__headline { margin-bottom: 6px; }
    .auth-main { min-height: 0; }
    .auth-content { padding-top: 0; }
}

/* ---------- Phone: compact header ---------- */
@media (max-width: 767.98px) {
    .auth-brand__inner {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "top hero" "body hero";
        row-gap: 8px;
        column-gap: 12px;
        padding: 16px 16px 14px;
    }
    .auth-brand__logo img { width: 168px; }
    .auth-brand__eyebrow, .auth-brand__lead, .auth-quotes { display: none; }
    .auth-brand__headline { margin: 0; font-size: 1.12rem; line-height: 1.3; font-weight: 700; max-width: none; }
    .auth-brand__hero img { width: 76px; }
    .auth-topbar { padding: 8px 16px; }
    .auth-content { padding: 0 16px 16px; align-items: flex-start; }
    .auth-card { padding: 24px 20px; border-radius: 16px; }
    .auth-head__title { font-size: 1.5rem; }
    .auth-footer { padding: 8px 16px 20px; justify-content: center; text-align: center; }
}

@media (max-width: 359.98px) {
    .auth-brand__logo img { width: 150px; }
    .auth-brand__hero img { width: 64px; }
    .auth-card { padding: 20px 16px; }
    .auth-row { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-toast, .auth-quote.is-active { animation: none; }
    .auth-page .auth-submit, .auth-quotes__dot::after { transition: none; }
    .auth-page .altum-animate { animation: none !important; }
}
