/* =============================================================================
   auth-theme.css — dark mode + right-to-left for the sign-in pages.

   Loaded LAST on Login, forgot / change password, choose-2fa, verify-2fa and the
   company step (verify-login). The theme class and html[dir] are set by
   assets/js/auth-prefs.js before first paint.

   Same look: the light theme is untouched apart from RTL mirroring. Dark mode
   completes the `body.dark-mode` block that login.css already had (card, inputs,
   labels) — the backdrop, links, messages, pills and secondary text were missing.
   ========================================================================== */

/* ---- Dark mode ------------------------------------------------------------- */
html.dark-mode, body.dark-mode {
    --text: #e6e6e6;
    --muted: #8ab4ff;
    --stroke: rgba(255, 255, 255, 0.14);
    color-scheme: dark;
}

/* Same brand gradient, one step deeper so the dark card sits on it calmly. */
body.dark-mode .wrap { background: linear-gradient(135deg, var(--sz-surface) 0%, var(--sz-surface) 100%); }

body.dark-mode .card {
    background: rgba(40, 44, 49, 0.96);
    border-color: var(--sz-border-strong);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
body.dark-mode .card h1 { color: var(--sz-text); }
body.dark-mode .card .subtitle,
body.dark-mode .remember-me,
body.dark-mode .footer-credit,
body.dark-mode .link-separator { color: var(--sz-text-muted); }
body.dark-mode .card .form-input:focus {
    border-color: var(--sz-accent) !important;
    box-shadow: 0 0 0 3px rgba(59, 134, 255, 0.28);
}
body.dark-mode .card .form-input::placeholder { color: var(--sz-text-muted); }
body.dark-mode .password-toggle { color: var(--sz-text-muted); }
body.dark-mode .password-toggle:hover { color: var(--sz-accent-text); }
body.dark-mode .card a,
body.dark-mode .admin-links a,
body.dark-mode .back-link a,
body.dark-mode .footer-credit .company-name { color: var(--sz-accent-text); }
body.dark-mode .card a:hover,
body.dark-mode .admin-links a:hover,
body.dark-mode .back-link a:hover { color: var(--sz-accent-text); }
body.dark-mode .admin-links { border-top-color: rgba(255, 255, 255, 0.12); }
body.dark-mode .remember-me input { accent-color: #3b86ff; }

/* Messages: the light colours are too dark on the dark card. */
body.dark-mode .message.success { background: rgba(61, 220, 138, 0.12); color: var(--sz-win); border-color: rgba(61, 220, 138, 0.3); }
body.dark-mode .message.error   { background: rgba(255, 107, 107, 0.12); color: var(--sz-loss); border-color: rgba(255, 107, 107, 0.3); }

/* "Submit MC" pill */
body.dark-mode .mc-link { background: rgba(40, 44, 49, 0.92); color: var(--sz-text); border-color: var(--sz-border-strong); }
body.dark-mode .mc-link:hover { background: var(--sz-surface-3); }

/* Login: the chosen-company chip is styled inline for the light card. */
body.dark-mode #company-chip > div { background: rgba(59, 134, 255, 0.12) !important; border-color: rgba(59, 134, 255, 0.35) !important; }
body.dark-mode #company-chip strong { color: var(--sz-text); }
body.dark-mode #company-chip .fa-building { color: var(--sz-accent-text) !important; }

/* 2FA pages */
body.dark-mode .card .btn.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--sz-text);
    border: 1px solid rgba(255, 255, 255, 0.18);
}
body.dark-mode .card input[type="radio"] { accent-color: #3b86ff; }

/* An informational message (2FA "code sent") had no style at all. */
.message.info { background: rgba(29, 104, 229, 0.08); color: var(--sz-accent-text); border: 1px solid rgba(29, 104, 229, 0.22); }
body.dark-mode .message.info { background: rgba(59, 134, 255, 0.12); color: var(--sz-accent-text); border-color: rgba(59, 134, 255, 0.3); }

/* ---- Right-to-left (Arabic) ------------------------------------------------- */
/* Leading field icon and its padding move to the right; the password toggle to the left. */
html[dir="rtl"] .input-wrapper > i { left: auto; right: 16px; }
html[dir="rtl"] .form-input { padding-left: 16px; padding-right: 48px; }
html[dir="rtl"] .password-toggle { right: auto; left: 16px; margin-right: 0; margin-left: 8%; }
html[dir="rtl"] .remember-me input { margin-right: 0; margin-left: 8px; }
html[dir="rtl"] .mc-link { right: auto; left: 24px; }
html[dir="rtl"] #company-chip .fa-building { margin-right: 0 !important; margin-left: 8px; }
@media (max-width: 900px) {
    html[dir="rtl"] .form-input { padding-left: 12px; padding-right: 40px; }
    html[dir="rtl"] .input-wrapper > i { left: auto; right: 12px; }
}

/* Back buttons sit at the reading start, and their arrows point the reading way. */
html[dir="rtl"] .back-button { left: auto; right: 1rem; }
@media (max-width: 420px) { html[dir="rtl"] .back-button { left: auto; right: 0.75rem; } }
html[dir="rtl"] .back-button .fa-arrow-left,
html[dir="rtl"] .back-button .material-symbols-outlined,
html[dir="rtl"] .back-link .fa-arrow-left { transform: scaleX(-1); display: inline-block; }

/* Company step (verify.css): the validation icon and its reserved space swap sides. */
html[dir="rtl"] .company-search { padding-right: 1rem; padding-left: 3.75rem; }
html[dir="rtl"] .validation-icon-container { right: auto; left: 0.75rem; }

/* Arabic needs a font that has the glyphs; keep the Latin stack first for brand text. */
html[lang="ar"] body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif; }
