/* accounts/static/accounts/css/auth.css — every sign-in, sign-up, verification and password page.
   Bootstrap 5 variables (light + dark theme) and logical properties (inline-start/end): RTL needs no overrides. */

.auth-page {
    --auth-radius: 1rem;
    --auth-accent: var(--bs-primary, #066ac9);
    --auth-accent-soft: color-mix(in srgb, var(--auth-accent) 12%, transparent);
    /* the theme's --bs-secondary-color is #cfd3d7 (too light for text); body text is its muted tone */
    --auth-muted: var(--bs-body-color, #747579);
    padding-block: clamp(1.25rem, 4vw, 3.5rem);
    min-height: calc(100vh - 80px);
    background:
        radial-gradient(60rem 30rem at 0% 0%, color-mix(in srgb, var(--auth-accent) 7%, transparent), transparent 60%),
        radial-gradient(50rem 30rem at 100% 100%, color-mix(in srgb, var(--auth-accent) 5%, transparent), transparent 60%);
}
.auth-page .container { padding-inline: 16px; }

/* ---------- Layout: form panel + brand panel (lg+) ---------- */
.auth-shell { display: grid; gap: 1.5rem; max-width: 1080px; margin-inline: auto; align-items: stretch; }
@media (min-width: 992px) {
    .auth-shell { grid-template-columns: minmax(0, 470px) minmax(0, 1fr); gap: 2rem; }
    .auth-shell.auth-shell--single { grid-template-columns: minmax(0, 520px); justify-content: center; }
}
/* padding: 0 — the theme pads every <section> (style.css) */
.auth-panel { border-radius: var(--auth-radius); background: var(--bs-body-bg); width: 100%; max-width: 520px; margin-inline: auto;
    padding: 0; }
.auth-panel-body { padding: clamp(1.25rem, 4vw, 2.25rem); }
.auth-panel-foot {
    padding: 1rem clamp(1.25rem, 4vw, 2.25rem); border-top: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, .08));
    text-align: center; font-size: .925rem; color: var(--auth-muted);
}
.auth-panel-foot a { font-weight: 600; text-decoration: none; }

