﻿/* WPG Analytics — Auth Pages (login / register) */
@import url("wpg-tokens.css");

/* ─── Shell ─── */
body.wpg-auth {
    margin: 0;
    min-height: 100vh;
    font-family: var(--wpg-font);
    direction: rtl;
    color: var(--wpg-auth-text, #f4f4f5);
    background: var(--wpg-auth-bg, #06060a);
    overflow-x: hidden;
}

body.wpg-auth .form-control,
body.wpg-auth .btn,
body.wpg-auth .wpg-auth-card,
body.wpg-auth .wpg-auth-showcase {
    font-family: var(--wpg-font);
}

.wpg-auth-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: var(--wpg-auth-bg-mesh);
}

.wpg-auth-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    opacity: .55;
}

.wpg-auth-orb-1 {
    width: 420px;
    height: 420px;
    top: -120px;
    right: -80px;
    background: rgba(59,130,246,.35);
}

.wpg-auth-orb-2 {
    width: 360px;
    height: 360px;
    bottom: -100px;
    left: -60px;
    background: rgba(139,92,246,.28);
}

.wpg-auth-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: .28;
    background-image:
        linear-gradient(var(--wpg-auth-grid-line, rgba(255,255,255,.03)) 1px, transparent 1px),
        linear-gradient(90deg, var(--wpg-auth-grid-line, rgba(255,255,255,.03)) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 75% 65% at 50% 45%, black, transparent);
}

.wpg-auth-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
}

/* ─── Showcase (left panel) ─── */
.wpg-auth-showcase {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 3.5rem;
    border-left: 1px solid var(--wpg-auth-border, rgba(255,255,255,.08));
    background: var(--wpg-auth-showcase-bg, rgba(255,255,255,.02));
}

@media (min-width: 992px) {
    .wpg-auth-showcase {
        position: sticky;
        top: 0;
        height: 100vh;
        align-self: start;
    }
}

.wpg-auth-showcase-inner {
    max-width: 420px;
}

.wpg-auth-logo {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    color: inherit;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -.02em;
    margin-bottom: 2rem;
}

.wpg-auth-logo-icon {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--wpg-gradient);
    color: #fff;
    font-size: 1.35rem;
    box-shadow: 0 10px 30px rgba(59,130,246,.4);
}

.wpg-auth-promo {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .85rem;
    border-radius: 999px;
    background: rgba(99,102,241,.18);
    border: 1px solid rgba(99,102,241,.3);
    color: #c7d2fe;
    font-size: .78rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.wpg-auth-showcase-title {
    font-size: clamp(1.65rem, 3vw, 2.1rem);
    font-weight: 900;
    letter-spacing: -.04em;
    line-height: 1.25;
    margin: 0 0 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wpg-auth-showcase-lead {
    color: var(--wpg-auth-muted, #a1a1aa);
    font-size: .95rem;
    line-height: 1.75;
    margin: 0 0 1.75rem;
}

.wpg-auth-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.wpg-auth-features li {
    display: flex;
    align-items: center;
    gap: .65rem;
    font-size: .9rem;
    color: var(--wpg-auth-muted, #d4d4d8);
    font-weight: 600;
}

.wpg-auth-features i {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(59,130,246,.15);
    color: #93c5fd;
    font-size: .95rem;
    flex-shrink: 0;
}

/* ─── Form panel ─── */
.wpg-auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 2.5rem;
}

.wpg-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--wpg-auth-card-bg);
    backdrop-filter: blur(28px) saturate(1.4);
    -webkit-backdrop-filter: blur(28px) saturate(1.4);
    border: 1px solid var(--wpg-auth-border);
    border-radius: var(--wpg-radius-xl);
    padding: 2rem 2rem 1.75rem;
    box-shadow: var(--wpg-auth-card-shadow);
}

.wpg-auth-card-head {
    text-align: center;
    margin-bottom: 1.75rem;
}

.wpg-auth-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .75rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
    background: rgba(59,130,246,.12);
    border: 1px solid rgba(59,130,246,.22);
    color: #93c5fd;
    margin-bottom: 1rem;
}

