/* ============================================
   WP Translator - Frontend Language Selector
   ============================================ */

/* Floating widget positioning */
.wpt-floating {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}
.wpt-position-bottom-right { bottom: 20px; right: 20px; }
.wpt-position-bottom-left  { bottom: 20px; left: 20px; }
.wpt-position-top-right    { top: 20px; right: 20px; }
.wpt-position-top-left     { top: 20px; left: 20px; }

/* Dropdown toggle */
.wpt-dropdown {
    position: relative;
    display: inline-block;
}

.wpt-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    white-space: nowrap;
}
.wpt-dropdown-toggle:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.wpt-dropdown-toggle:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.wpt-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.wpt-dropdown.wpt-open .wpt-chevron {
    transform: rotate(180deg);
}

/* Dropdown menu */
.wpt-dropdown-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    list-style: none;
    margin: 0;
    padding: 6px;
    z-index: 1000;
}
.wpt-position-top-right .wpt-dropdown-menu,
.wpt-position-top-left .wpt-dropdown-menu {
    bottom: auto;
    top: calc(100% + 6px);
}
.wpt-position-bottom-left .wpt-dropdown-menu,
.wpt-position-top-left .wpt-dropdown-menu {
    right: auto;
    left: 0;
}

.wpt-dropdown.wpt-open .wpt-dropdown-menu {
    display: block;
    animation: wptSlideIn 0.2s ease;
}

@keyframes wptSlideIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Dropdown items */
.wpt-dropdown-item {
    margin: 0;
    padding: 0;
    list-style: none;
}
.wpt-dropdown-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s ease;
}
.wpt-dropdown-item a:hover {
    background: #f0f6fc;
}
.wpt-dropdown-item.wpt-active a {
    background: #e8f0fe;
    font-weight: 600;
    color: #0073aa;
}

/* Flag icons (emoji-based for simplicity) */
.wpt-flag {
    display: inline-block;
    width: 20px;
    height: 15px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 2px;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}
