/* ============================================================
   Language switcher widget — shared between landing & dashboard.
   The widget reads CSS variables that BOTH pages already define
   (--text, --text-muted, --secondary, --tertiary, --border,
   --bg-secondary, etc.) so no theme overrides are needed.
   Falls back to hardcoded values for any var not defined.
   ============================================================ */

.lang-switcher {
    position: relative;
    display: inline-block;
}

.lang-switcher .ls-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    color: var(--text, var(--text-primary, #1e293b));
    border: 1px solid var(--border, var(--border-color, #e2e8f0));
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1;
}

.lang-switcher .ls-trigger:hover {
    background: var(--tertiary, var(--bg-secondary, #f1f5f9));
}

.lang-switcher .ls-trigger[aria-expanded="true"] {
    background: var(--tertiary, var(--bg-secondary, #f1f5f9));
    border-color: var(--accent, #6366f1);
}

.lang-switcher .ls-name {
    font-size: 14px;
    white-space: nowrap;
}

/* Small rounded flag chip — rendered as inline SVG (no emoji, so it looks
   identical on Windows/macOS/Linux). Sits in both the trigger and options. */
.lang-switcher .ls-flag {
    flex: 0 0 auto;
    width: 22px;
    height: 16px;
    border-radius: 3px;
    overflow: hidden;
    line-height: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.lang-switcher .ls-flag svg {
    display: block;
    width: 100%;
    height: 100%;
}

.lang-switcher .ls-chevron {
    font-size: 10px;
    opacity: 0.6;
    margin-left: 2px;
    transition: transform 0.2s;
}

.lang-switcher .ls-trigger[aria-expanded="true"] .ls-chevron {
    transform: rotate(180deg);
}

.lang-switcher .ls-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    list-style: none;
    margin: 0;
    padding: 6px;
    background: var(--secondary, var(--bg-primary, #ffffff));
    color: var(--text, var(--text-primary, #1e293b));
    border: 1px solid var(--border, var(--border-color, #e2e8f0));
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 9999;
}

.lang-switcher .ls-menu[hidden] {
    display: none;
}

.lang-switcher .ls-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.12s;
}

.lang-switcher .ls-option:hover {
    background: var(--tertiary, var(--bg-secondary, #f1f5f9));
}

.lang-switcher .ls-option .ls-check {
    margin-left: auto;
    font-size: 11px;
    color: var(--accent, #6366f1);
    visibility: hidden;
}

.lang-switcher .ls-option.ls-active .ls-check {
    visibility: visible;
}

.lang-switcher .ls-option.ls-active {
    color: var(--accent, #6366f1);
    font-weight: 600;
}

/* The "full" variant (landing/login page) shows flag + native name.
   The "compact" variant (dashboard header) is restyled below as an icon
   button. On narrow viewports we shrink the full-variant trigger label
   rather than hide it, so it never becomes a blank pill. */
@media (max-width: 768px) {
    .lang-switcher .ls-trigger {
        padding: 8px 10px;
        font-size: 13px;
    }
    .lang-switcher .ls-name {
        font-size: 13px;
    }
    .lang-switcher .ls-flag {
        width: 20px;
        height: 14px;
    }
}

/* ============================================================
   Compact variant — dashboard header only.
   Rendered as a 40×40 icon button to match the neighbouring
   .header-icon-btn controls (theme/chat/bell/settings): flag only,
   no language name, no dropdown chevron. Scoped to
   [data-lang-switcher="compact"] which is used ONLY on the dashboard,
   so the pre-login landing switcher ("full") is unaffected.
   The extra .lang-switcher in the selector raises specificity above the
   base/media rules so these always win.
   ============================================================ */
[data-lang-switcher="compact"].lang-switcher .ls-trigger {
    width: 40px;
    height: 40px;
    padding: 0;
    gap: 0;
    border-radius: 10px;
    justify-content: center;
    color: var(--text-muted, #64748b);
}

[data-lang-switcher="compact"].lang-switcher .ls-trigger:hover,
[data-lang-switcher="compact"].lang-switcher .ls-trigger[aria-expanded="true"] {
    border-color: var(--accent, #6366f1);
    color: var(--accent-light, var(--accent, #6366f1));
    background: rgba(99, 102, 241, 0.1);
}

/* Hide the language name and the chevron ON THE TRIGGER only — the flag is
   the whole control. Scoped to .ls-trigger so the dropdown options keep
   their language names (e.g. «Հայերեն»). */
[data-lang-switcher="compact"].lang-switcher .ls-trigger .ls-name,
[data-lang-switcher="compact"].lang-switcher .ls-trigger .ls-chevron {
    display: none;
}

/* Keep the flag the same on mobile (the icon buttons don't shrink). */
@media (max-width: 768px) {
    [data-lang-switcher="compact"].lang-switcher .ls-trigger {
        width: 40px;
        height: 40px;
        padding: 0;
    }
    [data-lang-switcher="compact"].lang-switcher .ls-flag {
        width: 22px;
        height: 16px;
    }
}