.wpg-auth-chip-accent {
    background: rgba(139,92,246,.14);
    border-color: rgba(139,92,246,.28);
    color: #c4b5fd;
}

.wpg-auth-card h1 {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -.03em;
    margin: 0 0 .4rem;
    color: var(--wpg-auth-text);
}

.wpg-auth-card .subtitle {
    margin: 0;
    color: var(--wpg-auth-muted);
    font-size: .875rem;
}

.wpg-auth-field {
    margin-bottom: 1rem;
}

.wpg-auth-card .form-label {
    color: var(--wpg-auth-label);
    font-size: .82rem;
    font-weight: 700;
    margin-bottom: .4rem;
}

.wpg-auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.wpg-auth-input-icon {
    position: absolute;
    right: .9rem;
    color: var(--wpg-auth-icon);
    font-size: 1.05rem;
    pointer-events: none;
    z-index: 2;
}

.wpg-auth-input-action {
    position: absolute;
    left: .5rem;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--wpg-auth-icon);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: background var(--wpg-transition), color var(--wpg-transition);
}

.wpg-auth-input-action:hover {
    background: rgba(59,130,246,.1);
    color: var(--wpg-accent);
}

.wpg-auth-card .form-control.wpg-auth-input {
    background: var(--wpg-auth-input-bg);
    border: 1px solid var(--wpg-auth-input-border);
    border-radius: var(--wpg-radius-sm);
    color: var(--wpg-auth-text);
    padding: .72rem 2.75rem .72rem 2.5rem;
    font-size: .9rem;
    transition: border-color var(--wpg-transition), box-shadow var(--wpg-transition), background var(--wpg-transition);
}

.wpg-auth-card .form-control.wpg-auth-input::placeholder {
    color: var(--wpg-auth-placeholder);
}

.wpg-auth-card .form-control.wpg-auth-input:focus {
    background: var(--wpg-auth-input-bg-focus);
    border-color: rgba(59,130,246,.55);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
    color: var(--wpg-auth-text);
}

.wpg-auth-card .form-control.is-invalid {
    border-color: rgba(239,68,68,.65);
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

.wpg-auth-submit {
    width: 100%;
    padding: .8rem 1rem;
    margin-top: .5rem;
    border: none;
    border-radius: var(--wpg-radius-sm);
    background: var(--wpg-gradient);
    font-weight: 800;
    font-size: .95rem;
    color: #fff;
    box-shadow: 0 10px 32px rgba(59,130,246,.35);
    transition: transform var(--wpg-transition), box-shadow var(--wpg-transition), filter var(--wpg-transition);
}

.wpg-auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 40px rgba(59,130,246,.42);
    filter: brightness(1.04);
    color: #fff;
}

.wpg-auth-submit.wpg-loader-btn.wpg-loading {
    opacity: .92;
    cursor: wait;
    transform: none;
    filter: none;
}

.wpg-auth-submit.wpg-loader-btn.wpg-loading::after {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.wpg-auth-otp-actions .btn-link.wpg-loader-btn.wpg-loading,
#wpgRegisterStepOtp .btn-link.wpg-loader-btn.wpg-loading {
    color: transparent !important;
    min-width: 5rem;
    text-decoration: none;
}

.wpg-auth-otp-actions .btn-link.wpg-loader-btn.wpg-loading::after,
#wpgRegisterStepOtp .btn-link.wpg-loader-btn.wpg-loading::after {
    border-color: rgba(59,130,246,.25);
    border-top-color: #3b82f6;
}

.wpg-auth-footer {
    text-align: center;
    margin-top: 1.35rem;
    font-size: .875rem;
    color: var(--wpg-auth-muted);
}

.wpg-auth-footer a {
    color: var(--wpg-auth-link);
    text-decoration: none;
    font-weight: 700;
}

.wpg-auth-footer a:hover {
    color: var(--wpg-accent);
}

.wpg-auth-theme {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 30;
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--wpg-auth-border);
    background: var(--wpg-auth-card-bg);
    color: var(--wpg-auth-muted);
    backdrop-filter: blur(12px);
    cursor: pointer;
    transition: background var(--wpg-transition), border-color var(--wpg-transition), transform .15s ease;
}

