/* مرکزِ ورود — دور ۵۹ (templates/auth/center.html). ظاهرِ پنجرهٔ ورودِ فست‌کارت، در یک صفحهٔ مستقل؛ روز و شب از
   تنظیمِ دستگاه. رنگِ اصلی رنگِ فروشگاه است (`--theme-accent` از «ظاهر») و بقیه از آن ساخته می‌شوند. */

:root {
    --auth-brand: var(--theme-accent, #0d8aff);
    --auth-brand-2: #0d8aff;
    --auth-brand-3: #3a86ff;
    --auth-success: #16a34a;
    --auth-success-2: #20c997;
    --auth-danger: #dc3545;
    --auth-bg: #eef2f8;
    --auth-card: #ffffff;
    --auth-surface: #f6f8fb;
    --auth-border: #e3e7ee;
    --auth-text: #1f2633;
    --auth-muted: #667085;
    --auth-faint: #98a2b3;
    --auth-ring: color-mix(in srgb, var(--auth-brand) 22%, transparent);
    --auth-shadow: 0 24px 64px rgba(15, 23, 42, .12), 0 0 120px color-mix(in srgb, var(--auth-brand) 12%, transparent);
    --auth-radius: 22px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --auth-bg: #0b1120;
        --auth-card: #121a2b;
        --auth-surface: #182236;
        --auth-border: #26324a;
        --auth-text: #e6eaf2;
        --auth-muted: #a3adc2;
        --auth-faint: #6b7690;
        --auth-shadow: 0 24px 64px rgba(0, 0, 0, .5), 0 0 120px color-mix(in srgb, var(--auth-brand) 10%, transparent);
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; min-height: 100dvh;
    font-family: 'AuthVazirmatn', Vazirmatn, Tahoma, sans-serif;
    font-feature-settings: 'ss01';
    background: var(--auth-bg); color: var(--auth-text);
    display: flex; align-items: center; justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    -webkit-tap-highlight-color: transparent;
}
svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
button { font: inherit; }
[hidden] { display: none !important; }

.ac-skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--auth-card); color: var(--auth-text); padding: 8px 14px; border-radius: 10px; z-index: 10; }
.ac-skip:focus { top: 12px; }

/* پس‌زمینهٔ آرام — سه لکهٔ رنگیِ محو، بی‌حرکت برای کسی که حرکت نمی‌خواهد */
.ac-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.ac-bg span { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(80px); opacity: .35; }
.ac-bg span:nth-child(1) { background: var(--auth-brand); top: -18vmax; inset-inline-end: -12vmax; }
.ac-bg span:nth-child(2) { background: var(--auth-brand-3); bottom: -22vmax; inset-inline-start: -14vmax; opacity: .25; }
.ac-bg span:nth-child(3) { background: var(--auth-success-2); top: 40%; inset-inline-start: 55%; width: 22vmax; height: 22vmax; opacity: .12; }
@media (prefers-color-scheme: dark) { .ac-bg span { opacity: .18; } }

.ac-shell { position: relative; z-index: 1; width: 100%; max-width: 440px; }

.ac-card {
    background: var(--auth-card); border-radius: var(--auth-radius); overflow: hidden;
    box-shadow: var(--auth-shadow); border: 1px solid color-mix(in srgb, var(--auth-border) 60%, transparent);
}

