/**
 * i18n.css — مشترك بين الصفحات العامة فقط (index, category, product, order-success).
 * 1) زر تغيير اللغة العائم + القائمة ديالو
 * 2) قواعد العربية (RTL + الخط العربي)
 * ⚠️ قواعد RTL كلها مربوطة بـ [dir="rtl"] أو [lang="ar"]، يعني الصفحات الفرنسية/الإنجليزية ما كتتأثرش.
 */

/* ══════════════════════════════════════════════════
   1) LANGUAGE FAB (فوق زر الوضع الليلي، نفس حجم .fab-btn)
══════════════════════════════════════════════════ */
.lang-fab-wrap { position: relative; display: flex; }
.fab-btn.fab-lang {
  position: relative;
  background: var(--black, #111);
  color: var(--gold-pale, #fff);
  padding: 0;
  font: inherit;
}
.fab-btn.fab-lang:focus-visible,
.lang-option:focus-visible {
  outline: 2px solid var(--gold, #16a34a);
  outline-offset: 3px;
}
.fab-lang-code {
  position: absolute;
  bottom: -3px;
  right: -3px;
  min-width: 22px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--gold, #16a34a);
  color: #fff;
  border: 2px solid var(--ivory, #fff);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.56rem;
  font-weight: 800;
  line-height: 13px;
  letter-spacing: 0.04em !important;
  text-align: center;
  pointer-events: none;
}

/* القائمة: عمود عمودي من أزرار دائرية صغيرة (FR / EN / عرب) كيطلعو فوق زر اللغة */
.lang-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s linear 0.22s;
  z-index: 2;
  transform: translateX(-50%);
}
.lang-menu.open {
  visibility: visible;
  pointer-events: auto;
  transition: visibility 0s;
}
.lang-menu li { margin: 0; padding: 0; }
.lang-option {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1.5px solid rgba(255,255,255,0.14);
  border-radius: 50%;
  background: var(--black, #111);
  color: var(--gold-pale, #fff);
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em !important;
  box-shadow: 0 8px 22px rgba(0,0,0,0.28);
  -webkit-tap-highlight-color: transparent;
  /* حركة الظهور: كل زر كيطلع من تحت (من جهة زر اللغة) بتأخير بسيط */
  opacity: 0;
  transform: translateY(14px) scale(0.7);
  transition: opacity 0.16s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.15s ease, border-color 0.15s ease;
}
.lang-option[lang="ar"] { font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif; font-size: 0.82rem; }
.lang-menu.open .lang-option { opacity: 1; transform: translateY(0) scale(1); }
/* الأقرب للزر كيبان الأول */
.lang-menu.open li:nth-last-child(1) .lang-option { transition-delay: 0s; }
.lang-menu.open li:nth-last-child(2) .lang-option { transition-delay: 0.04s; }
.lang-menu.open li:nth-last-child(3) .lang-option { transition-delay: 0.08s; }
.lang-option:hover { transform: translateY(0) scale(1.08); }
.lang-option:focus-visible {
  outline: 2px solid var(--gold, #16a34a);
  outline-offset: 3px;
}
.lang-option.is-current {
  background: var(--gold, #16a34a);
  border-color: var(--gold, #16a34a);
  color: #fff;
}
.lang-option-check { display: none; }

@media (max-width: 600px) {
  .fab-lang-code { min-width: 20px; height: 16px; line-height: 12px; font-size: 0.52rem; }
  .lang-menu { bottom: calc(100% + 9px); gap: 7px; }
  .lang-option { width: 40px; height: 40px; font-size: 0.74rem; }
}
@media (prefers-reduced-motion: reduce) {
  .lang-option, .lang-menu.open .lang-option { transition: none; }
}

/* صفحة النجاح ما فيهاش .fab-stack أصلاً: كنزيدو نسخة بسيطة بنفس الشكل */
.fab-stack.fab-stack-lang-only {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 300;
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
}
.fab-stack-lang-only .fab-btn {
  width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  transition: transform 0.3s, box-shadow 0.3s;
}
.fab-stack-lang-only .fab-btn:hover { transform: translateY(-4px) scale(1.06); }
.fab-stack-lang-only .fab-btn svg { width: 24px; height: 24px; }
@media (max-width: 600px) {
  .fab-stack.fab-stack-lang-only { right: 1rem; bottom: 1rem; }
  .fab-stack-lang-only .fab-btn { width: 46px; height: 46px; }
  .fab-stack-lang-only .fab-btn svg { width: 20px; height: 20px; }
}

/* ══════════════════════════════════════════════════
   2) ARABIC — الخط العربي (نفس var(--font-arabic) ديال المشروع)
══════════════════════════════════════════════════ */
html[lang="ar"] {
  --font-arabic:  'Tajawal', sans-serif;
  --font-display: 'Tajawal', 'Inter', sans-serif;
  --font-body:    'Tajawal', 'Inter', sans-serif;
  --font-mono:    'Tajawal', 'Inter', sans-serif;
}
/* letter-spacing كيقطّع الحروف العربية المتصلة → نلغيوه فـ العربية فقط */
html[lang="ar"] body,
html[lang="ar"] body * { letter-spacing: normal !important; }
html[lang="ar"] .hero-title,
html[lang="ar"] .section-title,
html[lang="ar"] .about-headline { line-height: 1.3; }
html[lang="ar"] .hero-title { line-height: 1.25; }

/* ══════════════════════════════════════════════════
   3) RTL — انعكاس التخطيط (flex/grid كيتعكسو تلقائياً مع dir="rtl")
══════════════════════════════════════════════════ */

/* Navbar (هاتف): الأيقونات + قائمة الأقسام */
@media (max-width: 900px) {
  [dir="rtl"] .nav-icons { margin-left: 0.85rem; margin-right: auto; }
}
[dir="rtl"] .mobile-cat-list {
  padding-left: 0; padding-right: 1rem;
  border-left: none; border-right: 1px solid rgba(var(--gold-rgb), 0.2);
}

/* Hero slider: الحركة (translateX) مبنية على LTR → نخليو السكة LTR والمحتوى RTL */
[dir="rtl"] .hero-slides { direction: ltr; }
[dir="rtl"] .hero-slide-overlay {
  direction: rtl;
  background: linear-gradient(270deg, rgba(10,10,10,0.88) 0%, rgba(10,10,10,0.6) 42%, rgba(10,10,10,0.18) 72%, rgba(10,10,10,0.42) 100%);
}
@media (max-width: 768px) {
  [dir="rtl"] .hero-slide-overlay {
    background: linear-gradient(270deg, rgba(10,10,10,0.82) 0%, rgba(10,10,10,0.5) 55%, rgba(10,10,10,0.2) 100%);
  }
  [dir="rtl"] .hero-slide-inner { left: auto; right: 0; }
}
[dir="rtl"] .hero-deco { transform: scaleX(-1); }
[dir="rtl"] .hero-nav { direction: ltr; }

/* أسهم "→" داخل الأزرار كتولّي "←" */
[dir="rtl"] .btn-gold > svg,
[dir="rtl"] .btn-outline-light > svg { transform: scaleX(-1); }

/* شريط الماركات (marquee) والكاروسيلات الأفقية: منطق السكرول ديالهم مبني على LTR */
[dir="rtl"] .brand-marquee-wrap { direction: ltr; }
[dir="rtl"] .collections-grid,
[dir="rtl"] .coll-nav-row,
[dir="rtl"] .trust-carousel-track,
[dir="rtl"] .trust-carousel-dots { direction: ltr; }
[dir="rtl"] .coll-card,
[dir="rtl"] .trust-carousel-slide { direction: rtl; }

/* الأثمنة والتخفيضات كتبقى مقروءة بحال الفرنسية: "550 DH" و "-12%" (ماشي "DH 550" / "%12-") */
[dir="rtl"] .product-tile-price,
[dir="rtl"] .product-tile-price-old,
[dir="rtl"] .product-tile-badge,
[dir="rtl"] .gallery-badge,
[dir="rtl"] .product-price,
[dir="rtl"] .product-price-old,
[dir="rtl"] .product-discount-chip,
[dir="rtl"] .form-total-value,
[dir="rtl"] .sticky-order-price,
[dir="rtl"] .search-result-price { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .sticky-order-price,
[dir="rtl"] .search-result-price { text-align: right; }

/* محتوى قاعدة البيانات (غالباً بالفرنسية ما دام ما تترجمش): كل فقرة كتاخد الاتجاه ديال النص ديالها
   باش النقط والفواصل ما يتقلبوش */
[dir="rtl"] .product-short-desc,
[dir="rtl"] .description-content p,
[dir="rtl"] .description-content li > span:last-child,
[dir="rtl"] .testimonial-comment,
[dir="rtl"] .review-comment,
[dir="rtl"] .hero-sub { unicode-bidi: plaintext; }

/* الأزرار العائمة: فـ العربية كتمشي لليسار (النص كيبدا من اليمين، وهكا ما كتغطيش بداية السطور)
   والقائمة ديال اللغة كتطلع فوق الزر (نفس الشكل فـ كل اللغات) */
[dir="rtl"] .fab-stack { right: auto; left: 1.5rem; }
@media (max-width: 600px) {
  [dir="rtl"] .fab-stack { right: auto; left: 1rem; }
}
[dir="rtl"] .fab-lang-code { right: auto; left: -3px; }
/* البحث */
[dir="rtl"] .search-close { right: auto; left: 1.75rem; }

/* الفورم: رقم الهاتف كيبقى LTR (الأرقام بالترتيب) */
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="email"] { direction: ltr; text-align: right; }
[dir="rtl"] input[type="tel"]::placeholder,
[dir="rtl"] input[type="email"]::placeholder { text-align: right; }

/* السلة (cart.js): كتخرج من اليسار */
[dir="rtl"] .kyro-cart-panel {
  transform: translateX(-100%);
  box-shadow: 10px 0 40px rgba(0,0,0,0.15);
}
[dir="rtl"] .kyro-cart-overlay.open .kyro-cart-panel { transform: translateX(0); }
[dir="rtl"] .kyro-cart-item-price { direction: ltr; text-align: right; }

/* صفحة النجاح: سطور الملخص */
[dir="rtl"] .order-recap-value { text-align: left; }
[dir="rtl"] .order-recap-total .order-recap-value { direction: ltr; unicode-bidi: isolate; }
