/* ==========================================================
   Client-site language DROPDOWN (Atlas Auto + Medina Cars)
   Sits inside .nav-cta, just before the "Réserver" button.
   Compact trigger ▾ → menu opens below with the language list.
   ========================================================== */

.lang-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-right: 10px;
    font-family: inherit;
}

/* ----- Trigger (the visible pill in the navbar) ----- */
.lang-dropdown__trigger {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px 7px 9px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 999px;
    color: var(--text, #f5f1e8);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    line-height: 1;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.lang-dropdown__trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.lang-dropdown__trigger:focus-visible {
    outline: 2px solid var(--gold, #e2b464);
    outline-offset: 2px;
}

.lang-dropdown__globe,
.lang-dropdown__caret {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.85;
}

.lang-dropdown__caret {
    transition: transform 180ms ease;
}

.lang-dropdown__trigger[aria-expanded="true"] .lang-dropdown__caret {
    transform: rotate(180deg);
}

.lang-dropdown__current {
    min-width: 18px;
    text-align: center;
}

/* ----- Menu (drops below the trigger) ----- */
.lang-dropdown__menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #15151a;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45),
                0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 80;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 140ms ease, transform 140ms ease;
}

.lang-dropdown__menu:not([hidden]) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.lang-dropdown__menu li {
    margin: 0;
    padding: 0;
}

.lang-dropdown__menu button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.78);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: background 120ms ease, color 120ms ease;
}

.lang-dropdown__menu button:hover,
.lang-dropdown__menu button:focus-visible {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    outline: none;
}

.lang-dropdown__menu button[aria-selected="true"] {
    background: rgba(226, 180, 100, 0.14);    /* gold tint */
    color: var(--gold, #e2b464);
}

.lang-dropdown__code {
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

.lang-dropdown__menu button[aria-selected="true"] .lang-dropdown__code {
    color: var(--gold, #e2b464);
}

.lang-dropdown__name {
    flex: 1;
    text-align: right;
}

.lang-dropdown__menu button[lang="ar"] .lang-dropdown__name {
    font-family: 'Noto Sans Arabic', 'Inter', system-ui, sans-serif;
    font-size: 14px;
    direction: rtl;
}

/* ==========================================================
   Light theme override — Medina Cars
   ========================================================== */
body.theme-medina .lang-dropdown__trigger {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.10);
    color: var(--text, #2a1d12);
}
body.theme-medina .lang-dropdown__trigger:hover {
    background: rgba(0, 0, 0, 0.07);
    border-color: rgba(0, 0, 0, 0.18);
}

body.theme-medina .lang-dropdown__menu {
    background: #fffaf2;
    border-color: rgba(0, 0, 0, 0.10);
    box-shadow: 0 12px 32px rgba(60, 30, 10, 0.18),
                0 2px 6px rgba(60, 30, 10, 0.10);
}
body.theme-medina .lang-dropdown__menu button {
    color: rgba(0, 0, 0, 0.72);
}
body.theme-medina .lang-dropdown__menu button:hover,
body.theme-medina .lang-dropdown__menu button:focus-visible {
    background: rgba(196, 123, 42, 0.10);
    color: #2a1d12;
}
body.theme-medina .lang-dropdown__menu button[aria-selected="true"] {
    background: rgba(196, 123, 42, 0.16);
    color: var(--medina-accent, #c47b2a);
}
body.theme-medina .lang-dropdown__code {
    color: rgba(0, 0, 0, 0.45);
}
body.theme-medina .lang-dropdown__menu button[aria-selected="true"] .lang-dropdown__code {
    color: var(--medina-accent, #c47b2a);
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 640px) {
    .lang-dropdown { margin-right: 6px; }
    .lang-dropdown__trigger {
        padding: 6px 8px;
        font-size: 11.5px;
        gap: 4px;
    }
    .lang-dropdown__globe,
    .lang-dropdown__caret { width: 12px; height: 12px; }
    .lang-dropdown__menu { min-width: 170px; right: 0; }
}

/* ==========================================================
   RTL — when Arabic is active
   ========================================================== */
html[dir="rtl"] body {
    font-family: 'Noto Sans Arabic', 'Inter', system-ui, sans-serif;
}

html[dir="rtl"] .lang-dropdown {
    margin-right: 0;
    margin-left: 10px;
}

html[dir="rtl"] .lang-dropdown__menu {
    right: auto;
    left: 0;
}

html[dir="rtl"] .lang-dropdown__menu button {
    text-align: right;
}

html[dir="rtl"] .lang-dropdown__name {
    text-align: left;
}

html[dir="rtl"] .navbar__inner,
html[dir="rtl"] .nav-cta,
html[dir="rtl"] .nav-links {
    direction: rtl;
}

html[dir="rtl"] .hero__cta,
html[dir="rtl"] .final-cta__buttons,
html[dir="rtl"] .promo__cta {
    flex-direction: row-reverse;
}

html[dir="rtl"] .car-card__footer {
    flex-direction: row-reverse;
}

html[dir="rtl"] .footer__grid {
    direction: rtl;
}

/* Keep the WhatsApp floating button on the same side regardless of dir */
html[dir="rtl"] .wa-float {
    right: auto;
    left: 24px;
}

/* Stat blocks — strong + small inline alignment */
html[dir="rtl"] .hero__stat strong small {
    margin-right: 2px;
}

/* Booking form */
html[dir="rtl"] .booking,
html[dir="rtl"] .booking__field {
    text-align: right;
}

/* Language-specific font tweaks */
body.lang-ar h1,
body.lang-ar h2,
body.lang-ar h3 {
    letter-spacing: 0;
    line-height: 1.35;
}

body.lang-de h1,
body.lang-de h2 {
    /* German words can be long — slightly tighter tracking */
    letter-spacing: -0.005em;
    word-break: break-word;
}
