/* ==========================================================================
   Azee ViralHub — Localization & Language System (Chapter 43 / MD 43)
   --------------------------------------------------------------------------
   Frontend delivery layer for the already-existing Multi-Language,
   Localization & Currency backend (Chapter 24 — /api/localization/*,
   App\Controllers\LocalizationController, `languages` / `language_phrases`
   / `localization_settings` tables). This stylesheet covers:
     - The Dynamic Language Switcher widget (assets/js/i18n.js injects the
       markup; this file only styles it, mirroring the existing
       .notif-dropdown pattern so it looks native to every page).
     - Base RTL/LTR Support: safe, additive [dir="rtl"] overrides for the
       shared site chrome (header, nav, sidebar, footer). Component-level
       CSS elsewhere is untouched — Bootstrap's own RTL build handles its
       utility classes (assets/js/i18n.js swaps the Bootstrap stylesheet
       to bootstrap.rtl.min.css when an RTL language is active).
     - Mobile Optimization Standards: fully responsive language controls.
   Loaded on every page, right after assets/css/tokens.css, so its
   variables (--color-purple, --bg-card, --border-soft, etc.) are always
   available. Purely additive — nothing here removes or overrides any
   pre-existing selector outside the [dir="rtl"] and .lang-* namespaces.
   ========================================================================== */

/* ---------- Dynamic Language Switcher ---------- */
.lang-switcher{ position:relative; display:inline-flex; }

.lang-switcher .lang-switcher-btn{
  display:flex; align-items:center; gap:6px; font-weight:700; font-size:12.5px;
  letter-spacing:.02em; white-space:nowrap; padding:0 12px; width:auto; min-width:42px;
}
.lang-switcher .lang-flag{ font-size:15px; line-height:1; }
.lang-switcher .lang-code{ text-transform:uppercase; }

.lang-dropdown{
  position:absolute; top:calc(100% + 12px); right:0; width:230px; max-width:88vw;
  background:var(--bg-card); border-radius:16px; box-shadow:0 16px 40px rgba(20,10,50,.18);
  border:1px solid var(--border-soft, #ECEAF6); z-index:1300; opacity:0; visibility:hidden;
  transform:translateY(-8px); transition:opacity .18s ease, transform .18s ease;
  display:flex; flex-direction:column; overflow:hidden; max-height:360px;
}
.lang-switcher.open .lang-dropdown{ opacity:1; visibility:visible; transform:translateY(0); }
.lang-dropdown-head{
  padding:12px 16px; border-bottom:1px solid var(--border-soft, #ECEAF6);
  font-size:12.5px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:.04em;
}
.lang-dropdown-list{ overflow-y:auto; max-height:300px; }
.lang-option{
  display:flex; align-items:center; gap:10px; width:100%; padding:10px 16px; border:none; background:none;
  cursor:pointer; text-align:left; font-size:13.5px; color:var(--text-primary);
}
.lang-option:hover{ background:var(--bg-secondary); }
.lang-option.active{ background:rgba(108,43,217,.08); color:var(--color-purple); font-weight:600; }
.lang-option .lang-flag{ font-size:17px; }
.lang-option-names{ display:flex; flex-direction:column; line-height:1.25; flex:1; min-width:0; }
.lang-option-native{ font-weight:600; }
.lang-option-en{ font-size:11.5px; color:var(--text-muted); }
.lang-option .bi-check-lg{ margin-left:auto; color:var(--color-purple); }
.lang-dropdown-empty{ padding:18px 16px; text-align:center; font-size:12.5px; color:var(--text-muted); }

@media (max-width:576px){
  .lang-dropdown{ position:fixed; top:var(--header-height, 70px); left:12px; right:12px; width:auto; max-width:none; }
}

/* ---------- RTL / LTR Support ----------
   Applied whenever the active language's `direction` is `rtl` AND the
   admin's "RTL Support" Locale Setting is enabled — see assets/js/i18n.js.
   Kept intentionally shallow: it flips the shared chrome's flow direction
   and lets Bootstrap's own RTL build (swapped in by i18n.js) handle every
   component built from Bootstrap utility/grid classes. */
[dir="rtl"]{ text-align:right; }
[dir="rtl"] .site-header .nav-wrap,
[dir="rtl"] .nav-cta,
[dir="rtl"] .header-actions,
[dir="rtl"] .mobile-nav-panel,
[dir="rtl"] .app-header{ direction:rtl; }
[dir="rtl"] .header-search i{ left:auto; right:16px; }
[dir="rtl"] .header-search input{ padding:0 44px 0 20px; }
[dir="rtl"] .app-sidebar{ right:0; left:auto; }
[dir="rtl"] .sidebar-link i{ margin-right:0; margin-left:10px; }
[dir="rtl"] .notif-dropdown,
[dir="rtl"] .lang-dropdown{ right:auto; left:0; }
[dir="rtl"] .icon-btn .dot{ right:auto; left:6px; }
[dir="rtl"] .lang-option{ text-align:right; }
[dir="rtl"] .lang-option .bi-check-lg{ margin-left:0; margin-right:auto; }
[dir="rtl"] .mobile-nav-toggle,
[dir="rtl"] .hamburger-btn{ transform:scaleX(-1); }

/* Landing header: the switcher is injected dynamically after the currency
   control, so it needs the same compact flex rules as the native controls. */
@media (max-width:576px){
  .site-header .lang-switcher{flex:0 0 auto;min-width:0;}
  .site-header .lang-dropdown{top:68px;}
}
