/* ==========================================================================
   الوضع الليلي: يتفعل بـ html[data-theme="dark"]
   ========================================================================== */

html[data-theme="dark"] {
  color-scheme: dark;
  --night: #060e1c;
  --night-2: #0c1a33;
  --night-3: #142a4f;
  --blue: #86abff;
  --blue-hover: #a9c3ff;
  --blue-solid: #2a55c8;
  --blue-solid-hover: #3563dc;
  --blue-bright: #86abff;
  --blue-tint: #15264a;
  --blue-tint-2: #1a2e58;
  --blue-line: #2b4378;
  --red: #e0283b;
  --red-hover: #c51f31;
  --paper: #0b1424;
  --surface: #121e33;
  --line: #233452;
  --line-strong: #34496f;
  --ink: #e7edf7;
  --muted: #a3b3cf;
  --ok: #4fd49a;
  --ok-bg: #10301f;
  --warn-bg: #352a12;
}

/* أزرار وعناصر خلفيتها زرقاء: نخليها زرقاء غامقة والنص أبيض */
html[data-theme="dark"] .btn--blue,
html[data-theme="dark"] .woocommerce-pagination .current,
html[data-theme="dark"] .nav-links .current,
html[data-theme="dark"] .woocommerce a.button,
html[data-theme="dark"] .woocommerce button.button,
html[data-theme="dark"] .woocommerce input.button,
html[data-theme="dark"] .woocommerce #respond input#submit,
html[data-theme="dark"] .part__add,
html[data-theme="dark"] .steps__no::before,
html[data-theme="dark"] .alrg-badge,
html[data-theme="dark"] .alrg-grade--oem { background: var(--blue-solid); border-color: var(--blue-solid); color: #fff; }
html[data-theme="dark"] .btn--blue:hover,
html[data-theme="dark"] .woocommerce a.button:hover,
html[data-theme="dark"] .woocommerce button.button:hover { background: var(--blue-solid-hover); color: #fff; }
html[data-theme="dark"] .woocommerce a.button.alt,
html[data-theme="dark"] .woocommerce button.button.alt { background: var(--red); }

/* الأسطح البيضاء الثابتة */
html[data-theme="dark"] .tabs,
html[data-theme="dark"] .woocommerce-tabs ul.tabs { background: #0e192c; }
html[data-theme="dark"] .woocommerce-tabs ul.tabs li.active a { background: var(--surface); }
html[data-theme="dark"] .cat:hover { background: #17253f; }
html[data-theme="dark"] .fit-table th { background: #0f1a2e; }
html[data-theme="dark"] .woocommerce-pagination a,
html[data-theme="dark"] .woocommerce-pagination span,
html[data-theme="dark"] .single-product .woocommerce-product-gallery__trigger,
html[data-theme="dark"] #payment ul.payment_methods li,
html[data-theme="dark"] .alrg-compare__scroll,
html[data-theme="dark"] .pay-card,
html[data-theme="dark"] .bacs-iban,
html[data-theme="dark"] .social-card { background: var(--surface); border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .alrg-compare__table tr.is-current { background: #16233c; }
html[data-theme="dark"] .compare__card--oem { background: linear-gradient(180deg, var(--blue-tint) 0%, var(--surface) 60%); }

/* حقول الإدخال */
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .finder__row,
html[data-theme="dark"] .shop-filters select,
html[data-theme="dark"] .shop-filters input[type="search"],
html[data-theme="dark"] .woocommerce-ordering select,
html[data-theme="dark"] .garage-form__f select,
html[data-theme="dark"] .content-page input,
html[data-theme="dark"] .content-page select,
html[data-theme="dark"] .content-page textarea,
html[data-theme="dark"] .woocommerce form .form-row input.input-text,
html[data-theme="dark"] .woocommerce form .form-row textarea,
html[data-theme="dark"] .woocommerce form .form-row select,
html[data-theme="dark"] .woocommerce-cart .coupon input.input-text,
html[data-theme="dark"] .select2-container .select2-selection--single,
html[data-theme="dark"] .select2-dropdown,
html[data-theme="dark"] .alrg-form input[type=text],
html[data-theme="dark"] .alrg-form input[type=tel],
html[data-theme="dark"] .alrg-form input[type=email],
html[data-theme="dark"] .alrg-form input[type=number],
html[data-theme="dark"] .alrg-form select,
html[data-theme="dark"] .alrg-form textarea,
html[data-theme="dark"] .hsearch input,
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="tel"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select { background-color: #0d1729; color: var(--ink); border-color: var(--line-strong); }
html[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--ink); }
html[data-theme="dark"] .select2-results__option[aria-selected="true"] { background: var(--blue-tint); }
html[data-theme="dark"] .field input::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #7c8dab; }
html[data-theme="dark"] .field select:disabled { color: #6c7d9a; }

/* صور القطع والشعارات: تبقى على خلفية فاتحة عشان صور المنتجات بيضاء */
html[data-theme="dark"] .part__media,
html[data-theme="dark"] .cat__media,
html[data-theme="dark"] .make__media { background: #e9edf3; }
html[data-theme="dark"] .brand img { background: #fff; border-radius: 10px; padding: 2px 6px; }
html[data-theme="dark"] .make__mark,
html[data-theme="dark"] .make__logo,
html[data-theme="dark"] .crb2__logo,
html[data-theme="dark"] .pay-brands .brand-logo,
html[data-theme="dark"] .pay--logos .brand-logo { background: #fff; border-color: transparent; }
html[data-theme="dark"] .woocommerce-product-gallery__image,
html[data-theme="dark"] .woocommerce-product-gallery { background: #e9edf3; border-radius: 14px; }

/* نصوص بألوان ثابتة */
html[data-theme="dark"] .prose p { color: #cdd7e7; }
html[data-theme="dark"] .pay-card p { color: var(--muted); }
html[data-theme="dark"] .bacs-iban__no,
html[data-theme="dark"] a.social-card { color: var(--ink); }
html[data-theme="dark"] .bacs-iban__label { color: var(--muted); }
html[data-theme="dark"] .social-card__cta { color: var(--blue); }
html[data-theme="dark"] .pay-card__tag { background: var(--blue-tint); color: var(--blue); }
html[data-theme="dark"] .pay-card--inst .pay-card__tag { background: var(--ok-bg); color: var(--ok); }
html[data-theme="dark"] .pay-card,
html[data-theme="dark"] .social-card,
html[data-theme="dark"] .bacs-iban { border-color: var(--line); box-shadow: none; }

/* التنبيهات */
html[data-theme="dark"] .fit-check__result.is-no,
html[data-theme="dark"] .fit-badge.is-no,
html[data-theme="dark"] .woocommerce-error,
html[data-theme="dark"] .alrg-notice--err { background: #3a1419; border-color: #5c1f27; color: #ffb3bc; }
html[data-theme="dark"] .fit-check__result.is-unknown { color: #f3c36b; }
html[data-theme="dark"] .prose .note--warn { border-color: #5a4518; }
html[data-theme="dark"] .woocommerce-message,
html[data-theme="dark"] .woocommerce-info { background: var(--surface); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .alrg-in { color: var(--ok); }
html[data-theme="dark"] .alrg-out { color: #ff8b98; }
html[data-theme="dark"] .alrg-grade--grade2 { background: var(--blue-tint); color: var(--blue); }

/* الجداول والسلة والدفع */
html[data-theme="dark"] .woocommerce table.shop_table,
html[data-theme="dark"] .woocommerce table.shop_table td,
html[data-theme="dark"] .woocommerce table.shop_table th { border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] #payment,
html[data-theme="dark"] .woocommerce-checkout #payment { background: var(--surface); }
html[data-theme="dark"] #payment div.payment_box { background: #0f1a2e; color: var(--ink); }
html[data-theme="dark"] #payment div.payment_box::before { border-bottom-color: #0f1a2e; }
html[data-theme="dark"] .woocommerce-cart-form .product-remove a:hover { background: #3a1419; }

/* الظلال الفاتحة ما تبان في الليل */
html[data-theme="dark"] .part:hover,
html[data-theme="dark"] .nav__panel { box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .7); }

/* ---------- زر الوضع الليلي ---------- */
.theme-toggle .icon--moon { display: block; }
.theme-toggle .icon--sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon--moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon--sun { display: block; }

/* ---------- زر تبديل اللغة ---------- */
.lang-switch { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 40px; padding: 0 10px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong); white-space: nowrap; }
.lang-switch:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.lang-switch[lang="ar"] { font-family: "Tajawal", system-ui, sans-serif; }

/* أزرار التفضيلات داخل قائمة الجوال */
.mobile-menu__prefs { display: flex; gap: 10px; margin-bottom: 14px; }
.mobile-menu__prefs .btn, .mobile-menu__prefs .lang-switch { flex: 1; min-height: 44px; height: auto; }
.theme-toggle__light { display: none; }
html[data-theme="dark"] .theme-toggle__dark { display: none; }
html[data-theme="dark"] .theme-toggle__light { display: inline; }
.mobile-menu__prefs .theme-toggle .icon { width: 20px; height: 20px; }
@media (max-width: 520px) {
  .header-tools .theme-toggle { display: none; }
}
@media (max-width: 420px) {
  .header-tools { gap: 2px; }
  .header-tools .lang-switch { min-width: 34px; height: 36px; padding: 0 6px; font-size: 13px; }
  .header-tools .tool { width: 40px; min-width: 40px; }
}

/* النسخة الإنجليزية: لا تنكسر عناوين القائمة والأزرار */
html[lang^="en"] .nav a, html[lang^="en"] .btn, html[lang^="en"] .chip { white-space: nowrap; }
html[lang^="en"] body { letter-spacing: 0; }
html[lang^="en"] .tool__label, html[lang^="en"] .garage-chip__text { white-space: nowrap; }
@media (max-width: 1440px) {
  html[lang^="en"] .header-tools .tool__label { display: none; }
}
