
:root {
    --eidu-font: "Segoe UI", "Roboto", sans-serif;
    --eidu-saving: #00A152;
    --eidu-saving-bg: rgba(0, 200, 83, 0.08);
    --eidu-locked: rgba(0, 0, 0, 0.26);
    --eidu-header-h: 64px;
}

/* ------------------------------------------------------------
   1. تعريب الخط
   ------------------------------------------------------------ */
body,
.mud-button,
.mud-field .mud-input,
.mud-field .mud-label {
    font-family: var(--eidu-font);
}

/* الأرقام تبقى لاتينية للوضوح المالي حتى داخل نص عربي */
.eidu-num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    /* direction: ltr; */
    unicode-bidi: isolate;
    /* display: inline-block; */
	    text-align: center;
}

/* الأزرار العربية لا تُكتب بحروف كبيرة — الخاصية بلا معنى في العربية */
[dir="rtl"] .mud-button {
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
}

/* ------------------------------------------------------------
   2. إصلاحات RTL للثيم الأصلي
   الثيم يستخدم left/transform-origin: left — يجب قلبهما
   ------------------------------------------------------------ */
[dir="rtl"] .mud-field .mud-label {
    left: auto;
    right: 12px;
    transform-origin: right top;
}

[dir="rtl"] .mud-field .mud-input:focus + .mud-label,
[dir="rtl"] .mud-field .mud-input:not(:placeholder-shown) + .mud-label {
    transform: translateY(-24px) scale(.75);
}

[dir="rtl"] .mud-field .validation-message,
[dir="rtl"] .mud-field .mud-helper,
[dir="rtl"] .mud-field .mud-helper-error {
    text-align: start;
}

/* عناصر select الأصلية تحتاج مساحة للسهم في الجهة الصحيحة */
[dir="rtl"] select.mud-input {
    padding-inline-end: 32px;
    background-position: left 12px center;
}

/* ------------------------------------------------------------
   صفّ حقول أفقيّ يلتفّ — مرشِّحات الصفقات وحقول الجوال
   ------------------------------------------------------------ */
.eidu-field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
}

.eidu-field-row > .mud-field { flex: 1 1 180px; margin: 0; }

.eidu-field-row__actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 0 0 auto;
    padding-block-start: 8px;
}

.eidu-deal-filters { margin-block-end: 16px; }

/* تنبيه «شريحة الدخول لم تكتمل» على بطاقة الصفقة */
.eidu-deal__notice {
    background: #FFF4E5;
    border-inline-start: 3px solid var(--mud-warning, #ED6C02);
    border-radius: var(--mud-radius);
    padding: 8px 10px;
    font-size: .8rem;
    line-height: 1.7;
    color: #663C00;
}

/* الحقول ذات التلميح تقول ذلك بمؤشّرها */
.eidu-deal__fact[title] { cursor: help; }

/* ------------------------------------------------------------
   تحدّي «لست روبوتاً» — الصورة فوق حقل الكتابة
   ------------------------------------------------------------ */
.eidu-captcha { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }

.eidu-captcha__image {
    border: 1px solid var(--mud-divider);
    border-radius: var(--mud-radius);
    /* الصورة لاتينية الاتجاه داخل صفحة عربية */
    direction: ltr;
    flex: 0 0 auto;
}

.eidu-captcha__entry {  gap: 8px; align-items: center; flex: 1 1 200px; }

/* الرمز لاتينيّ يُكتب من اليسار ويُقرأ متباعد الحروف */
.eidu-captcha__entry .mud-input {
    direction: ltr;
    text-align: start;
    letter-spacing: .18em;
    text-transform: uppercase;
}

/* حقل الجوال: مفتاح البلد ثم باقي الرقم في سطر واحد.
   يلتفّان سطرين على الشاشات الضيّقة — قائمةُ مفاتيحَ مضغوطةٌ في نصف
   شاشة جوال تُقرأ «‎+96…» فيختار التاجر مفتاح بلدٍ غير بلده. */
.eidu-phone { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }

.eidu-phone .mud-field { margin: 0; }

.eidu-phone__code   { flex: 1 1 150px; }
.eidu-phone__number { flex: 2 1 180px; }

/* الرقم لاتيني يُكتب من اليسار حتى داخل صفحة عربية */
.eidu-phone__number .mud-input { direction: ltr; text-align: start; }

/* ------------------------------------------------------------
   3. الهيكل العام
   ------------------------------------------------------------ */
/* الترويسة الأفقية استُبدلت بالهيكل الجانبي في brand.css — بقيت العلامة
   وحدها لأن الشريط الجانبي وصفحة الهبوط كليهما يستعملانها. */
.eidu-brand {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--mud-primary);
    text-decoration: none;
}

