/* ============================================================
   RTL Overrides – يُحمّل فقط عند اللغة العربية
   v1.1 – 2026-09-23
   + Fix: Mobile Header Symmetric Centering
   ============================================================ */

[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] body {
  font-family: 'Tajawal', 'Inter', sans-serif;
}

[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3,
[dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
[dir="rtl"] .hero-title,
[dir="rtl"] .section-title,
[dir="rtl"] .quote-text {
  font-family: 'Amiri', 'Cormorant Garamond', serif;
  letter-spacing: 0;
}

/* ============ Nav ============ */
[dir="rtl"] .nav-menu {
  margin-right: 0;
  margin-left: auto;
}

[dir="rtl"] .nav-link::after,
[dir="rtl"] .nav-link::before {
  right: 0;
  left: auto;
}

/* ============ Buttons / Icons ============ */
[dir="rtl"] .btn-icon,
[dir="rtl"] .arrow-right,
[dir="rtl"] .arrow-left {
  transform: scaleX(-1);
}

/* ============ Cart Offcanvas ============ */
[dir="rtl"] .cart-offcanvas {
  right: auto;
  left: 0;
  transform: translateX(-100%);
}
[dir="rtl"] .cart-offcanvas.open,
[dir="rtl"] .cart-offcanvas.active {
  transform: translateX(0);
}

/* ============ Forms ============ */
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select {
  text-align: right;
  direction: rtl;
}

/* أرقام وأسعار → LTR دايماً */
[dir="rtl"] .price,
[dir="rtl"] .qty,
[dir="rtl"] .order-number,
[dir="rtl"] .phone,
[dir="rtl"] input[type="number"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="email"] {
  direction: ltr;
  text-align: right;
  unicode-bidi: embed;
}

/* ============ Hero ============ */
[dir="rtl"] .hero-content {
  text-align: right;
  align-items: flex-start;
}

[dir="rtl"] .hero-buttons {
  justify-content: flex-start;
}

/* ============ Story / Advantages ============ */
[dir="rtl"] .advantages-grid,
[dir="rtl"] .story-grid {
  direction: rtl;
}

/* ============ Text Alignment helpers ============ */
[dir="rtl"] .text-left  { text-align: right; }
[dir="rtl"] .text-right { text-align: left; }

/* ============ Language Switcher Styling ============ */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  border-radius: 4px;
  transition: background 0.3s, color 0.3s;
}

.lang-switcher:hover {
  background: rgba(168, 120, 69, 0.15);
  color: #c49a68;
}

.lang-switcher .lang-flag {
  font-size: 16px;
  line-height: 1;
}

/* إخفاء اسم اللغة على الموبايل الصغير */
@media (max-width: 480px) {
  .lang-switcher .lang-name {
    display: none;
  }
}

/* ============================================================
   🆕 RTL Mobile Header – Symmetric Centering Fix
   v1.1 – يضمن تمركز الشعار تماماً على الموبايل في RTL
   ============================================================ */
@media (max-width: 768px) {

  /* 1) Container → CSS Grid بثلاثة أعمدة متساوية */
  [dir="rtl"] header .header-container {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    align-items: center !important;
    justify-content: stretch !important;
    padding-left: 0.9rem !important;
    padding-right: 0.9rem !important;
    gap: 0 !important;
    height: 58px !important;
    position: relative !important;
  }

  /* 2) الشعار → العمود الأوسط (المنتصف بالظبط) */
  [dir="rtl"] header .logo-center {
    grid-column: 2 !important;
    grid-row: 1 !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    justify-self: center !important;
    align-self: center !important;
    max-width: none !important;
    margin: 0 !important;
    z-index: 1 !important;
  }

  /* 3) Hamburger → يمين (العمود 3) */
  [dir="rtl"] header .hamburger {
    grid-column: 3 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: center !important;
    order: initial !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 2 !important;
  }

  /* 4) أيقونات Search + Cart → يسار (العمود 1) */
  [dir="rtl"] header .nav-right {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    align-self: center !important;
    margin: 0 !important;
    order: initial !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.9rem !important;
    z-index: 2 !important;
  }

  /* 5) إخفاء nav-left */
  [dir="rtl"] header .nav-left {
    display: none !important;
  }

  /* 6) Cart badge – يفضل على يمين الأيقونة (physical) */
  [dir="rtl"] header .cart-badge {
    right: -8px !important;
    left: auto !important;
  }

  /* 7) ضمان تناسق حجم الأيقونات */
  [dir="rtl"] header .nav-right .icon-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }

  [dir="rtl"] header .nav-right .icon-link svg {
    width: 18px !important;
    height: 18px !important;
    display: block !important;
  }

  /* 8) الـ hamburger – عرض ثابت 24px */
  [dir="rtl"] header .hamburger {
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
  }

  [dir="rtl"] header .hamburger span {
    width: 20px !important;
    height: 2px !important;
    background: var(--text) !important;
    display: block !important;
  }

  /* 9) الشعار – منع الانكماش */
  [dir="rtl"] header .logo-center a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.45rem !important;
    white-space: nowrap !important;
  }
}