/**
 * FLAVOR Translate — Language Switcher Styles
 */

.ft-language-switcher {
    font-size: 14px;
    line-height: 1.4;
}

/* List mode */
.ft-switcher-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ft-switcher-list li {
    display: inline-block;
}

.ft-switcher-list a {
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.ft-switcher-list a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.ft-switcher-list .ft-active .ft-current {
    font-weight: 700;
    padding: 4px 8px;
}

/* Dropdown mode */
.ft-switcher-dropdown {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    min-width: 80px;
}

/* Flags mode */
.ft-switcher-flags {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.ft-switcher-flags a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.ft-switcher-flags a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.ft-switcher-flags .ft-active {
    font-weight: 700;
}

.ft-flag-icon {
    display: inline-block;
    width: 20px;
    height: 15px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 2px;
    vertical-align: middle;
    object-fit: contain;
}

/* Menu dropdown mode
 *
 * Injected as the LAST item into arbitrary theme menus — the rules below
 * deliberately use targeted !important on FUNCTION-critical properties,
 * because theme selectors (nav ul li a, .main-navigation ul ul ...) are
 * almost always more specific than our single classes. Design intent:
 * the TOGGLE inherits the theme's menu typography (native look), the
 * PANEL enforces its own neutral look (always readable, never half
 * theme-styled). */
.ft-menu-dropdown {
    position: relative;
}

/* Themes style THEIR menu items inline via their own selector chains
 * (#main-nav > li, .nav > li ...) — an appended li falls back to the
 * browser default display:list-item = BLOCK, full row width. Symptoms:
 * switcher wraps onto its own line below the menu, and the right:0
 * panel anchors to the full-width row (appears far off to the side).
 * Forcing a shrink-wrapped inline item + pinned containing block fixes
 * both. inline-flex behaves correctly inside flex menus (becomes a
 * flex item), inline-block menus and plain lists. */
li.ft-menu-switcher {
    position: relative !important;
    display: inline-flex !important;
    align-items: center;
    width: auto !important;
    max-width: none !important;
    float: none;
    vertical-align: middle;
}

li.ft-menu-switcher > a.ft-menu-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    /* "Deutsch (Österreich) ▾" must never wrap inside a menu bar */
    white-space: nowrap;
}

.ft-dropdown-arrow {
    font-size: 10px;
    line-height: 1;
}

/* Flag size hardening: themes with `nav li img { width: 100% }` or
 * `max-width: 100%; height: auto` would blow a 20px flag up to full
 * column width — THE classic injected-switcher bug. */
li.ft-menu-switcher img.ft-flag-icon,
.ft-menu-dropdown-list img.ft-flag-icon {
    width: 20px !important;
    height: 15px !important;
    max-width: 20px !important;
    max-height: 15px !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-block !important;
    vertical-align: middle;
}

/* Last menu item → panel opens right-aligned (never off-viewport),
 * even when the theme's `.sub-menu { left: 0 }` is more specific. */
li.ft-menu-switcher > .ft-menu-dropdown-list {
    display: none;
    position: absolute !important;
    top: 100% !important;
    margin-top: 0 !important;
    right: 0 !important;
    left: auto !important;
    min-width: 0;
    width: max-content;
    background: #fff !important;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 4px 0;
    margin: 0;
    list-style: none;
    z-index: 99999;
    /* Defeat theme float/transform inheritance on sub-menus */
    float: none;
    text-align: left;
}

/* Open state must WIN against every theme hidden-state pattern:
 * display:none, opacity/visibility transitions, translateY transforms,
 * pointer-events traps — themes only know their own hover/.toggled-on
 * classes, not our .ft-open click state. */
li.ft-menu-switcher:hover > .ft-menu-dropdown-list,
li.ft-menu-switcher.ft-open > .ft-menu-dropdown-list {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto !important;
    clip: auto !important;
    clip-path: none !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

.ft-menu-dropdown-list li {
    display: block;
    width: 100%;
    margin: 0;
}

/* Panel links: enforce readable neutral styling — a half-applied theme
 * dropdown skin (dark bg + our grey text) would be unreadable. */
li.ft-menu-switcher > .ft-menu-dropdown-list a {
    display: flex !important;
    align-items: center;
    gap: 6px;
    padding: 6px 12px !important;
    text-decoration: none;
    color: #333 !important;
    background: transparent;
    white-space: nowrap;
    font-size: 14px;
    line-height: 1.5;
    transition: background-color 0.15s;
}

li.ft-menu-switcher > .ft-menu-dropdown-list a:hover {
    background-color: #f5f5f5 !important;
    color: #111 !important;
}

/* Collapsed/hamburger menus: absolute positioning inside an accordion
 * overlaps following items — render the languages inline instead. */
@media (max-width: 782px) {
    /* In stacked hamburger menus the switcher behaves like a normal
     * full-width accordion entry again */
    li.ft-menu-switcher {
        display: block !important;
        width: 100% !important;
    }

    li.ft-menu-switcher > .ft-menu-dropdown-list {
        position: static !important;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background: transparent !important;
        width: auto;
        padding: 0 0 0 16px;
    }

    li.ft-menu-switcher > .ft-menu-dropdown-list a {
        color: inherit !important;
        background: transparent !important;
    }
}

/* === RTL: Switcher-Anpassungen === */
[dir="rtl"] .ft-language-switcher.ft-switcher-list,
.ft-rtl .ft-language-switcher.ft-switcher-list {
    direction: rtl;
}

[dir="rtl"] .ft-language-switcher .ft-flag,
.ft-rtl .ft-language-switcher .ft-flag {
    margin-left: 6px;
    margin-right: 0;
}
