:root {
    --truelang-primary: #4f46e5;
    --truelang-primary-hover: #4338ca;
    --truelang-surface: #ffffff;
    --truelang-surface-soft: #f8fafc;
    --truelang-text: #0f172a;
    --truelang-muted: #64748b;
    --truelang-border: #e2e8f0;
    --truelang-shadow: 0 18px 50px rgba(15, 23, 42, .16);
}

.truelang-switcher,
.truelang-switcher * {
    box-sizing: border-box;
}

.truelang-switcher {
    position: relative;
    z-index: 999999;
    width: max-content;
    max-width: min(320px, calc(100vw - 24px));
    color: var(--truelang-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    direction: ltr;
}

.truelang-switcher--floating {
    position: fixed;
    margin: 20px;
}

.truelang-switcher--bottom-right { right: 0; bottom: 0; }
.truelang-switcher--bottom-left { left: 0; bottom: 0; }
.truelang-switcher--top-right { right: 0; top: 0; }
.truelang-switcher--top-left { left: 0; top: 0; }

.truelang-switcher__trigger {
    min-width: 154px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid rgba(148, 163, 184, .35);
    border-radius: 14px;
    background: rgba(255, 255, 255, .96);
    color: var(--truelang-text);
    box-shadow: 0 8px 30px rgba(15, 23, 42, .12);
    backdrop-filter: blur(14px);
    cursor: pointer;
    font: inherit;
    font-weight: 650;
    text-align: left;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease, background .2s ease;
}

.truelang-switcher__trigger:hover {
    border-color: rgba(79, 70, 229, .5);
    box-shadow: 0 12px 34px rgba(15, 23, 42, .16);
    transform: translateY(-1px);
}

.truelang-switcher__trigger:focus-visible,
.truelang-switcher__option:focus-visible {
    outline: 3px solid rgba(79, 70, 229, .28);
    outline-offset: 2px;
}

.truelang-switcher__flag {
    width: 24px;
    min-width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    font-size: 20px;
    line-height: 1;
    filter: saturate(.95);
}

.truelang-switcher__globe {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    color: var(--truelang-primary);
}

.truelang-switcher__current {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.truelang-switcher__chevron {
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    opacity: .55;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .2s ease;
}

.truelang-switcher.is-open .truelang-switcher__chevron {
    transform: rotate(225deg) translate(-1px, -1px);
}

.truelang-switcher__spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(79, 70, 229, .2);
    border-top-color: var(--truelang-primary);
    border-radius: 50%;
    animation: truelang-spin .7s linear infinite;
}

.truelang-switcher.is-loading .truelang-switcher__spinner { display: inline-block; }
.truelang-switcher.is-loading .truelang-switcher__chevron { display: none; }
.truelang-switcher.is-loading .truelang-switcher__trigger { cursor: progress; }

.truelang-switcher__menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    width: 286px;
    max-width: calc(100vw - 24px);
    overflow: hidden;
    border: 1px solid var(--truelang-border);
    border-radius: 18px;
    background: var(--truelang-surface);
    box-shadow: var(--truelang-shadow);
    transform-origin: bottom right;
    animation: truelang-menu-in .18s ease both;
}

.truelang-switcher--top-right .truelang-switcher__menu,
.truelang-switcher--top-left .truelang-switcher__menu,
.truelang-switcher:not(.truelang-switcher--floating) .truelang-switcher__menu {
    top: calc(100% + 10px);
    bottom: auto;
    transform-origin: top right;
}

.truelang-switcher--bottom-left .truelang-switcher__menu,
.truelang-switcher--top-left .truelang-switcher__menu {
    left: 0;
    right: auto;
}

.truelang-switcher__menu[hidden] { display: none !important; }

