/**
 * AI Translate Pro — Language Switcher Styles
 */

/* ── Base switcher ────────────────────────────────────── */
.aitp-switcher {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    direction: ltr;
    box-sizing: border-box;
}
.aitp-switcher *, .aitp-switcher *::before, .aitp-switcher *::after {
    box-sizing: border-box;
}

/* ── Floating position ────────────────────────────────── */
.aitp-switcher:not(.aitp-switcher--inline) {
    position: fixed;
    z-index: 999998;
}
.aitp-switcher--bottom-right { bottom: 20px; right: 20px; }
.aitp-switcher--bottom-left  { bottom: 20px; left: 20px; }
.aitp-switcher--top-right    { top: 20px; right: 20px; }
.aitp-switcher--top-left     { top: 20px; left: 20px; }

/* ── Toggle button ────────────────────────────────────── */
.aitp-switcher__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid #1438521A;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    color: #143852;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.aitp-switcher__toggle:hover {
    background: #f8f9fa;
    border-color: #14385240;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.aitp-switcher__arrow {
    font-size: 10px;
    color: #8c8f94;
    transition: transform 0.2s;
}
.aitp-switcher__toggle[aria-expanded="true"] .aitp-switcher__arrow {
    transform: rotate(180deg);
}

/* ── Flag & name ──────────────────────────────────────── */
.aitp-switcher__flag {
    font-size: 18px;
    line-height: 1;
    display: inline-block;
    width: 20px;
    height: 15px;
    object-fit: contain;
    vertical-align: middle;
    border-radius: 2px;
}
img.aitp-switcher__flag {
    width: 20px;
    height: auto;
}
.aitp-switcher--size-large .aitp-switcher__flag {
    font-size: 24px;
    width: 28px;
    height: 21px;
}
.aitp-switcher--size-large img.aitp-switcher__flag {
    width: 28px;
}
.aitp-switcher--size-large .aitp-switcher__toggle,
.aitp-switcher--size-large .aitp-switcher__link {
    font-size: 16px;
    padding: 10px 16px;
}

/* Name visibility */
.aitp-switcher--names-full .aitp-switcher__name--short { display: none; }
.aitp-switcher--names-short .aitp-switcher__name--full { display: none; }
.aitp-switcher--names-none .aitp-switcher__name { display: none; }

/* Flag visibility */
.aitp-switcher--flags-hide .aitp-switcher__flag { display: none; }
.aitp-switcher--flags-after .aitp-switcher__toggle,
.aitp-switcher--flags-after .aitp-switcher__link {
    flex-direction: row-reverse;
}

/* ── Dropdown ─────────────────────────────────────────── */
.aitp-switcher__dropdown {
    position: absolute;
    min-width: 160px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.14);
    padding: 4px 0;
    margin: 0;
    list-style: none;
    overflow: hidden;
}
.aitp-switcher__dropdown[hidden] { display: none; }

/* Position dropdown above for bottom placement, below for top */
.aitp-switcher--bottom-right .aitp-switcher__dropdown,
.aitp-switcher--bottom-left .aitp-switcher__dropdown {
    bottom: calc(100% + 6px);
    left: 0;
}
.aitp-switcher--top-right .aitp-switcher__dropdown,
.aitp-switcher--top-left .aitp-switcher__dropdown {
    top: calc(100% + 6px);
    left: 0;
}
/* Inline / shortcode */
.aitp-switcher--inline .aitp-switcher__dropdown {
    top: calc(100% + 4px);
    left: 0;
}

.aitp-switcher__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    color: #143852;
    text-decoration: none;
    transition: background 0.12s;
    white-space: nowrap;
}
.aitp-switcher__link:hover {
    background: #f0f0f1;
    color: #143852;
    text-decoration: none;
}
.aitp-switcher__link--active {
    font-weight: 600;
    background: #f0f6fc;
}

