/* ================================================================================================
   AUTH.CSS: the few rules the customer sign-in screens need that store.css does not have.
   Loaded only by the storefront auth views and the account security views (customer-auth
   overhaul, DESIGN.md F.0). Colours and type come from the tokens in site.css / store.css (--brand,
   --green, --gold, --danger, --ink, --ink-soft, --line, --brand-tint); nothing new is declared.
   Logical properties only, so every screen mirrors under dir="rtl" with no override section.
   Helper and error text use --ink-soft / --danger (not --ink-faint) to keep 4.5:1 contrast.
   ================================================================================================ */

/* The testing-mode / info notice (the gold tint the old login page carried inline). */
.alert-info { background: color-mix(in oklch, var(--gold) 14%, white 86%); color: color-mix(in oklch, var(--gold) 50%, black 50%); border: 1px solid color-mix(in oklch, var(--gold) 35%, transparent); }
.alert-info code { background: rgba(0, 0, 0, 0.08); padding: 2px 7px; border-radius: 5px; font-weight: 700; }

.auth-head { margin-bottom: 20px; }
.auth-head h1 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); color: var(--brand); font-weight: 800; }
.auth-head p { margin-top: 5px; color: var(--ink-soft); font-size: 0.87rem; line-height: 1.55; }

.auth-form .field + .field,
.auth-form .field + .field-check,
.auth-form .field-check + .btn { margin-top: 14px; }
.auth-form .btn { margin-top: 18px; }
.auth-form .field-check { min-height: 44px; }
.auth-form .field-check input { flex: none; }

.field .field-help { font-size: 0.78rem; line-height: 1.5; color: var(--ink-soft); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field input[type="text"], .field input[type="password"], .field input[type="email"], .field input[type="tel"] { width: 100%; }

/* Email, phone, code and password stay left-to-right in Arabic, aligned to the reading start. */
.field input[dir="ltr"] { text-align: start; }
[dir="rtl"] .field input[dir="ltr"] { text-align: right; }

/* The 6-digit field: one input, wide letter-spacing, centred. */
.code-input { letter-spacing: 0.4em; font-weight: 800; text-align: center !important; font-size: 1.1rem; }

/* Password field with the show/hide button inside it. */
.pw-wrap { position: relative; }
.pw-wrap input { padding-inline-end: 76px; }
.pw-toggle { position: absolute; inset-block: 0; inset-inline-end: 0; min-width: 64px; min-height: 44px; padding-inline: 12px; border: 0; background: none; color: var(--brand); font: inherit; font-size: 0.8rem; font-weight: 800; cursor: pointer; border-radius: 9px; }
.pw-toggle:hover { text-decoration: underline; }
.pw-toggle:focus-visible { outline: 3px solid color-mix(in oklch, var(--brand) 45%, white 55%); outline-offset: -3px; }

/* The secondary link row under a form. */
.auth-alt { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 10px; font-size: 0.84rem; line-height: 1.55; color: var(--ink-soft); }
.auth-alt a { color: var(--brand); font-weight: 700; }
.auth-alt a:hover { text-decoration: underline; }
.auth-alt .auth-note { color: var(--ink-soft); font-size: 0.8rem; }

.auth-signout { margin-top: 14px; text-align: center; }
.auth-signout button { background: none; border: 0; padding: 10px 14px; min-height: 44px; font: inherit; font-size: 0.84rem; font-weight: 700; color: var(--brand); cursor: pointer; }
.auth-signout button:hover { text-decoration: underline; }

.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.7; cursor: progress; }

@media (max-width: 560px) {
    .field input { font-size: 1rem; } /* 16px: stops iOS zooming into the field */
}

@media (prefers-reduced-motion: reduce) {
    .alert { animation: none; }
}
@media (prefers-reduced-motion: no-preference) {
    .alert { animation: auth-fade 150ms ease-out; }
    @keyframes auth-fade { from { opacity: 0; } to { opacity: 1; } }
}