.auth-icon {
    width: 3.25rem; height: 3.25rem; border-radius: .9rem; display: inline-flex; align-items: center; justify-content: center;
    background: var(--auth-accent-soft); color: var(--auth-accent); font-size: 1.5rem; margin-block-end: 1rem;
}
.auth-icon--success { background: color-mix(in srgb, var(--bs-success, #198754) 14%, transparent); color: var(--bs-success, #198754); }
.auth-icon--danger { background: color-mix(in srgb, var(--bs-danger, #dc3545) 14%, transparent); color: var(--bs-danger, #dc3545); }
.auth-icon--warning { background: color-mix(in srgb, var(--bs-warning, #ffc107) 20%, transparent); color: #b78103; }
.auth-title { font-size: clamp(1.35rem, 3.5vw, 1.65rem); font-weight: 700; margin-block-end: .35rem; line-height: 1.3; }
.auth-lead { color: var(--auth-muted); margin-block-end: 1.5rem; }
.auth-lead strong { color: var(--bs-body-color); }

/* Brand panel */
.auth-aside {
    position: relative; overflow: hidden; border-radius: var(--auth-radius); color: #fff; padding: 2.5rem;
    background: linear-gradient(150deg, var(--auth-accent), color-mix(in srgb, var(--auth-accent) 55%, #0b1b3a));
    flex-direction: column; justify-content: space-between; gap: 2rem; min-height: 100%;
}
.auth-aside::before, .auth-aside::after {
    content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .08); pointer-events: none;
}
.auth-aside::before { width: 22rem; height: 22rem; inset-block-start: -8rem; inset-inline-end: -7rem; }
.auth-aside::after { width: 14rem; height: 14rem; inset-block-end: -5rem; inset-inline-start: -4rem; }
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.35; color: #fff; }
.auth-aside p { color: rgba(255, 255, 255, .85); }
.auth-benefits { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.auth-benefits li { display: flex; gap: .85rem; align-items: flex-start; }
.auth-benefits i {
    flex-shrink: 0; width: 2.25rem; height: 2.25rem; border-radius: .65rem; display: inline-flex; align-items: center;
    justify-content: center; background: rgba(255, 255, 255, .16); font-size: 1.1rem;
}
.auth-benefits strong { display: block; color: #fff; }
.auth-benefits span { font-size: .875rem; color: rgba(255, 255, 255, .8); }
.auth-trust { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .8rem; color: rgba(255, 255, 255, .85); }
.auth-trust i { margin-inline-end: .3rem; }

/* ---------- Segmented control (Email | Phone, Password | Code) ---------- */
.auth-segment {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .25rem; padding: .25rem; margin-block-end: 1.25rem;
    border-radius: .75rem; background: color-mix(in srgb, var(--bs-body-color, #747579) 11%, var(--bs-body-bg, #fff));
}
.auth-segment button {
    border: 0; background: transparent; border-radius: .55rem; padding: .55rem .75rem; font-weight: 600; font-size: .925rem;
    color: var(--auth-muted); display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.auth-segment button:hover { color: var(--bs-body-color); }
.auth-segment button[aria-selected="true"] {
    background: var(--bs-body-bg); color: var(--auth-accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}
.auth-segment button:focus-visible { outline: 2px solid var(--auth-accent); outline-offset: 1px; }

/* ---------- Fields ---------- */
.auth-field { margin-block-end: 1rem; }
.auth-field > label, .auth-label-row label { font-weight: 600; font-size: .9rem; margin-block-end: .4rem; display: block; }
.auth-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.auth-label-row a { font-size: .85rem; text-decoration: none; }
.auth-input { position: relative; }
.auth-input > .bi:first-child {
    position: absolute; inset-inline-start: .95rem; inset-block-start: 50%; transform: translateY(-50%);
    color: var(--auth-muted); pointer-events: none; font-size: 1.05rem;
}
/* Input paddings use PHYSICAL sides chosen by the page direction: the icon and buttons sit on the page's
   start/end, but email/phone/password inputs are direction:ltr (.auth-ltr), where padding-inline-* would
   point the other way in fa/ar and the text would run under the icon. */
.auth-input .form-control {
    min-height: 3rem; border-radius: .7rem; padding-left: 2.75rem; padding-right: .9rem; font-size: 1rem;
    background-color: var(--bs-body-bg);
}
[dir="rtl"] .auth-input .form-control { padding-right: 2.75rem; padding-left: .9rem; }
.auth-input .form-control:focus {
    border-color: color-mix(in srgb, var(--auth-accent) 60%, transparent);
    box-shadow: 0 0 0 .22rem color-mix(in srgb, var(--auth-accent) 16%, transparent);
}
.auth-input.has-action .form-control { padding-right: 3rem; }
[dir="rtl"] .auth-input.has-action .form-control { padding-left: 3rem; padding-right: 2.75rem; }
.auth-input-action {
    position: absolute; inset-inline-end: .35rem; inset-block-start: 50%; transform: translateY(-50%); border: 0; background: none;
    width: 2.4rem; height: 2.4rem; border-radius: .5rem; color: var(--auth-muted); font-size: 1.1rem;
}
.auth-input-action:hover, .auth-input-action:focus-visible { color: var(--auth-accent); background: var(--auth-accent-soft); }
.auth-input .btn-inline {
    position: absolute; inset-inline-end: .35rem; inset-block-start: 50%; transform: translateY(-50%);
    border-radius: .5rem; font-size: .85rem; font-weight: 600; padding: .4rem .75rem;
}
.auth-input.has-inline-btn .form-control { padding-right: 8.5rem; }
[dir="rtl"] .auth-input.has-inline-btn .form-control { padding-left: 8.5rem; padding-right: 2.75rem; }
/* Phones, emails and codes are typed left-to-right in every language; the placeholder follows the page */
.auth-ltr { direction: ltr; text-align: start; }
[dir="rtl"] .auth-ltr { text-align: end; }
[dir="rtl"] .auth-ltr:placeholder-shown { direction: rtl; text-align: start; }
.auth-field .invalid-feedback, .auth-hint { font-size: .825rem; margin-block-start: .35rem; }
.auth-hint { color: var(--auth-muted); }
.auth-field.is-invalid .form-control { border-color: var(--bs-danger, #dc3545); }
.auth-field.is-invalid .invalid-feedback { display: block; }
.auth-hp { position: absolute !important; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* One-time code */
.auth-otp {
    min-height: 3.6rem; text-align: center !important; font-size: 1.6rem; font-weight: 700; letter-spacing: .55em;
    padding-inline: 1rem 0.45rem !important; border-radius: .8rem; font-variant-numeric: tabular-nums; direction: ltr;
}
.auth-otp::placeholder { letter-spacing: .35em; color: color-mix(in srgb, var(--auth-muted) 55%, transparent); }
.auth-resend { display: flex; justify-content: center; align-items: center; gap: .35rem; font-size: .9rem;
    color: var(--auth-muted); margin-block: 1rem .25rem; flex-wrap: wrap; }
.auth-resend button { border: 0; background: none; padding: 0; color: var(--auth-accent); font-weight: 600; }
.auth-resend button:disabled { color: var(--auth-muted); cursor: default; }
.auth-contact-chip {
    display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border-radius: 2rem;
    background: var(--bs-tertiary-bg, #f1f3f5); font-weight: 600; font-size: .9rem; direction: ltr; unicode-bidi: isolate;
}

/* Password strength */
.auth-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; margin-block-start: .6rem; }
.auth-meter span { height: .3rem; border-radius: 1rem; background: var(--bs-border-color, #dee2e6); transition: background .2s ease; }
.auth-meter[data-level="1"] span:nth-child(-n+1) { background: var(--bs-danger, #dc3545); }
.auth-meter[data-level="2"] span:nth-child(-n+2) { background: #fd7e14; }
.auth-meter[data-level="3"] span:nth-child(-n+3) { background: #20c997; }
.auth-meter[data-level="4"] span { background: var(--bs-success, #198754); }
.auth-rules { list-style: none; padding: 0; margin: .55rem 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .2rem .75rem; font-size: .8rem; color: var(--auth-muted); }
.auth-rules li { display: flex; align-items: center; gap: .35rem; }
.auth-rules li::before { content: '\F28A'; font-family: 'bootstrap-icons'; font-size: .7rem; }
.auth-rules li.ok { color: var(--bs-success, #198754); }
.auth-rules li.ok::before { content: '\F26E'; font-size: .9rem; }
@media (max-width: 380px) { .auth-rules { grid-template-columns: 1fr; } }

/* Checkboxes */
.auth-check { display: flex; gap: .6rem; align-items: flex-start; margin-block-end: .75rem; font-size: .9rem; }
.auth-check .form-check-input { flex-shrink: 0; margin: .15rem 0 0; width: 1.15rem; height: 1.15rem; }
.auth-check label { color: var(--auth-muted); }
.auth-check a { font-weight: 600; text-decoration: none; }

/* Buttons */
.auth-submit { min-height: 3rem; border-radius: .7rem; font-weight: 600; display: inline-flex; align-items: center;
    justify-content: center; gap: .5rem; }
.auth-submit .spinner-border { width: 1.1rem; height: 1.1rem; border-width: .15em; }
.auth-submit[aria-busy="true"] { pointer-events: none; opacity: .85; }
.auth-alt { display: grid; gap: .6rem; }
.auth-alt .btn { min-height: 2.9rem; border-radius: .7rem; font-weight: 600; display: inline-flex; align-items: center;
    justify-content: center; gap: .55rem; }
.auth-divider { display: flex; align-items: center; gap: .85rem; color: var(--auth-muted); font-size: .85rem;
    margin-block: 1.35rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--bs-border-color, #dee2e6); }
.auth-back { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; text-decoration: none; font-weight: 600; }
/* glyph flip only (core/css/l10n.css already mirrors arrows/chevrons; same property, never stacks) */
[dir="rtl"] :is(.auth-back .bi-arrow-left, .auth-flip)::before { display: inline-block; transform: scaleX(-1); }
/* Site-wide, static/js/rtl.js mirrors arrows/chevrons inline AND static/css/rtl.css mirrors their ::before, which
   cancels out. Mirror them once here: the element (auth-flip / rtl.js), never the glyph. */
.rtl .auth-page :is(.bi-arrow-left, .bi-arrow-right, .bi-chevron-left, .bi-chevron-right)::before { transform: none; }

/* Alerts inside the panel */
.auth-alert { border-radius: .7rem; font-size: .9rem; display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem;
    margin-block-end: 1rem; }
.auth-alert i { font-size: 1.05rem; line-height: 1.3; }
.auth-alert[hidden] { display: none; }

/* Status pages (sent, done, expired) */
.auth-steps { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: .75rem; }
.auth-steps li { display: flex; gap: .75rem; align-items: flex-start; font-size: .925rem; }
.auth-steps .num {
    flex-shrink: 0; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--auth-accent-soft); color: var(--auth-accent);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem;
}
.auth-note { border-radius: .75rem; background: var(--bs-tertiary-bg, #f8f9fa); padding: .9rem 1rem; font-size: .875rem;
    color: var(--auth-muted); display: flex; gap: .6rem; }
.auth-note i { color: var(--auth-accent); }
.auth-help { color: var(--auth-muted); margin-block-start: 1.5rem; }
.auth-help a { color: inherit; text-decoration: none; margin-inline: .35rem; }
.auth-help a:hover { color: var(--auth-accent); }

[data-step][hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { .auth-page * { transition: none !important; } }
.auth-page .text-body-secondary { color: var(--auth-muted) !important; }

/* ---------- Two-step verification ---------- */
@media (min-width: 992px) { .auth-shell.auth-shell--wide { grid-template-columns: minmax(0, 680px); } }
.auth-shell--wide .auth-panel { max-width: 680px; }
.auth-ltr-text { direction: ltr; unicode-bidi: isolate; }
.auth-status { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .85rem; margin-block-end: 1.25rem;
    color: var(--auth-muted); font-size: .9rem; }
.auth-status-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .8rem; border-radius: 2rem;
    font-weight: 700; font-size: .85rem; }
.auth-status-badge.is-on { background: color-mix(in srgb, var(--bs-success, #198754) 14%, transparent); color: var(--bs-success, #198754); }
.auth-block { border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .85rem; padding: 1.1rem; margin-block-end: 1rem; }
.auth-block--danger { border-color: color-mix(in srgb, var(--bs-danger, #dc3545) 35%, var(--bs-border-color, #dee2e6)); }
.auth-block-title { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; margin-block-end: .35rem; }
.auth-block-title i { color: var(--auth-accent); }
.auth-block--danger .auth-block-title i { color: var(--bs-danger, #dc3545); }
.auth-block-text { color: var(--auth-muted); font-size: .9rem; margin-block-end: .9rem; }
.auth-qr { width: min(220px, 70vw); margin: 0 auto 1rem; padding: .75rem; background: #fff; border-radius: .85rem;
    border: 1px solid var(--bs-border-color, #dee2e6); }
.auth-qr svg { display: block; width: 100%; height: auto; }
.auth-key { margin-block-end: 1.25rem; font-size: .9rem; }
.auth-key summary { cursor: pointer; color: var(--auth-accent); font-weight: 600; text-align: center; }
.auth-key dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .4rem 1rem; margin: .85rem 0 0; padding: .9rem 1rem;
    border-radius: .75rem; background: var(--bs-tertiary-bg, #f8f9fa); }
.auth-key dt { font-weight: 600; color: var(--auth-muted); }
.auth-key dd { margin: 0; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; }
.auth-key-value { direction: ltr; font-size: .95rem; font-weight: 700; letter-spacing: .04em; color: var(--bs-body-color); }
.auth-recovery-input { min-height: 3rem; border-radius: .7rem; direction: ltr; text-align: center; font-size: 1.25rem;
    letter-spacing: .15em; font-family: var(--bs-font-monospace, monospace); }
.auth-codes { list-style: none; padding: 1rem; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem 1rem; border-radius: .85rem; background: var(--bs-tertiary-bg, #f8f9fa); border: 1px dashed var(--bs-border-color, #dee2e6);
    direction: ltr; }
.auth-codes code { font-size: 1.05rem; font-weight: 700; color: var(--bs-body-color); letter-spacing: .06em; }
.auth-codes li { text-align: center; }
.auth-codes-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.auth-codes-actions .btn { border-radius: .7rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    font-weight: 600; font-size: .9rem; min-height: 2.75rem; }
@media (max-width: 360px) { .auth-codes { grid-template-columns: 1fr; } }

/* ---------- Active sessions ---------- */
.auth-sessions { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.auth-session { display: flex; gap: .9rem; align-items: flex-start; padding: 1rem; border-radius: .85rem;
    border: 1px solid var(--bs-border-color, #dee2e6); }
.auth-session.is-current { border-color: color-mix(in srgb, var(--auth-accent) 45%, transparent); background: var(--auth-accent-soft); }
.auth-session-icon { flex-shrink: 0; width: 2.6rem; height: 2.6rem; border-radius: .75rem; display: inline-flex; align-items: center;
    justify-content: center; font-size: 1.25rem; background: var(--auth-accent-soft); color: var(--auth-accent); }
.auth-session.is-current .auth-session-icon { background: var(--bs-body-bg); }
.auth-session-body { flex: 1; min-width: 0; }
.auth-session-title { font-weight: 700; color: var(--bs-heading-color, var(--bs-emphasis-color)); display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; }
.auth-session-badge { font-size: .75rem; font-weight: 700; padding: .15rem .55rem; border-radius: 2rem;
    background: var(--auth-accent); color: #fff; }
.auth-session-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-block-start: .3rem; font-size: .825rem; color: var(--auth-muted); }
.auth-session-meta i { margin-inline-end: .3rem; }
.auth-session-action { flex-shrink: 0; align-self: center; }
.auth-session-action .btn { border-radius: .6rem; font-weight: 600; min-height: 2.25rem; }
@media (max-width: 575.98px) {
    .auth-session { flex-wrap: wrap; }
    .auth-session-action { flex-basis: 100%; }
    .auth-session-action .btn { width: 100%; }
}
.auth-callout { display: flex; align-items: center; gap: .85rem; padding: 1rem; border-radius: .85rem; text-decoration: none;
    background: var(--auth-accent-soft); color: var(--bs-body-color); font-size: .9rem; }
.auth-callout > .bi:first-child { font-size: 1.4rem; color: var(--auth-accent); }
.auth-callout span { flex: 1; color: var(--auth-muted); }
.auth-callout strong { display: block; color: var(--bs-body-color); }
.auth-panel-foot--links { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.5rem; }

@media print {
    header, footer, .navbar, .auth-help, .auth-codes-actions, .auth-note, .auth-panel .btn, .auth-panel-foot { display: none !important; }
    .auth-page { background: none; padding: 0; }
    .auth-panel { box-shadow: none !important; }
}