/* ── Side-by-side type ────────────────────────────────── */
.aitp-switcher--side-by-side .aitp-switcher__toggle { display: none; }
.aitp-switcher--side-by-side .aitp-switcher__dropdown {
    position: static;
    display: flex !important;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.aitp-switcher--side-by-side .aitp-switcher__dropdown[hidden] {
    display: flex !important;
}

/* ── Theme: Dark ──────────────────────────────────────── */
.aitp-switcher--dark .aitp-switcher__toggle {
    background: #1D2327;
    color: #fff;
    border-color: #3c434a;
}
.aitp-switcher--dark .aitp-switcher__toggle:hover {
    background: #2c3338;
}
.aitp-switcher--dark .aitp-switcher__dropdown {
    background: #1D2327;
    border-color: #3c434a;
}
.aitp-switcher--dark .aitp-switcher__link {
    color: #fff;
}
.aitp-switcher--dark .aitp-switcher__link:hover {
    background: #2c3338;
    color: #fff;
}
.aitp-switcher--dark .aitp-switcher__link--active {
    background: #3c434a;
}
.aitp-switcher--dark .aitp-switcher__arrow { color: #a7aaad; }

/* ── Theme: Border ────────────────────────────────────── */
.aitp-switcher--border .aitp-switcher__toggle {
    background: #fff;
    border: 1px solid #143852;
    color: #143852;
}
.aitp-switcher--border .aitp-switcher__dropdown {
    border: 1px solid #143852;
}

/* ── Theme: Transparent ───────────────────────────────── */
.aitp-switcher--transparent .aitp-switcher__toggle {
    background: linear-gradient(135deg, rgba(200,210,230,0.6), rgba(180,170,210,0.4));
    color: #fff;
    border: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.aitp-switcher--transparent .aitp-switcher__toggle:hover {
    background: linear-gradient(135deg, rgba(200,210,230,0.8), rgba(180,170,210,0.6));
}
.aitp-switcher--transparent .aitp-switcher__dropdown {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
}
.aitp-switcher--transparent .aitp-switcher__arrow { color: rgba(255,255,255,0.7); }

/* ── Animations ───────────────────────────────────────── */
.aitp-switcher--animated .aitp-switcher__dropdown {
    transition: opacity 0.2s, transform 0.2s;
}
.aitp-switcher--animated .aitp-switcher__dropdown[hidden] {
    display: block !important;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
}
.aitp-switcher--animated .aitp-switcher__dropdown:not([hidden]) {
    opacity: 1;
    transform: translateY(0);
}

/* ── Flag shape ───────────────────────────────────────── */
.aitp-switcher--flags-square .aitp-switcher__flag {
    border-radius: 2px;
    overflow: hidden;
    aspect-ratio: 1;
    width: 20px;
    height: 20px;
    text-align: center;
    object-fit: cover;
}

/* ── Menu items ───────────────────────────────────────── */
.aitp-menu-flag {
    font-size: 16px;
    vertical-align: middle;
    display: inline-block;
    width: 20px;
    height: auto;
    border-radius: 2px;
}
img.aitp-menu-flag {
    width: 16px;
    height: auto;
}

/* ── Responsive ───────────────────────────────────────── */
@media screen and (max-width: 480px) {
    .aitp-switcher:not(.aitp-switcher--inline) {
        bottom: 10px !important;
        right: 10px !important;
        left: auto !important;
        top: auto !important;
    }
    .aitp-switcher__name--full { display: none; }
    .aitp-switcher__name--short { display: inline !important; }
}

/* ═══════════════════════════════════════════════════════
   Widget & Nav Menu Switcher  (.aitp-wsw)
   ═══════════════════════════════════════════════════════ */

.aitp-wsw {
    position: relative;
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}
.aitp-wsw * { box-sizing: border-box; }

/* ── Toggle button ── */
.aitp-wsw__toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.aitp-wsw__toggle:hover {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.25);
}
.aitp-wsw__toggle--nav {
    border: none;
    padding: 4px 8px;
    background: transparent;
}
.aitp-wsw__toggle--nav:hover {
    background: rgba(0,0,0,0.06);
    border: none;
}

/* ── Arrow ── */
.aitp-wsw__arrow {
    font-size: 10px;
    color: currentColor;
    opacity: 0.6;
    transition: transform 0.18s;
}
.aitp-wsw__toggle[aria-expanded="true"] .aitp-wsw__arrow {
    transform: rotate(180deg);
}

/* ── Dropdown list ── */
.aitp-wsw__list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 150px;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.13);
    z-index: 9999;
}
.aitp-wsw__list[hidden] { display: none; }

/* Nav menu item: open upward if space is tight */
.aitp-wsw--nav .aitp-wsw__list {
    left: auto;
}

/* ── Links inside list ── */
.aitp-wsw__link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    color: #1d2327;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.1s;
}
.aitp-wsw__link:hover {
    background: #f0f0f1;
    color: #1d2327;
    text-decoration: none;
}
.aitp-wsw__link--active {
    font-weight: 600;
    background: #f0f6fc;
}

/* ── Inline list style ── */
.aitp-wsw--list .aitp-wsw__links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.aitp-wsw--list .aitp-wsw__link {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
}
.aitp-wsw--list .aitp-wsw__link--active {
    border-color: currentColor;
}

/* ── Flag / code / name pieces ── */
.aitp-wsw__flag {
    font-size: 18px;
    line-height: 1;
    display: inline-block;
    width: 20px;
    height: 15px;
    object-fit: contain;
    vertical-align: middle;
    border-radius: 2px;
}
img.aitp-wsw__flag {
    width: 20px;
    height: auto;
}
.aitp-wsw__code {
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.aitp-wsw__name {
    font-size: 13px;
}

/* ── Nav menu host <li> ── */
li.aitp-nav-lang-item {
    position: relative;
    list-style: none;
}
li.aitp-nav-lang-item > .aitp-wsw {
    display: flex;
    align-items: center;
}

