/* mhf-i18n.css — RTL + language-switcher styles.
 * Load AFTER the page's main stylesheet so these override where needed.
 * The [dir="rtl"] block only activates when mhf-i18n.js sets dir="rtl"
 * on the <html> element (Arabic + Urdu). For LTR languages nothing changes.
 */

/* ─── Language switcher (dropdown in header) ─────────────────────── */
.mhf-lang-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 12px;
}

.mhf-lang-switcher select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid rgba(28, 20, 16, 0.15);
  color: #1c1410;
  padding: 8px 30px 8px 12px;
  border-radius: 100px;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%231c1410' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 6px;
}

.mhf-lang-switcher select:hover {
  border-color: rgba(28, 20, 16, 0.3);
  background-color: rgba(28, 20, 16, 0.03);
}

.mhf-lang-switcher select:focus {
  outline: none;
  border-color: #F05A1A;
  box-shadow: 0 0 0 3px rgba(240, 90, 26, 0.15);
}

.mhf-lang-switcher select option {
  color: #1c1410;
  background: #ffffff;
  font-weight: 500;
}

/* ─── RTL Support ─────────────────────────────────────────────────── */
/* Activated only when <html dir="rtl"> — set by mhf-i18n.js for Arabic + Urdu.
 * This block flips key directional properties without touching LTR pages. */

html[dir="rtl"] body {
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Plus Jakarta Sans', 'Segoe UI', Roboto, sans-serif;
  text-align: right;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4 {
  font-family: 'Amiri', 'Playfair Display', Georgia, serif;
  line-height: 1.4;
}

/* Urdu prefers a Nastaliq or Naskh font — swap in when lang="ur" */
html[lang="ur"] body,
html[lang="ur"] h1,
html[lang="ur"] h2,
html[lang="ur"] h3 {
  font-family: 'Noto Nastaliq Urdu', 'Noto Sans Arabic', -apple-system, sans-serif;
  line-height: 2;
}

/* Flip flex row direction inside common horizontal containers */
html[dir="rtl"] .nav,
html[dir="rtl"] .header-row,
html[dir="rtl"] .cta-row,
html[dir="rtl"] .footer-row,
html[dir="rtl"] .trust-bar {
  flex-direction: row-reverse;
}

/* Arrow icons should point the other way in RTL. Most inline SVGs in this
 * codebase use an arrow-right glyph next to CTA text — flip horizontally. */
html[dir="rtl"] .btn svg,
html[dir="rtl"] .arrow,
html[dir="rtl"] a svg.arrow {
  transform: scaleX(-1);
}

/* Border-left / border-right swaps used in blockquote-style highlights */
html[dir="rtl"] [style*="border-left:"] {
  border-left: none !important;
  border-right: 2px solid #c4501c !important;
  padding-left: 0 !important;
  padding-right: 14px !important;
}

/* Padding/margin flips for the language switcher inside a RTL header */
html[dir="rtl"] .mhf-lang-switcher {
  margin-left: 0;
  margin-right: 12px;
}

html[dir="rtl"] .mhf-lang-switcher select {
  padding: 8px 12px 8px 30px;
  background-position: left 12px center;
}

/* Text alignment for form inputs — RTL should have right-aligned placeholders
 * but LEFT-aligned numeric inputs (card number, amount) for clarity. */
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="text"]:not([inputmode="numeric"]):not([type="tel"]) {
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] input[type="number"],
html[dir="rtl"] input[inputmode="numeric"],
html[dir="rtl"] input[type="tel"] {
  text-align: left;
  direction: ltr;
}

/* Amount and price displays stay LTR even in RTL context — currency amounts
 * like "$100" read more naturally when kept left-to-right. */
html[dir="rtl"] .amount,
html[dir="rtl"] .price,
html[dir="rtl"] [data-i18n^="amount."] {
  direction: ltr;
  unicode-bidi: embed;
  display: inline-block;
}

/* Modest FOUC mitigation — hide body until i18n is applied (max ~200ms).
 * The [data-i18n-ready="1"] attribute is set on <html> at the end of init(). */
html:not([data-i18n-ready]) body {
  opacity: 0;
}
html[data-i18n-ready] body {
  opacity: 1;
  transition: opacity 100ms ease;
}