.eidu-brand__mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--mud-primary), #7C6FF0);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: .9rem;
    font-weight: 700;
    box-shadow: var(--mud-elevation-2);
}

.eidu-main { padding-block: 32px 64px; }

/* بانر البيانات الافتراضية — يجب أن يبقى ظاهراً حتى تصل بيانات حقيقية */
.eidu-demo-banner {
    background: #FFF4E5;
    border-inline-start: 4px solid var(--mud-warning);
    color: #663C00;
    padding: 12px 16px;
    border-radius: var(--mud-radius);
    font-size: .875rem;
    margin-bottom: 24px;
}

/* ------------------------------------------------------------
   4. الواجهة التعريفية
   ------------------------------------------------------------ */
.eidu-hero { text-align: center; margin-bottom: 32px; }

.eidu-hero__title {
    font-size: clamp(1.75rem, 4vw, 2.6rem);
    font-weight: 700;
    margin: 0 0 12px;
    line-height: 1.25;
}

.eidu-hero__subtitle {
    color: var(--mud-text-secondary);
    max-width: 640px;
    margin-inline: auto;
    font-size: 1.05rem;
    line-height: 1.7;
}

/* ------------------------------------------------------------
   5. شبكة الحاسبة
   ------------------------------------------------------------ */
.eidu-calc-grid {
    display: grid;
    grid-template-columns: minmax(300px, 380px) 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .eidu-calc-grid { grid-template-columns: 1fr; }
}

.eidu-sticky { position: sticky; top: calc(var(--eidu-header-h) + 24px); }

@media (max-width: 900px) {
    .eidu-sticky { position: static; }
}

/* ------------------------------------------------------------
   6. بطاقات النتائج — شريحة سعرية لكل بطاقة
   ------------------------------------------------------------ */
.eidu-tier {
    position: relative;
    background: var(--mud-surface);
    border: 1px solid var(--mud-divider);
    border-radius: var(--mud-radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    transition: box-shadow .2s, border-color .2s, transform .2s;
}

.eidu-tier:hover {
    box-shadow: var(--mud-elevation-4);
    transform: translateY(-2px);
}

.eidu-tier--best {
    border-color: var(--eidu-saving);
    background: linear-gradient(180deg, var(--eidu-saving-bg), var(--mud-surface) 60%);
}

.eidu-tier--locked { opacity: .74; }

.eidu-tier__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.eidu-tier__name { font-size: 1.05rem; font-weight: 600; margin: 0; }

.eidu-tier__price {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--mud-primary);
    line-height: 1.2;
}

.eidu-tier__price small {
    font-size: .8rem;
    font-weight: 400;
    color: var(--mud-text-secondary);
}

.eidu-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.eidu-badge--best   { background: var(--eidu-saving); color: #fff; }
.eidu-badge--locked { background: rgba(0,0,0,.06); color: var(--eidu-locked); }
.eidu-badge--group  { background: rgba(89,74,226,.1); color: var(--mud-primary); }

/* تفصيل مكوّنات السعر */
.eidu-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--mud-divider);
}

.eidu-breakdown__item { display: flex; flex-direction: column; gap: 2px; }

.eidu-breakdown__label {
    font-size: .7rem;
    color: var(--mud-text-secondary);
    letter-spacing: .02em;
}

.eidu-breakdown__value { font-size: .95rem; font-weight: 600; }

.eidu-saving-note {
    margin-top: 14px;
    padding: 10px 14px;
    background: var(--eidu-saving-bg);
    border-radius: var(--mud-radius);
    color: #00663A;
    font-size: .875rem;
    font-weight: 500;
}