/* Using emoji flags for common languages */
.wpt-flag::before { display: inline-block; }
.wpt-flag-en::before { content: "🇬🇧"; }
.wpt-flag-es::before { content: "🇪🇸"; }
.wpt-flag-fr::before { content: "🇫🇷"; }
.wpt-flag-de::before { content: "🇩🇪"; }
.wpt-flag-it::before { content: "🇮🇹"; }
.wpt-flag-pt::before { content: "🇵🇹"; }
.wpt-flag-ru::before { content: "🇷🇺"; }
.wpt-flag-ja::before { content: "🇯🇵"; }
.wpt-flag-ko::before { content: "🇰🇷"; }
.wpt-flag-zh-CN::before { content: "🇨🇳"; }
.wpt-flag-zh-TW::before { content: "🇹🇼"; }
.wpt-flag-ar::before { content: "🇸🇦"; }
.wpt-flag-hi::before { content: "🇮🇳"; }
.wpt-flag-nl::before { content: "🇳🇱"; }
.wpt-flag-sv::before { content: "🇸🇪"; }
.wpt-flag-no::before { content: "🇳🇴"; }
.wpt-flag-da::before { content: "🇩🇰"; }
.wpt-flag-fi::before { content: "🇫🇮"; }
.wpt-flag-pl::before { content: "🇵🇱"; }
.wpt-flag-tr::before { content: "🇹🇷"; }
.wpt-flag-th::before { content: "🇹🇭"; }
.wpt-flag-vi::before { content: "🇻🇳"; }
.wpt-flag-id::before { content: "🇮🇩"; }
.wpt-flag-cs::before { content: "🇨🇿"; }
.wpt-flag-hu::before { content: "🇭🇺"; }
.wpt-flag-ro::before { content: "🇷🇴"; }
.wpt-flag-el::before { content: "🇬🇷"; }
.wpt-flag-he::before { content: "🇮🇱"; }
.wpt-flag-uk::before { content: "🇺🇦"; }
.wpt-flag-bg::before { content: "🇧🇬"; }
.wpt-flag-hr::before { content: "🇭🇷"; }
.wpt-flag-sk::before { content: "🇸🇰"; }
.wpt-flag-sl::before { content: "🇸🇮"; }
.wpt-flag-lt::before { content: "🇱🇹"; }
.wpt-flag-lv::before { content: "🇱🇻"; }
.wpt-flag-et::before { content: "🇪🇪"; }
.wpt-flag-sr::before { content: "🇷🇸"; }
.wpt-flag-bn::before { content: "🇧🇩"; }
.wpt-flag-ta::before { content: "🇮🇳"; }
.wpt-flag-te::before { content: "🇮🇳"; }
.wpt-flag-ml::before { content: "🇮🇳"; }
.wpt-flag-mr::before { content: "🇮🇳"; }
.wpt-flag-gu::before { content: "🇮🇳"; }
.wpt-flag-kn::before { content: "🇮🇳"; }
.wpt-flag-pa::before { content: "🇮🇳"; }
.wpt-flag-ur::before { content: "🇵🇰"; }
.wpt-flag-fa::before { content: "🇮🇷"; }
.wpt-flag-sw::before { content: "🇰🇪"; }
.wpt-flag-ms::before { content: "🇲🇾"; }
.wpt-flag-my::before { content: "🇲🇲"; }
.wpt-flag-km::before { content: "🇰🇭"; }
.wpt-flag-ne::before { content: "🇳🇵"; }
.wpt-flag-si::before { content: "🇱🇰"; }
.wpt-flag-ka::before { content: "🇬🇪"; }
.wpt-flag-hy::before { content: "🇦🇲"; }
.wpt-flag-az::before { content: "🇦🇿"; }
.wpt-flag-kk::before { content: "🇰🇿"; }
.wpt-flag-uz::before { content: "🇺🇿"; }
.wpt-flag-mn::before { content: "🇲🇳"; }
.wpt-flag-cy::before { content: "🏴"; }
.wpt-flag-ga::before { content: "🇮🇪"; }
.wpt-flag-eu::before { content: "🇪🇸"; }
.wpt-flag-gl::before { content: "🇪🇸"; }
.wpt-flag-ca::before { content: "🇪🇸"; }
.wpt-flag-mt::before { content: "🇲🇹"; }
.wpt-flag-is::before { content: "🇮🇸"; }
.wpt-flag-mk::before { content: "🇲🇰"; }
.wpt-flag-sq::before { content: "🇦🇱"; }
.wpt-flag-bs::before { content: "🇧🇦"; }
.wpt-flag-af::before { content: "🇿🇦"; }
.wpt-flag-so::before { content: "🇸🇴"; }
.wpt-flag-am::before { content: "🇪🇹"; }
.wpt-flag-lo::before { content: "🇱🇦"; }
.wpt-flag-tg::before { content: "🇹🇯"; }
.wpt-flag-ky::before { content: "🇰🇬"; }
.wpt-flag-ps::before { content: "🇦🇫"; }
.wpt-flag-ku::before { content: "🇮🇶"; }
.wpt-flag-ha::before { content: "🇳🇬"; }
.wpt-flag-yo::before { content: "🇳🇬"; }
.wpt-flag-zu::before { content: "🇿🇦"; }
.wpt-flag-lb::before { content: "🇱🇺"; }
.wpt-flag-mi::before { content: "🇳🇿"; }
.wpt-flag-ht::before { content: "🇭🇹"; }
.wpt-flag-yi::before { content: "🇮🇱"; }

/* Flags bar */
.wpt-flags-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd;
}
.wpt-flag-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    color: #555;
    font-size: 12px;
    transition: background 0.15s ease;
}
.wpt-flag-link:hover { background: #f0f6fc; }
.wpt-flag-link.wpt-active {
    background: #e8f0fe;
    font-weight: 600;
    color: #0073aa;
}

/* Inline/widget context resets */
.wpt-inline .wpt-dropdown-menu,
.wpt-widget .wpt-dropdown-menu {
    position: absolute;
    bottom: auto;
    top: calc(100% + 4px);
}

/* Mobile styles */
@media (max-width: 480px) {
    .wpt-floating {
        bottom: 10px !important;
        right: 10px !important;
        left: 10px !important;
    }
    .wpt-dropdown-menu {
        min-width: 160px;
        max-height: 250px;
    }
    .wpt-flags-bar {
        max-width: 100%;
    }
}

/* Scrollbar styling for dropdown */
.wpt-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}
.wpt-dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}
.wpt-dropdown-menu::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
.wpt-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* RTL support */
[dir="rtl"] .wpt-position-bottom-right { right: auto; left: 20px; }
[dir="rtl"] .wpt-position-bottom-left  { left: auto; right: 20px; }
[dir="rtl"] .wpt-dropdown-menu { right: auto; left: 0; }