/* ================================================================================================
   S4: 2-step verification screens (DESIGN.md F.3, F.4, F.5). Appended to auth.css. Same tokens,
   logical properties only, so everything mirrors under dir="rtl".
   ================================================================================================ */

/* A button that reads as a link (resend, "send by email instead", cancel). 44px target. */
.link-btn { background: none; border: 0; padding: 10px 2px; min-height: 44px; font: inherit; font-size: 0.84rem; font-weight: 700; color: var(--brand); cursor: pointer; text-align: start; }
.link-btn:hover:not(:disabled) { text-decoration: underline; }
.link-btn:disabled { color: var(--ink-soft); cursor: not-allowed; opacity: 0.8; }
.link-btn:focus-visible { outline: 3px solid color-mix(in oklch, var(--brand) 45%, white 55%); outline-offset: 2px; border-radius: 6px; }
.link-btn.is-danger { color: var(--danger); }

.auth-actions { display: grid; gap: 2px; }
.auth-actions form { margin: 0; }
.resend-note { display: block; font-size: 0.79rem; color: var(--ink-soft); line-height: 1.5; }
.resend-note[hidden] { display: none; }

/* The "where did the code go" line. */
.code-sent { margin: 0 0 14px; font-size: 0.9rem; line-height: 1.6; color: var(--ink); }
.code-sent bdi { font-weight: 800; }
.tries-left { margin-top: 6px; font-size: 0.79rem; color: var(--ink-soft); }

/* A radio card for a 2-step method. Selected = brand border + tint, never a side stripe. */
.method-list { display: grid; gap: 10px; margin: 14px 0 4px; padding: 0; border: 0; min-width: 0; }
.method-list legend { font-size: 0.84rem; font-weight: 800; color: var(--ink); padding: 0; margin-bottom: 2px; }
.method-row { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; min-height: 44px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; transition: border-color 150ms ease, background 150ms ease; }
.method-row:hover { border-color: color-mix(in oklch, var(--brand) 45%, white 55%); }
.method-row input { flex: none; margin-top: 3px; width: 18px; height: 18px; accent-color: var(--brand); }
.method-row .m-name { display: block; font-size: 0.9rem; font-weight: 800; color: var(--ink); }
.method-row .m-desc { display: block; margin-top: 2px; font-size: 0.79rem; color: var(--ink-soft); line-height: 1.5; }
.method-row:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.method-row:has(input:focus-visible) { outline: 3px solid color-mix(in oklch, var(--brand) 45%, white 55%); outline-offset: 2px; }

/* Security page blocks. */
.sec-block h2 { font-size: 1rem; font-weight: 800; color: var(--ink); margin: 0; }
.sec-block .sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.sec-block p { font-size: 0.86rem; line-height: 1.6; color: var(--ink-soft); margin: 0 0 12px; }
.sec-block .sec-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 4px; }
.sec-block .btn { margin-top: 0; }
.sec-block .alert { margin: 0 0 14px; }
.sec-block details { margin-top: 10px; }
.sec-block summary { min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; font-size: 0.84rem; font-weight: 700; color: var(--brand); list-style: none; }
.sec-block summary::-webkit-details-marker { display: none; }
.sec-block summary:hover { text-decoration: underline; }
.sec-block summary.is-danger { color: var(--danger); }
.sec-block details[open] > summary { margin-bottom: 6px; }
.sec-block .dest { font-weight: 800; color: var(--ink); }
.btn-danger-quiet { background: #fff; color: var(--danger); border: 1.5px solid color-mix(in oklch, var(--danger) 45%, white 55%); }
.btn-danger-quiet:hover:not(:disabled) { background: var(--danger-tint); }

/* The one-time prompt. */
.prompt-ic { width: 56px; height: 56px; border-radius: 50%; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; margin: 0 0 14px; }
.prompt-ic svg { width: 28px; height: 28px; }
.prompt-skip { margin-top: 6px; text-align: center; }
.prompt-note { margin-top: 14px; font-size: 0.79rem; color: var(--ink-soft); text-align: center; }

@media (max-width: 560px) {
    .sec-block .sec-actions .btn { width: 100%; }
}