.eidu-shortfall-note {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(89,74,226,.06);
    border-radius: var(--mud-radius);
    color: var(--mud-primary);
    font-size: .875rem;
}

/* ------------------------------------------------------------
   7. ملخص الشحنة
   ------------------------------------------------------------ */
.eidu-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.eidu-fact {
    background: var(--mud-background);
    border-radius: var(--mud-radius);
    padding: 12px 14px;
}

.eidu-fact__label { font-size: .7rem; color: var(--mud-text-secondary); }
.eidu-fact__value { font-size: 1.05rem; font-weight: 600; margin-top: 2px; }

.eidu-doc-list { margin: 8px 0 0; padding-inline-start: 20px; font-size: .85rem; line-height: 1.9; }

/* ------------------------------------------------------------
   7b. الجداول (لوحة الإدارة)
   جدول عريض داخل حاوية تمرّر أفقياً — الصفحة نفسها لا تُمرَّر أبداً
   ------------------------------------------------------------ */
.eidu-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.eidu-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
    white-space: nowrap;
	text-align-last: center;
}

.eidu-table th,
.eidu-table td {
    padding: 10px 12px;
    text-align: start;
    border-block-end: 1px solid var(--mud-divider);
}

.eidu-table th {
    font-size: .72rem;
    font-weight: 600;
    color: var(--mud-text-secondary);
    text-transform: none;
    position: sticky;
    inset-block-start: 0;
    background: var(--mud-surface);
    z-index: 1;
}

.eidu-table tbody tr:hover { background: var(--mud-action-hover); }
.eidu-table tbody tr:last-child td { border-block-end: none; }

/* المبالغ محاذاة للنهاية وبأرقام ذات عرض ثابت لتصطفّ المنازل */
.eidu-table .num { text-align: end; font-variant-numeric: tabular-nums; direction: ltr; }

/* موجب = دخول للحساب · سالب = خروج منه */
.eidu-amount--in  { color: var(--eidu-saving); font-weight: 600; }
.eidu-amount--out { color: var(--mud-error);   font-weight: 600; }

/* لوح مرتفع محدود يمنع كشف الدفتر من دفع الصفحة لطول لا نهائي */
.eidu-scroll-y { max-height: 460px; overflow-y: auto; }

.eidu-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

/* ------------------------------------------------------------
   8. الحالة الفارغة والتحميل
   ------------------------------------------------------------ */
.eidu-empty {
    text-align: center;
    padding: 64px 24px;
    color: var(--mud-text-secondary);
}

.eidu-empty__icon { font-size: 3rem; opacity: .35; margin-bottom: 12px; }

.eidu-skeleton {
    height: 128px;
    border-radius: var(--mud-radius-lg);
    margin-bottom: 16px;
    background: linear-gradient(90deg, #EEE 25%, #F7F7F7 50%, #EEE 75%);
    background-size: 200% 100%;
    animation: eidu-shimmer 1.4s ease-in-out infinite;
}

@keyframes eidu-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ------------------------------------------------------------
   9. الإشعارات (Toast)
   ------------------------------------------------------------ */
.eidu-toast-host {
    position: fixed;
    inset-block-end: 24px;
    inset-inline-start: 24px;
    z-index: 1400;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}

@media (max-width: 600px) {
    .eidu-toast-host {
        inset-inline: 16px;
        inset-block-end: 16px;
        max-width: none;
    }
}

.eidu-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--mud-radius-lg);
    background: #323232;
    color: #fff;
    box-shadow: var(--mud-elevation-8);
    overflow: hidden;
    pointer-events: auto;
    animation: eidu-toast-in .28s cubic-bezier(.21, 1.02, .73, 1);
}

