/*
 * @almadah-clean-room — كُتب من الصفر من وصف السلوك، لا نسخًا من كود المورّد (12/11/2026)
 * صفحات الدخول والتسجيل الجديدة (resources/views/almadah/auth). ملف مستقل: لا Bootstrap ولا ملفات المورّد.
 * الشكل كما كان: بطاقة بصورة جانبية ولوحة النموذج على الشاشة العريضة؛ وفي الجوال الصورة أعلى واللوحة فوقها بحواف دائرية.
 * الألوان من إعداد المتجر عبر --am-primary / --am-primary-hov (في رأس القالب).
 */
:root {
    --am-primary: #d43533;
    --am-primary-hov: #9d1b1a;
    --am-ink: #1b1b28;
    --am-text: #292933;
    --am-muted: #8d8d8d;
    --am-faint: #a0a7b3;
    --am-line: #dfdfe6;
    --am-line-soft: #e9ebef;
    --am-danger: #d43533;
    --am-ok: #2e7d32;
    --am-font: 'Public Sans', 'IBM Plex Sans Arabic', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.am-auth {
    margin: 0; background: #fff; color: var(--am-text);
    font-family: var(--am-font); font-weight: 400; font-size: 14px; line-height: 1.5;
}
.am-auth [hidden] { display: none !important; }
.am-auth a { color: var(--am-primary); }
.am-auth img { max-width: 100%; }
.am-auth button, .am-auth input, .am-auth select { font: inherit; color: inherit; }

/* ── الإطار ── */
.am-auth__wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.am-auth__card {
    width: 100%; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr);
}
.am-auth__media { min-height: 0; }
.am-auth__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.am-auth__panel {
    position: relative; background: #fff; border: 1px solid var(--am-line);
    padding: 24px; display: flex; flex-direction: column; justify-content: center;
}
.am-auth__panel--top { justify-content: flex-start; }
.am-auth__logo { width: 48px; height: 48px; margin: 0 auto 16px; }
.am-auth__logo img { width: 100%; height: 100%; object-fit: contain; }
.am-auth__head { text-align: center; margin-bottom: 16px; }
.am-auth__title { margin: 0 0 4px; font-size: 20px; font-weight: 700; color: var(--am-primary); text-transform: uppercase; }
.am-auth__title--plain { color: var(--am-ink); text-transform: none; }
.am-auth__sub { margin: 0; font-size: 14px; color: var(--am-text); }
.am-auth__back {
    display: inline-flex; align-items: center; gap: 4px; align-self: center; margin: 16px 0 24px;
    font-size: 14px; font-weight: 700; color: var(--am-primary); text-decoration: none;
}

/* الجوال: الصورة أعلى واللوحة تعلوها بحواف دائرية (كما كانت) */
@media (max-width: 991.98px) {
    .am-auth__panel { margin-top: -60%; border-radius: 24px; min-height: 550px; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
    .am-auth__card { max-width: 58.333%; }
}
@media (min-width: 992px) {
    .am-auth__wrap { padding: 24px 0; }
    .am-auth__card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); max-width: calc(83.333% - 30px); }
    .am-auth__panel { padding: 48px; }
    .am-auth__logo { margin: 0 0 16px; }
    .am-auth__head { text-align: start; }
    .am-auth__title { font-size: 24px; }
}
@media (min-width: 1200px) { .am-auth__card { max-width: calc(75% - 30px); } }
@media (min-width: 1500px) { .am-auth__card { max-width: calc(50% - 30px); } }

/* ── الحقول ── */
.am-form { margin: 0; padding-top: 4px; }
.am-field { margin-bottom: 16px; }
.am-label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--am-ink); }
.am-label__note { color: var(--am-primary); font-size: 10px; font-weight: 400; }
.am-input, .am-phone {
    display: block; width: 100%; min-height: 44px; padding: 10px 14px;
    background: #fff; border: 1px solid var(--am-line); border-radius: 0; font-size: 14px; outline: 0;
    transition: border-color .15s, box-shadow .15s;
}
.am-input::placeholder, .am-phone__input::placeholder { color: #b5b5bf; }
.am-input:focus, .am-phone:focus-within { border-color: var(--am-primary); box-shadow: inset 0 0 0 1px var(--am-primary); }
.am-input[readonly] { background: #f5f5f7; }
.am-input.is-invalid, .am-phone.is-invalid, .am-float.is-invalid { border-color: var(--am-danger); }
.am-input--code { letter-spacing: 4px; direction: ltr; text-align: center; font-size: 18px; font-weight: 700; }
.am-err { margin: 6px 0 0; font-size: 12px; font-weight: 700; color: var(--am-danger); }
.am-hint { margin: 4px 0 0; font-size: 12px; color: var(--am-muted); text-align: end; }
.am-group { display: flex; align-items: stretch; gap: 8px; }
.am-group .am-input { flex: 1; min-width: 0; }

/* الجوال: رمز الدولة (قائمة أصلية شفافة فوق «+966») ثم الرقم */
.am-phone { display: flex; align-items: stretch; padding: 0; direction: ltr; }
.am-phone__cc {
    position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px;
    background: #f7f7f9; border-inline-end: 1px solid var(--am-line); font-size: 14px; color: var(--am-text); flex: none;
}
.am-phone__cc select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; }
.am-phone__cc select:focus-visible + * , .am-phone__cc:focus-within { outline: 2px solid var(--am-primary); outline-offset: -2px; }
.am-phone__input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 10px 14px; background: transparent; text-align: left; }
.am-phone__input[readonly] { background: #f5f5f7; }
.am-phone .am-btn--addon { border-radius: 0; }

/* كلمة المرور مع زر العين */
.am-pass { position: relative; }
.am-pass .am-input { padding-inline-end: 48px; }
.am-pass__eye {
    position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: 46px; display: flex; align-items: center; justify-content: center;
    border: 0; background: transparent; color: var(--am-muted); cursor: pointer;
}
.am-pass__eye:hover { color: var(--am-ink); }
.am-pass__eye .am-eye-off, .am-pass__eye[aria-pressed="true"] .am-eye-on { display: none; }
.am-pass__eye[aria-pressed="true"] .am-eye-off { display: block; }

/* مربع الاختيار */
.am-check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 12px; color: var(--am-muted); }
.am-check input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--am-primary); flex: none; }
.am-check--terms { display: flex; margin: 4px 0 8px; font-size: 13px; color: var(--am-text); }
.am-check--terms a { font-weight: 500; }