/* سرِ رنگی — همان سرِ پنجرهٔ فست‌کارت */
.ac-head {
    position: relative; overflow: hidden; color: #fff; text-align: center;
    padding: 30px 20px 44px;
    background: linear-gradient(135deg, var(--auth-brand) 0%, var(--auth-brand-2) 55%, var(--auth-brand-3) 100%);
}
.ac-head__glow {
    position: absolute; inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(255, 255, 255, .14) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 255, 255, .14) 0%, transparent 50%);
    animation: ac-float 15s ease-in-out infinite;
}
@keyframes ac-float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-10px, -10px); } }
.ac-head__text { position: relative; z-index: 1; }
.ac-title { margin: 0 0 6px; font-size: 1.45rem; font-weight: 800; text-shadow: 0 2px 10px rgba(0, 0, 0, .18); }
.ac-subtitle { margin: 0; font-size: .9rem; opacity: .92; }
.ac-back {
    position: absolute; top: 14px; inset-inline-start: 14px; z-index: 2;
    width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(255, 255, 255, .92); color: #253046; box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
    transition: transform .2s ease, background .2s ease;
}
.ac-back:hover { transform: scale(1.08); background: #fff; }
.ac-back:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.ac-body { position: relative; padding: 0 24px 22px; margin-top: -24px; }
.ac-logo-link { display: block; width: max-content; margin: 0 auto 18px; position: relative; z-index: 2; }
/* پلاکِ لوگو همیشه روشن است: لوگوی فروشگاه‌ها برای زمینهٔ روشن طراحی شده و در شب روی کارتِ تیره گم می‌شد. عرضِ
   صریح لازم است — SVGِ بی‌اندازه (لوگوی جانشین) با `width: auto` به صفر می‌رسید. */
.ac-logo {
    display: block; width: 168px; max-width: 60vw; height: 64px; object-fit: contain;
    padding: 10px 16px; border-radius: 16px; background: #fff; color: #1f2633;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
}

.ac-step { animation: ac-in .35s ease-out; }
@keyframes ac-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.ac-label { display: block; margin: 0 0 10px; font-weight: 700; font-size: .95rem; color: var(--auth-text); padding: 0; }
.ac-hint, .ac-lead { color: var(--auth-muted); font-size: .82rem; margin: 8px 0 0; line-height: 1.8; }
.ac-lead { margin: 0 0 16px; font-size: .9rem; }

.ac-input-group {
    display: flex; align-items: stretch; background: var(--auth-card);
    border: 2px solid var(--auth-border); border-radius: 14px; overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.ac-input-group:focus-within { border-color: var(--auth-brand); box-shadow: 0 0 0 4px var(--auth-ring); }
.ac-input-group.is-invalid { border-color: var(--auth-danger); }
.ac-input-prefix {
    display: grid; place-items: center; padding: 0 16px; color: var(--auth-muted);
    background: var(--auth-surface); border-inline-end: 2px solid var(--auth-border); font-size: 1.15rem;
}
.ac-input {
    flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--auth-text);
    font: inherit; font-size: 1.05rem; padding: 15px 16px;
}
.ac-input--mobile { font-size: 1.2rem; font-weight: 700; letter-spacing: .04em; text-align: left; }
.ac-input--mobile::placeholder { font-weight: 400; letter-spacing: 0; }
.ac-input--code { font-size: 1.5rem; font-weight: 800; letter-spacing: .5em; text-align: center; }
.ac-input--box {
    width: 100%; border: 2px solid var(--auth-border); border-radius: 12px; padding: 12px 14px; font-size: 1rem;
    background: var(--auth-card); transition: border-color .2s, box-shadow .2s;
}
.ac-input--box:focus { border-color: var(--auth-brand); box-shadow: 0 0 0 4px var(--auth-ring); }
.ac-input::placeholder { color: var(--auth-faint); }
.ac-eye { border: 0; background: transparent; color: var(--auth-muted); padding: 0 14px; cursor: pointer; font-size: 1.15rem; }
.ac-eye:hover { color: var(--auth-text); }
.ac-eye[aria-pressed="true"] { color: var(--auth-brand); }
.ac-eye:focus-visible { outline: 2px solid var(--auth-brand); outline-offset: -4px; border-radius: 10px; }
.ac-caps { color: #b45309; font-size: .8rem; margin: 6px 0 0; }
.ac-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.ac-row .ac-label { font-size: .85rem; margin-bottom: 6px; }
[data-step] > .ac-label + .ac-input-group + .ac-label,
[data-step] .ac-meter + .ac-label { margin-top: 14px; }
[data-profile-password] .ac-label { margin-top: 4px; }
.ac-hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* دکمه‌ها */
.ac-btn {
    width: 100%; margin-top: 18px; padding: 15px 18px; border: 0; border-radius: 14px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 1rem;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease, background .2s ease;
    touch-action: manipulation; user-select: none;
}
.ac-btn--primary { color: #fff; background: linear-gradient(135deg, var(--auth-brand) 0%, var(--auth-brand-2) 100%); }
.ac-btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 26px color-mix(in srgb, var(--auth-brand) 38%, transparent); }
.ac-btn--success { color: #fff; background: linear-gradient(135deg, var(--auth-success) 0%, var(--auth-success-2) 100%); }
.ac-btn--success:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(22, 163, 74, .35); }
.ac-btn--ghost { margin-top: 10px; color: var(--auth-text); background: var(--auth-surface); border: 1.5px solid var(--auth-border); }
.ac-btn--ghost:hover { border-color: var(--auth-brand); color: var(--auth-brand); }
.ac-btn:disabled { opacity: .55; cursor: not-allowed; }
.ac-btn:focus-visible { outline: 3px solid var(--auth-ring); outline-offset: 2px; }
.ac-btn.is-busy { pointer-events: none; }
.ac-btn.is-busy::after {
    content: ''; width: 18px; height: 18px; border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: ac-spin .8s linear infinite;
}

.ac-link {
    border: 0; background: none; padding: 6px 2px; cursor: pointer; color: var(--auth-brand);
    font-weight: 600; font-size: .88rem; text-decoration: none;
}
.ac-link:hover { text-decoration: underline; }
.ac-link:focus-visible { outline: 2px solid var(--auth-brand); outline-offset: 2px; border-radius: 6px; }
.ac-split { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-top: 14px; font-size: .88rem; color: var(--auth-muted); }
.ac-split:has(> :only-child) { justify-content: center; }
.ac-terms { text-align: center; color: var(--auth-muted); font-size: .78rem; margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--auth-border); line-height: 1.9; }
.ac-terms a { color: var(--auth-brand); text-decoration: none; font-weight: 600; }
.ac-terms a:hover { text-decoration: underline; }

/* کارتِ شماره در گامِ کد */
.ac-mobile-info {
    display: flex; align-items: center; gap: 12px; padding: 14px; margin-bottom: 22px;
    background: var(--auth-surface); border: 1px solid var(--auth-border); border-radius: 14px;
}
.ac-mobile-info__icon {
    width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff; font-size: 1.25rem;
    background: linear-gradient(135deg, var(--auth-brand) 0%, var(--auth-brand-2) 100%); flex: 0 0 auto;
}
.ac-mobile-info > div { flex: 1; min-width: 0; }
.ac-mobile-info__label { color: var(--auth-muted); font-size: .8rem; margin-bottom: 3px; }
.ac-mobile-info__number { font-weight: 800; font-size: 1.05rem; letter-spacing: .04em; text-align: right;
    direction: ltr; unicode-bidi: isolate-override; }   /* «۰۹۱۲ *** ۶۷۱۲» بی‌وارونگی؛ رقمِ فارسی خودش جهت ندارد */
.ac-mobile-info__number--text { letter-spacing: 0; font-size: .95rem; }
.ac-mobile-info__edit {
    width: 38px; height: 38px; border-radius: 11px; border: 1.5px solid var(--auth-border); background: var(--auth-card);
    color: var(--auth-muted); cursor: pointer; display: grid; place-items: center;
}
.ac-mobile-info__edit:hover { color: var(--auth-brand); border-color: var(--auth-brand); }

/* شش خانهٔ کد — یک کادرِ واقعی زیرِ شش خانهٔ نمایشی؛ پرکردنِ خودکار، چسباندن و صفحه‌خوان همه با همان یک کادر */
.ac-otp-wrap { border: 0; margin: 0; padding: 0; min-width: 0; }
.ac-otp-wrap legend { float: none; width: 100%; }
.ac-otp { position: relative; }
.ac-otp__real {
    position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; z-index: 2;
    font-size: 16px; color: transparent; caret-color: transparent; letter-spacing: 3em; border: 0; outline: 0; background: transparent;
}
.ac-otp__cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.ac-otp__cell {
    height: 62px; border-radius: 13px; border: 2px solid var(--auth-border); background: var(--auth-card);
    display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; color: var(--auth-text);
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.ac-otp__cell.is-filled {
    border-color: var(--auth-brand);
    background: linear-gradient(135deg, color-mix(in srgb, var(--auth-brand) 7%, transparent), color-mix(in srgb, var(--auth-brand-2) 7%, transparent));
}
.ac-otp.is-focused .ac-otp__cell.is-active { border-color: var(--auth-brand); box-shadow: 0 0 0 4px var(--auth-ring); transform: translateY(-2px); }
.ac-otp.is-focused .ac-otp__cell.is-active:empty::after { content: ''; width: 2px; height: 28px; background: var(--auth-brand); animation: ac-caret 1s step-end infinite; }
@keyframes ac-caret { 50% { opacity: 0; } }
.ac-otp.is-error .ac-otp__cell { border-color: var(--auth-danger); animation: ac-shake .45s; }
.ac-otp.is-done .ac-otp__cell { border-color: var(--auth-success); }
@keyframes ac-shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.ac-autofill { display: flex; align-items: center; gap: 6px; color: var(--auth-success); font-size: .82rem; margin: 10px 0 0; justify-content: center; }

.ac-timer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; min-height: 40px; }
.ac-timer { display: flex; align-items: center; gap: 6px; color: var(--auth-danger); font-weight: 700; font-size: .88rem; }
.ac-timer__tail { color: var(--auth-muted); font-weight: 500; }
.ac-resend {
    display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer;
    color: var(--auth-brand); font-weight: 700; font-size: .9rem; padding: 8px 0;
}
.ac-resend:hover { text-decoration: underline; }
.ac-change-number { text-align: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--auth-border); }
.ac-change-number .ac-link { color: var(--auth-muted); font-weight: 500; }
.ac-change-number .ac-link:hover { color: var(--auth-brand); }