@keyframes eidu-toast-in {
    from { opacity: 0; transform: translateY(16px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.eidu-toast--success { background: #1B5E20; }
.eidu-toast--info    { background: #0D47A1; }
.eidu-toast--warning { background: #7A4F01; }
.eidu-toast--error   { background: #B3261E; }

.eidu-toast__icon {
    flex: 0 0 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: grid;
    place-items: center;
    font-size: .8rem;
    font-weight: 700;
    margin-top: 1px;
}

.eidu-toast__body { flex: 1 1 auto; min-width: 0; }
.eidu-toast__title { font-weight: 700; font-size: .9rem; margin-bottom: 2px; }
.eidu-toast__message { font-size: .875rem; line-height: 1.55; word-wrap: break-word; }

.eidu-toast__close {
    flex: 0 0 auto;
    background: none;
    border: none;
    color: rgba(255,255,255,.75);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    border-radius: 4px;
    transition: color .15s, background-color .15s;
}

.eidu-toast__close:hover { color: #fff; background: rgba(255,255,255,.12); }
.eidu-toast__close:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

/* شريط يوضّح الوقت المتبقي قبل الاختفاء */
.eidu-toast__progress {
    position: absolute;
    inset-block-end: 0;
    inset-inline-start: 0;
    height: 3px;
    width: 100%;
    background: rgba(255,255,255,.5);
    transform-origin: inline-start;
    animation-name: eidu-toast-progress;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes eidu-toast-progress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ------------------------------------------------------------
   10. طلب شراء حصة وخيط محادثته
   ------------------------------------------------------------ */
.eidu-bid {
    border: 1px solid var(--mud-divider);
    border-radius: var(--mud-radius-lg);
    padding: 16px;
    margin-bottom: 12px;
}

/* المُغلق يبقى مقروءاً ولا ينافس القائم على الانتباه */
.eidu-bid--closed { opacity: .72; }

.eidu-thread {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    max-height: 320px;
    overflow-y: auto;
    padding-inline-end: 4px;
}

.eidu-msg {
    align-self: flex-start;
    max-width: min(560px, 88%);
    padding: 8px 12px;
    border-radius: var(--mud-radius-lg);
    background: #F4F4F6;
    border: 1px solid var(--mud-divider);
}

/* رسالتي في الجهة المقابلة — من كتبها يُعرف بموضعها قبل قراءة اسمه */
.eidu-msg--mine {
    align-self: flex-end;
    background: color-mix(in srgb, var(--mud-primary) 10%, transparent);
    border-color: color-mix(in srgb, var(--mud-primary) 28%, transparent);
}

/* الإدارة طرفٌ ثالث معلن لا متخفٍّ — ولها لون ثالث */
.eidu-msg--admin {
    align-self: center;
    max-width: min(620px, 96%);
    background: color-mix(in srgb, var(--mud-warning) 12%, transparent);
    border-color: color-mix(in srgb, var(--mud-warning) 34%, transparent);
}

.eidu-msg__meta {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    font-size: .72rem;
    color: var(--mud-text-secondary);
    margin-bottom: 2px;
}

.eidu-msg__body {
    font-size: .875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* حساب استلام البائع — مطويٌّ ما دام محفوظاً: بيانٌ بنكي لا يُعرض
   مفتوحاً في كل زيارة، ويُفتح وحده يوم لا حساب فيه */
.eidu-payout {
    margin: 12px 0;
    padding: 12px 16px;
    border: 1px solid var(--mud-divider);
    border-radius: var(--mud-radius-md);
    background: var(--mud-surface-alt, rgba(0, 0, 0, .02));
}

.eidu-payout > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ------------------------------------------------------------
   11. شريط عطب الدائرة

   مخفيٌّ حتى يُظهره Blazor بنفسه عند سقوط الدائرة. بلا هذه القاعدة
   يبقى «حدث خطأ غير متوقع» ظاهراً في أسفل كل صفحة وكل شيء يعمل —
   فلا يُصدَّق حين يقع العطب فعلاً.
   ------------------------------------------------------------ */
#blazor-error-ui {
    display: none;
    position: fixed;
    inset-block-end: 0;
    inset-inline: 0;
    z-index: 1500;
    padding: 12px 20px;
    background: #FFF4CE;
    color: #4A3B00;
    font-size: .875rem;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, .2);
}

#blazor-error-ui .reload { color: inherit; margin-inline-start: 8px; }

#blazor-error-ui .dismiss {
    position: absolute;
    inset-block-start: 8px;
    inset-inline-end: 16px;
    cursor: pointer;
}

/* ------------------------------------------------------------
   12. إتاحة
   ------------------------------------------------------------ */
.eidu-visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

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