.wpg-auth-theme:hover {
    border-color: rgba(59,130,246,.35);
    color: var(--wpg-accent);
}

.wpg-auth-theme:active {
    transform: scale(.94);
}

/* Toast on auth — top center on mobile */
body.wpg-auth #wpgToastContainer {
    top: 1rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    align-items: center;
}

/* ─── Dark (default auth palette) ─── */
body.wpg-auth,
html[data-wpg-theme="dark"] body.wpg-auth {
    --wpg-auth-bg: #050508;
    --wpg-auth-bg-mesh:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59,130,246,.2), transparent),
        radial-gradient(ellipse 60% 40% at 100% 50%, rgba(6,182,212,.1), transparent),
        radial-gradient(ellipse 50% 30% at 0% 80%, rgba(139,92,246,.08), transparent),
        #050508;
    --wpg-auth-text: #fafafa;
    --wpg-auth-muted: #a1a1aa;
    --wpg-auth-label: #d4d4d8;
    --wpg-auth-icon: #71717a;
    --wpg-auth-placeholder: #71717a;
    --wpg-auth-border: rgba(255,255,255,.1);
    --wpg-auth-showcase-bg: rgba(255,255,255,.02);
    --wpg-auth-card-bg: rgba(255,255,255,.05);
    --wpg-auth-card-shadow: 0 28px 72px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
    --wpg-auth-input-bg: rgba(255,255,255,.06);
    --wpg-auth-input-bg-focus: rgba(255,255,255,.09);
    --wpg-auth-input-border: rgba(255,255,255,.1);
    --wpg-auth-link: #60a5fa;
    --wpg-auth-grid-line: rgba(255,255,255,.03);
}

/* ─── Light ─── */
html[data-wpg-theme="light"] body.wpg-auth {
    --wpg-auth-bg: #f4f6fb;
    --wpg-auth-bg-mesh: var(--wpg-bg-mesh);
    --wpg-auth-text: var(--wpg-text);
    --wpg-auth-muted: var(--wpg-text-muted);
    --wpg-auth-label: var(--wpg-text);
    --wpg-auth-icon: var(--wpg-text-soft);
    --wpg-auth-placeholder: var(--wpg-text-soft);
    --wpg-auth-border: var(--wpg-border-strong);
    --wpg-auth-showcase-bg: rgba(255,255,255,.55);
    --wpg-auth-card-bg: rgba(255,255,255,.88);
    --wpg-auth-card-shadow: var(--wpg-shadow-lg);
    --wpg-auth-input-bg: var(--wpg-surface);
    --wpg-auth-input-bg-focus: #fff;
    --wpg-auth-input-border: var(--wpg-border-strong);
    --wpg-auth-link: var(--wpg-accent);
    --wpg-auth-grid-line: rgba(15,23,42,.05);
}