.ac-who [data-identity] { direction: ltr; unicode-bidi: isolate-override; }
.ac-who {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; margin-bottom: 16px;
    background: var(--auth-surface); border: 1px solid var(--auth-border); border-radius: 12px; font-weight: 700;
}

/* قدرتِ رمز */
.ac-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.ac-meter i { height: 5px; border-radius: 3px; background: var(--auth-border); transition: background .2s; }
.ac-meter[data-score="1"] i:nth-child(-n+1) { background: var(--auth-danger); }
.ac-meter[data-score="2"] i:nth-child(-n+2) { background: #f59e0b; }
.ac-meter[data-score="3"] i:nth-child(-n+3) { background: #84cc16; }
.ac-meter[data-score="4"] i { background: var(--auth-success); }

.ac-details { margin-top: 12px; }
.ac-details summary { cursor: pointer; color: var(--auth-brand); font-size: .86rem; font-weight: 600; padding: 4px 0; }
.ac-details[open] summary { margin-bottom: 8px; }

/* پیام‌ها */
.ac-alert {
    display: flex; gap: 8px; align-items: flex-start; margin-bottom: 16px; padding: 12px 14px; border-radius: 12px;
    font-size: .88rem; line-height: 1.8; border: 1px solid; animation: ac-in .25s ease-out;
}
.ac-alert--error { color: #b42318; background: #fef3f2; border-color: #fecdca; }
.ac-alert--info { color: #175cd3; background: #eff8ff; border-color: #b2ddff; }
.ac-alert--success { color: #067647; background: #ecfdf3; border-color: #abefc6; }
@media (prefers-color-scheme: dark) {
    .ac-alert--error { color: #fda29b; background: rgba(217, 45, 32, .12); border-color: rgba(217, 45, 32, .35); }
    .ac-alert--info { color: #84caff; background: rgba(46, 144, 250, .12); border-color: rgba(46, 144, 250, .35); }
    .ac-alert--success { color: #75e0a7; background: rgba(23, 178, 106, .12); border-color: rgba(23, 178, 106, .35); }
}
.ac-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; background: #fffaeb; color: #93370d; font-size: .82rem; border: 1px solid #fedf89; }
@media (prefers-color-scheme: dark) { .ac-note { background: rgba(247, 144, 9, .12); color: #fec84b; border-color: rgba(247, 144, 9, .35); } }

.ac-loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 36px 0; color: var(--auth-muted); font-size: .9rem; }
.ac-spinner { width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--auth-border); border-top-color: var(--auth-brand); animation: ac-spin 1s linear infinite; }
@keyframes ac-spin { to { transform: rotate(360deg); } }

.ac-foot { padding: 14px 20px; background: var(--auth-surface); border-top: 1px solid var(--auth-border); text-align: center; }
.ac-secure { display: inline-flex; align-items: center; gap: 6px; color: var(--auth-muted); font-size: .76rem; }
.ac-noscript { text-align: center; color: var(--auth-danger); }

input:focus-visible { outline: none; }

/* موبایل: تمام‌صفحه مثلِ اپلیکیشن، دکمه در دسترسِ شست */
@media (max-width: 520px) {
    body { padding: 0; align-items: stretch; background: var(--auth-card); }
    .ac-bg { display: none; }
    .ac-shell { max-width: none; }
    .ac-card { min-height: 100vh; min-height: 100dvh; border-radius: 0; border: 0; box-shadow: none; display: flex; flex-direction: column; }
    .ac-head { padding: calc(26px + env(safe-area-inset-top)) 18px 40px; }
    .ac-body { flex: 1; padding: 0 18px 18px; }
    .ac-otp__cells { gap: 8px; }
    .ac-otp__cell { height: 56px; font-size: 1.4rem; }
    .ac-title { font-size: 1.25rem; }
    .ac-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}
@media (max-width: 360px) { .ac-otp__cell { height: 50px; } .ac-row { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* شب: رنگِ فروشگاه معمولاً برای زمینهٔ روشن انتخاب شده؛ پیوندها و برچسب‌های رنگی روی کارتِ تیره روشن‌تر می‌شوند
   تا کنتراست به حدِ خواندن (WCAG AA) برسد. دکمه‌ها زمینهٔ خودشان را دارند و دست نمی‌خورند. */
@media (prefers-color-scheme: dark) {
    :root { --auth-ink-brand: color-mix(in srgb, var(--auth-brand) 45%, #ffffff); }
    .ac-link, .ac-terms a, .ac-resend, .ac-details summary { color: var(--auth-ink-brand); }
    .ac-input-group:focus-within, .ac-input--box:focus { border-color: var(--auth-ink-brand); }
    .ac-otp__cell.is-filled, .ac-otp.is-focused .ac-otp__cell.is-active { border-color: var(--auth-ink-brand); }
    .ac-otp.is-focused .ac-otp__cell.is-active:empty::after { background: var(--auth-ink-brand); }
    .ac-eye[aria-pressed="true"] { color: var(--auth-ink-brand); }
}

/* ── دور ۸۱: درونِ پنجرهٔ ورودِ قالب (`?embed=1`) ─────────────────────────
   پنجرهٔ میزبان (`_shared/css/auth-entry.css`) قاب، سایه و گوشه را دارد؛ اینجا فقط کارت می‌ماند، بی حاشیه و
   بی کمینهٔ ارتفاعِ صفحه — ارتفاعِ قاب را خودِ کارت تعیین می‌کند (`center.js`، پیامِ `auth-entry:height`). */
.ac-embed body { min-height: 0; padding: 0; display: block; background: var(--auth-card); }
.ac-embed .ac-shell { max-width: none; }
.ac-embed .ac-card { min-height: 0; border: 0; border-radius: 0; box-shadow: none; display: block; }
.ac-embed .ac-head { padding-top: 26px; }