.truelang-switcher__menu-header {
    padding: 14px 16px 10px;
    color: var(--truelang-muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.truelang-switcher__options {
    max-height: min(360px, 55vh);
    overflow: auto;
    padding: 6px;
}

.truelang-switcher__option {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 52px;
    padding: 8px 10px;
    border-radius: 12px;
    color: var(--truelang-text);
    text-decoration: none !important;
    box-shadow: none !important;
    transition: background .16s ease, color .16s ease;
}

.truelang-switcher__option:hover {
    background: var(--truelang-surface-soft);
    color: var(--truelang-text);
}

.truelang-switcher__option.is-active {
    background: rgba(79, 70, 229, .09);
    color: var(--truelang-primary-hover);
}

.truelang-switcher__language-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.truelang-switcher__language-copy strong {
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.truelang-switcher__language-copy small {
    color: var(--truelang-muted);
    font-size: 11px;
}

.truelang-switcher__check {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--truelang-primary);
    color: #fff;
    font-size: 12px;
    opacity: 0;
    transform: scale(.75);
    transition: opacity .16s ease, transform .16s ease;
}

.truelang-switcher__option.is-active .truelang-switcher__check {
    opacity: 1;
    transform: scale(1);
}

.truelang-switcher--compact .truelang-switcher__trigger {
    min-width: 0;
    width: 48px;
    padding: 0 11px;
}

.truelang-switcher--compact .truelang-switcher__current,
.truelang-switcher--compact .truelang-switcher__chevron {
    display: none;
}

@keyframes truelang-spin { to { transform: rotate(360deg); } }
@keyframes truelang-menu-in {
    from { opacity: 0; transform: translateY(5px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 480px) {
    .truelang-switcher--floating { margin: 12px; }
    .truelang-switcher__trigger { min-width: 144px; height: 46px; }
    .truelang-switcher__menu { width: min(286px, calc(100vw - 24px)); }
}

@media (prefers-reduced-motion: reduce) {
    .truelang-switcher *,
    .truelang-switcher *::before,
    .truelang-switcher *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

@media (prefers-color-scheme: dark) {
    .truelang-switcher {
        --truelang-surface: #111827;
        --truelang-surface-soft: #1f2937;
        --truelang-text: #f8fafc;
        --truelang-muted: #94a3b8;
        --truelang-border: #334155;
        --truelang-shadow: 0 18px 50px rgba(0, 0, 0, .36);
    }

    .truelang-switcher__trigger {
        background: rgba(17, 24, 39, .96);
        border-color: rgba(148, 163, 184, .25);
    }
}

/* TrueLang 2.7 switcher layouts and local SVG flags. */
.truelang-switcher__flag {
    display: block;
    width: 24px;
    min-width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .12);
}

.truelang-switcher--horizontal,
.truelang-switcher--vertical {
    width: auto;
    max-width: 100%;
    z-index: auto;
}

.truelang-switcher--horizontal .truelang-switcher__options,
.truelang-switcher--vertical .truelang-switcher__options {
    display: flex;
    max-height: none;
    overflow: visible;
    padding: 0;
    gap: 8px;
}

.truelang-switcher--horizontal .truelang-switcher__options {
    flex-flow: row wrap;
}

.truelang-switcher--vertical .truelang-switcher__options {
    flex-direction: column;
}

.truelang-switcher--horizontal .truelang-switcher__option,
.truelang-switcher--vertical .truelang-switcher__option {
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--truelang-border);
    border-radius: 10px;
    background: var(--truelang-surface);
}

.truelang-switcher--horizontal .truelang-switcher__language-copy,
.truelang-switcher--vertical .truelang-switcher__language-copy {
    flex: initial;
}

.truelang-switcher--horizontal .truelang-switcher__check,
.truelang-switcher--vertical .truelang-switcher__check {
    margin-inline-start: 2px;
}

.truelang-switcher--no-flags .truelang-switcher__option {
    gap: 7px;
}

.elementor-widget-truelang-language-switcher .truelang-switcher {
    font-family: inherit;
}