html[data-wpg-theme="light"] .wpg-auth-showcase-title {
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

html[data-wpg-theme="light"] .wpg-auth-orb-1 { opacity: .35; }
html[data-wpg-theme="light"] .wpg-auth-orb-2 { opacity: .3; }
html[data-wpg-theme="light"] .wpg-auth-grid { opacity: .45; }

html[data-wpg-theme="light"] .wpg-auth-features i {
    background: rgba(59,130,246,.1);
    color: var(--wpg-accent);
}

html[data-wpg-theme="light"] .wpg-auth-chip {
    background: rgba(59,130,246,.08);
    border-color: rgba(59,130,246,.18);
    color: var(--wpg-accent);
}

html[data-wpg-theme="light"] .wpg-auth-promo {
    background: rgba(99,102,241,.1);
    border-color: rgba(99,102,241,.2);
    color: #6366f1;
}

/* Admin auth variant */
body.wpg-auth.wpg-auth-admin .wpg-auth-logo-icon {
    background: var(--wpg-admin-gradient);
    box-shadow: 0 10px 30px rgba(99,102,241,.4);
}

body.wpg-auth.wpg-auth-admin .wpg-auth-promo,
body.wpg-auth.wpg-auth-admin .wpg-auth-chip,
body.wpg-auth.wpg-auth-admin .wpg-auth-chip-accent {
    background: rgba(139,92,246,.14);
    border-color: rgba(139,92,246,.28);
    color: #c4b5fd;
}

body.wpg-auth.wpg-auth-admin .wpg-auth-orb-1 {
    background: rgba(99,102,241,.32);
}

body.wpg-auth.wpg-auth-admin .wpg-auth-orb-2 {
    background: rgba(139,92,246,.26);
}

body.wpg-auth.wpg-auth-admin .wpg-auth-features i {
    background: rgba(99,102,241,.18);
    color: #a5b4fc;
}

body.wpg-auth.wpg-auth-admin .wpg-auth-submit {
    background: var(--wpg-admin-gradient);
    box-shadow: 0 10px 32px rgba(99,102,241,.35);
}

body.wpg-auth.wpg-auth-admin .wpg-auth-submit:hover {
    box-shadow: 0 14px 40px rgba(99,102,241,.42);
}

/* OTP + captcha on auth pages */
.wpg-auth-captcha-row {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.wpg-auth-captcha-img {
    border: 1px solid var(--wpg-auth-border, rgba(255,255,255,.12));
    border-radius: .5rem;
    cursor: pointer;
    flex-shrink: 0;
}

.wpg-otp-wrap {
    margin: .5rem 0 1rem;
    position: relative;
}

.wpg-otp-autofill {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.wpg-auth-field-feedback {
    min-height: 1.25rem;
    margin-top: .35rem;
    font-size: .8rem;
    line-height: 1.4;
    color: var(--wpg-auth-muted, #a1a1aa);
}

.wpg-auth-field-feedback.is-error {
    color: #f87171;
}

.wpg-auth-field-feedback.is-checking {
    color: var(--wpg-auth-muted, #a1a1aa);
}

.wpg-otp-boxes .wpg-otp-digit {
    width: 2.5rem;
    height: 2.75rem;
    padding: 0;
    margin: 0 .2rem;
    border-radius: .5rem;
    font-size: 1.15rem;
    font-weight: 600;
    text-align: center;
    line-height: 2.75rem;
    font-family: var(--wpg-font, inherit);
}

.wpg-auth-otp-hint {
    font-size: .9rem;
    color: var(--wpg-auth-muted, #a1a1aa);
    margin-bottom: 1rem;
}

.wpg-auth-otp-actions .btn-link {
    font-size: .875rem;
    text-decoration: none;
}

@media (max-width: 575px) {
    .wpg-otp-boxes .wpg-otp-digit {
        width: 2.15rem;
        height: 2.5rem;
        line-height: 2.5rem;
        font-size: 1rem;
        margin: 0 .12rem;
    }
}

/* Legacy class aliases */
.wpg-auth-brand { display: none; }
.wpg-auth-wrap { display: contents; }
.wpg-auth-badge { display: none; }

/* ─── Responsive ─── */
@media (max-width: 991px) {
    .wpg-auth-shell {
        grid-template-columns: 1fr;
    }

    .wpg-auth-showcase {
        border-left: none;
        border-bottom: 1px solid var(--wpg-auth-border);
        padding: 2rem 1.5rem 1.5rem;
    }

    .wpg-auth-showcase-inner {
        max-width: 100%;
        text-align: center;
    }

    .wpg-auth-logo {
        margin-bottom: 1rem;
    }

    .wpg-auth-showcase-title {
        font-size: 1.45rem;
    }

    .wpg-auth-showcase-lead {
        font-size: .875rem;
        margin-bottom: 1rem;
    }

    .wpg-auth-features {
        display: none;
    }

    .wpg-auth-panel {
        padding: 1.5rem 1.25rem 2rem;
    }

    .wpg-auth-card {
        padding: 1.65rem 1.35rem 1.5rem;
    }
}

@media (max-width: 480px) {
    body.wpg-auth #wpgToastContainer {
        max-width: calc(100vw - 1.5rem);
    }

    .wpg-auth-theme {
        top: .75rem;
        left: .75rem;
    }
}