.am-row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.am-small { font-size: 12px; }
.am-muted { color: var(--am-muted); }
.am-muted-link { color: var(--am-muted) !important; }
.am-muted-link:hover { color: var(--am-primary) !important; }
.am-switch-row { text-align: end; margin: -8px 0 12px; }
.am-linkbtn {
    border: 0; background: none; padding: 0; color: var(--am-primary); font-size: 12px; font-style: italic; cursor: pointer;
}
.am-linkbtn--muted { color: var(--am-muted); font-style: normal; }
.am-linkbtn--muted:hover { color: var(--am-primary); }
.am-linkbtn--center { display: block; margin: 8px auto 16px; font-style: normal; font-size: 14px; }

/* الأزرار */
.am-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
    border: 1px solid var(--am-primary); border-radius: 0; background: var(--am-primary); color: #fff !important;
    font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, opacity .15s;
}
.am-btn:hover { background: var(--am-primary-hov); border-color: var(--am-primary-hov); }
.am-btn:disabled, .am-btn[aria-disabled="true"] { opacity: .65; cursor: not-allowed; }
.am-btn--block { display: flex; width: 100%; margin: 24px 0 24px; }
.am-btn--sm { min-height: 32px; padding: 4px 12px; font-size: 12px; }
.am-btn--ghost { background: #fff; color: var(--am-primary) !important; }
.am-btn--ghost:hover { background: #f7f7f9; color: var(--am-primary-hov) !important; }
.am-btn--addon { flex: none; padding: 0 16px; }
.am-btn--tall { min-height: 50px; border-radius: 10px; font-size: 16px; }

/* حالة رمز التحقق في التسجيل */
.am-code-state { flex: none; width: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--am-line); }
.am-code-state::after { content: "\2192"; font-size: 18px; color: var(--am-muted); }
[dir="rtl"] .am-code-state::after { content: "\2190"; }
.am-code-state[data-state="busy"]::after { content: ""; width: 16px; height: 16px; border: 2px solid var(--am-line); border-top-color: var(--am-primary); border-radius: 50%; animation: am-spin .8s linear infinite; }
.am-code-state[data-state="ok"] { background: #f7f8fa; }
.am-code-state[data-state="ok"]::after { content: "\2713"; color: var(--am-ok); font-weight: 700; }
.am-code-state[data-state="bad"]::after { content: "\2715"; color: var(--am-danger); font-weight: 700; }
@keyframes am-spin { to { transform: rotate(360deg); } }

/* الفاصل «أو …» */
.am-or { display: flex; align-items: center; gap: 10px; color: var(--am-faint); font-size: 12px; margin: 14px 0; }
.am-or::before, .am-or::after { content: ""; flex: 1; height: 1px; background: var(--am-line-soft); }

/* الدخول السريع بالرمز */
.am-qa { border: 1px solid var(--am-line-soft); border-radius: 14px; padding: 22px 20px 16px; background: #fff; margin-bottom: 18px; }
.am-qa__title { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--am-ink); }
.am-qa__sub { margin: 0 0 14px; font-size: 13px; color: #7a8290; }
.am-qa__input {
    display: block; width: 100%; height: 50px; margin-bottom: 8px; padding: 0 14px; font-size: 16px;
    border: 1px solid var(--am-line); border-radius: 10px; outline: 0; background: #fff;
}
.am-qa__input:focus { border-color: var(--am-primary); box-shadow: 0 0 0 1px var(--am-primary); }
.am-qa__code { letter-spacing: 12px; text-align: center; font-size: 26px; font-weight: 700; }
.am-btn--qa { width: 100%; height: 50px; border-radius: 10px; font-size: 16px; }
.am-qa__links { display: flex; justify-content: space-between; margin-top: 8px; }
.am-qa__link { border: 0; background: none; padding: 0; font-size: 13px; color: #7a8290; text-decoration: underline; cursor: pointer; }
.am-qa__msg { min-height: 18px; margin: 8px 0 0; font-size: 13px; }
.am-qa__msg.is-ok { color: var(--am-ok); }
.am-qa__msg.is-bad { color: var(--am-danger); }

/* الدخول الاجتماعي (أزرار مستطيلة بأسمائها — قرار المالك 18/09/2026) */
.am-social__lead { text-align: center; margin: 0 0 12px; font-size: 12px; color: var(--am-muted); }
.am-social { display: flex; flex-direction: column; gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; }
.am-social__btn {
    display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; border-radius: 10px;
    font-size: 15px; font-weight: 700; text-decoration: none; border: 1px solid #e3e3e3; background: #fff; color: #111 !important;
    transition: transform .1s;
}
.am-social__btn:active { transform: scale(.99); }
.am-social__btn svg { width: 22px; height: 22px; flex: none; }
.am-social__btn--apple, .am-social__btn--twitter { background: #000; border-color: #000; color: #fff !important; }
.am-social__btn--google { color: #1f1f1f !important; }
.am-social__btn--facebook { background: #1877f2; border-color: #1877f2; color: #fff !important; }

.am-switch-account { margin: 0; font-size: 12px; color: var(--am-muted); }
.am-switch-account a { margin-inline-start: 8px; font-size: 14px; font-weight: 700; text-decoration: none; color: var(--am-primary); }
.am-switch-account a:hover { text-decoration: underline; }

/* إعادة الإرسال بعد العدّ */
.am-resend { text-align: center; margin-bottom: 8px; }
.am-resend p { margin: 0 0 4px; }
.am-resend__link { font-size: 14px; font-weight: 700; color: var(--am-primary); text-decoration: none; }
.am-resend__link[aria-disabled="true"] { pointer-events: none; color: #bdb7b7; }
.am-resend__count { font-size: 14px; font-weight: 700; color: var(--am-primary); }

/* قناة الرمز (SMS/واتساب) */
.am-channels { border: 0; padding: 0; margin: 0 0 8px; }
.am-channels__row { display: flex; gap: 10px; }
.am-channel { flex: 1; cursor: pointer; }
.am-channel input { position: absolute; opacity: 0; pointer-events: none; }
.am-channel span { display: block; padding: 8px 12px; text-align: center; border: 1px solid var(--am-line); border-radius: 8px; }
.am-channel input:checked + span { border-color: var(--am-primary); font-weight: 600; background: #f7f8fa; }
.am-channel input:focus-visible + span { outline: 2px solid var(--am-primary); outline-offset: 2px; }

/* تنبيهات داخل الصفحة */
.am-note { margin: 12px 0; padding: 12px 14px; border-radius: 8px; font-size: 13px; }
.am-note p { margin: 0 0 6px; }
.am-note form { margin: 8px 0 0; }
.am-note__t { font-weight: 700; }
.am-note--warn { background: #fff7e6; border-inline-start: 4px solid #d97706; }
.am-note--ok { background: #ecf7ee; color: #1e5e24; }
.am-demo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; margin-bottom: 16px; border: 1px solid var(--am-line); }
.am-demo-links { display: flex; flex-direction: column; }
.am-demo-links .am-btn--block { margin: 0 0 12px; }

/* حقول بيانات المتجر (عنوان صغير داخل الحقل وأيقونة) */
.am-float {
    position: relative; border: 1px solid #e3e6eb; border-radius: 12px; background: #fff;
    padding: 9px 14px 7px; padding-inline-start: 48px; margin-bottom: 12px; transition: border-color .15s, box-shadow .15s;
}
.am-float:focus-within { border-color: var(--am-primary); box-shadow: 0 0 0 3px rgba(124, 58, 237, .15); }
.am-float__i { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 14px; color: #4a4a4a; }
.am-float label { display: block; font-size: 11.5px; color: #8a8f98; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-float input { display: block; width: 100%; border: 0; outline: 0; padding: 2px 0; background: transparent; font-size: 15px; }
.am-float + .am-err { margin: -8px 2px 10px; }

/* صفحة التاجر بألوان تطبيق «تجار المادة» */
.am-auth--trader { --am-primary: #7C3AED; --am-primary-hov: #5B21B6; }
.am-auth--trader .am-qa__input:focus { box-shadow: 0 0 0 3px rgba(124, 58, 237, .15); }

/* التنبيه العائم (رسائل الخادم ونتائج الطلبات) */
.am-toasts { position: fixed; bottom: 16px; left: 16px; z-index: 50; width: min(380px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.am-toast {
    pointer-events: auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px 14px;
    border-radius: 8px; background: #292933; color: #fff; font-size: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
    animation: am-toast-in .2s ease-out;
}
.am-toast--success { background: #2e7d32; }
.am-toast--danger, .am-toast--error { background: #c62828; }
.am-toast--warning { background: #b26a00; }
.am-toast--info { background: #1565c0; }
.am-toast button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; padding: 0; opacity: .8; }
@keyframes am-toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .am-toast, .am-code-state::after { animation: none !important; } }
