/**
 * Frontend styles for the Alien Tools language switcher.
 *
 * Five visual variants, all share the `.at-langsw` base class:
 *   .at-langsw--dropdown            — current code + caret, click opens vertical list
 *   .at-langsw--select-name         — native <select>, full language names
 *   .at-langsw--select-flag         — native <select>, flag emojis only
 *   .at-langsw--select-flag_name    — native <select>, flag + name
 *   .at-langsw--inline              — horizontal list "DE | ES | FR | IT"
 *
 * Plus fixed positioning helpers:
 *   .at-langsw--fixed.at-langsw--fixed-top-right    (and -top-left, -bottom-right, -bottom-left)
 */

.at-langsw {
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    color: inherit;
}

.at-langsw *,
.at-langsw *::before,
.at-langsw *::after {
    box-sizing: inherit;
}

/* ----------------------------------------------------------------------------
 * Dropdown — current language code button + collapsible list
 * --------------------------------------------------------------------------*/

.at-langsw--dropdown {
    position: relative;
    display: inline-block;
}

.at-langsw__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 4px;
    color: inherit;
    font: inherit;
    font-weight: 500;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.at-langsw__toggle:hover {
    background: rgba(0, 0, 0, 0.08);
}

.at-langsw__toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.at-langsw__caret {
    font-size: 0.85em;
    transition: transform 0.15s ease;
}

.at-langsw--dropdown.is-open .at-langsw__caret {
    transform: rotate(180deg);
}

.at-langsw__list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
    z-index: 9999;
    display: none;
}

.at-langsw--dropdown.is-open .at-langsw__list {
    display: block;
}

.at-langsw__item {
    margin: 0;
    padding: 0;
}

.at-langsw__link {
    display: block;
    padding: 6px 14px;
    color: inherit;
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.at-langsw__link:hover {
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
}

.at-langsw__link.is-current {
    background: rgba(0, 0, 0, 0.04);
    cursor: default;
}

/* ----------------------------------------------------------------------------
 * Select — native <select>, three label variants
 * --------------------------------------------------------------------------*/

.at-langsw--select {
    display: inline-flex;
    align-items: center;
}

.at-langsw__select {
    padding: 6px 28px 6px 10px;
    background-color: transparent;
    color: inherit;
    border: 1px solid currentColor;
    border-radius: 4px;
    font: inherit;
    line-height: 1.3;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
}

.at-langsw__select:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.at-langsw__noscript-go {
    margin-left: 6px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 4px;
    color: inherit;
    cursor: pointer;
}

/* ----------------------------------------------------------------------------
 * Inline codes — DE | ES | FR | IT
 * --------------------------------------------------------------------------*/

.at-langsw--inline {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.at-langsw--inline .at-langsw__item {
    display: inline-flex;
    align-items: center;
}

.at-langsw--inline .at-langsw__link {
    padding: 4px 8px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.at-langsw--inline .at-langsw__link:hover {
    background: transparent;
    text-decoration: underline;
}

.at-langsw--inline .at-langsw__link.is-current {
    background: transparent;
    text-decoration: underline;
}

.at-langsw__sep {
    color: currentColor;
    opacity: 0.4;
    margin: 0 2px;
    font-size: 0.9em;
}

/* ----------------------------------------------------------------------------
 * Fixed positioning helpers — body-level placement
 * --------------------------------------------------------------------------*/

.at-langsw--fixed {
    position: fixed;
    z-index: 99999;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.94);
    color: #1a1a1a;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
}

.at-langsw--fixed-top-right    { top: 16px;    right: 16px; }
.at-langsw--fixed-top-left     { top: 16px;    left: 16px; }
.at-langsw--fixed-bottom-right { bottom: 16px; right: 16px; }
.at-langsw--fixed-bottom-left  { bottom: 16px; left: 16px; }

@media (prefers-color-scheme: dark) {
    .at-langsw--fixed {
        background: rgba(20, 20, 20, 0.94);
        color: #f0f0f0;
        border-color: rgba(255, 255, 255, 0.15);
    }
    .at-langsw__list {
        background: #1a1a1a;
        color: #f0f0f0;
        border-color: rgba(255, 255, 255, 0.15);
    }
    .at-langsw__link:hover {
        background: rgba(255, 255, 255, 0.08);
    }
    .at-langsw__link.is-current {
        background: rgba(255, 255, 255, 0.05);
    }
}
