/**
 * @file: language-switcher.css
 * @description: Стилі для перемикача мови
 * @created: 2026-01-04
 */

/* ═══════════════════════════════════════════════════════════
   LANGUAGE SWITCHER - DESKTOP
   ═══════════════════════════════════════════════════════════ */

.gotuimo-lang-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Кнопка поточної мови */
.gotuimo-lang-switcher__current {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gotuimo-lang-switcher__current:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ═══════════════════════════════════════════════════════════
   MAIN NAV INTEGRATION (primary location)
   ═══════════════════════════════════════════════════════════ */

.gotuimo-main-nav__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gotuimo-main-nav__lang {
    display: flex;
    align-items: center;
}

.gotuimo-main-nav .gotuimo-lang-switcher__current {
    border-color: rgba(0, 0, 0, 0.15);
    color: #333;
    padding: 8px 12px;
    background: #f5f5f5;
    font-size: 13px;
}

.gotuimo-main-nav .gotuimo-lang-switcher__current:hover {
    background: #eee;
    border-color: rgba(0, 0, 0, 0.25);
}

.gotuimo-main-nav .gotuimo-lang-switcher__flag {
    font-size: 18px;
}

.gotuimo-main-nav .gotuimo-lang-switcher__code {
    font-size: 13px;
    font-weight: 600;
}

/* Флаг */
.gotuimo-lang-switcher__flag {
    font-size: 16px;
    line-height: 1;
}

/* Код мови */
.gotuimo-lang-switcher__code {
    font-weight: 600;
    text-transform: uppercase;
}

/* Стрілка */
.gotuimo-lang-switcher__arrow {
    transition: transform 0.2s ease;
}

.gotuimo-lang-switcher.is-open .gotuimo-lang-switcher__arrow {
    transform: rotate(180deg);
}

/* ═══════════════════════════════════════════════════════════
   DROPDOWN МЕНЮ
   ═══════════════════════════════════════════════════════════ */

.gotuimo-lang-switcher__dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    padding: 8px 0;
    min-width: 160px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    list-style: none;
    margin: 0;
    /* ПРИХОВАНИЙ ЗА ЗАМОВЧУВАННЯМ */
    display: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

/* ВИДИМИЙ ТІЛЬКИ ПРИ .is-open */
.gotuimo-lang-switcher.is-open .gotuimo-lang-switcher__dropdown {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Пункти списку */
.gotuimo-lang-switcher__item {
    margin: 0;
    padding: 0;
}

.gotuimo-lang-switcher__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.15s ease;
}

.gotuimo-lang-switcher__link:hover {
    background: #f5f5f5;
    color: #333;
}

/* Активна мова */
.gotuimo-lang-switcher__link--active {
    background: #f0f7ff;
    color: #0066cc;
    font-weight: 500;
}

.gotuimo-lang-switcher__check {
    margin-left: auto;
    color: #0066cc;
}

/* Мова без перекладу (fallback) */
.gotuimo-lang-switcher__item--fallback .gotuimo-lang-switcher__link {
    color: #888;
}

.gotuimo-lang-switcher__item--fallback .gotuimo-lang-switcher__name {
    opacity: 0.7;
}

.gotuimo-lang-switcher__fallback-icon {
    margin-left: auto;
    font-size: 12px;
    opacity: 0.8;
}

/* Назва мови */
.gotuimo-lang-switcher__name {
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE VERSION
   ═══════════════════════════════════════════════════════════ */

.gotuimo-lang-switcher--mobile {
    width: 100%;
}

.gotuimo-lang-switcher--mobile .gotuimo-lang-switcher__current {
    width: 100%;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.gotuimo-lang-switcher--mobile .gotuimo-lang-switcher__dropdown {
    position: static;
    margin-top: 8px;
    width: 100%;
    transform: none;
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.gotuimo-lang-switcher--mobile.is-open .gotuimo-lang-switcher__dropdown {
    display: block;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .gotuimo-main-nav__lang {
        display: none; /* На планшетах/мобільних показуємо в мобільному меню */
    }
}

@media (max-width: 768px) {
    .gotuimo-main-nav__actions {
        display: none; /* Ховаємо на мобільних */
    }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE MENU LANGUAGE SECTION
   ═══════════════════════════════════════════════════════════ */

.gotuimo-mobile-menu__lang {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.gotuimo-mobile-menu__lang-label {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
}

/* ═══════════════════════════════════════════════════════════
   TOP BAR INTEGRATION (BuddyPress pages)
   ═══════════════════════════════════════════════════════════ */

.gotuimo-top-bar__account .gotuimo-lang-switcher {
    margin-right: 12px;
}

.gotuimo-top-bar__account .gotuimo-lang-switcher__current {
    border-color: rgba(0, 0, 0, 0.15);
    color: #333;
    padding: 6px 10px;
    background: #f5f5f5;
    font-size: 12px;
}

.gotuimo-top-bar__account .gotuimo-lang-switcher__current:hover {
    background: #eee;
    border-color: rgba(0, 0, 0, 0.25);
}

.gotuimo-top-bar__account .gotuimo-lang-switcher__flag {
    font-size: 16px;
}

.gotuimo-top-bar__account .gotuimo-lang-switcher__code {
    font-size: 12px;
}

/* На desktop якщо є main-nav - ховаємо в top-bar */
@media (min-width: 1025px) {
    body:not(.bp-user):not(.buddypress) .gotuimo-top-bar__account .gotuimo-lang-switcher {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════
   DARK MODE SUPPORT
   ═══════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
    .gotuimo-lang-switcher__dropdown {
        background: #2a2a2a;
    }
    
    .gotuimo-lang-switcher__link {
        color: #eee;
    }
    
    .gotuimo-lang-switcher__link:hover {
        background: #3a3a3a;
        color: #fff;
    }
    
    .gotuimo-lang-switcher__link--active {
        background: #1a3a5c;
        color: #66b3ff;
    }
}

/* ═══════════════════════════════════════════════════════════
   HIDE DEFAULT WPML LANGUAGE WIDGETS
   We have our own custom language switcher
   ═══════════════════════════════════════════════════════════ */

/* WPML Footer/Anywhere Language Switcher - HIDE ALL */
.wpml-ls,
.wpml-ls-statics-footer,
.wpml-ls-legacy-list-horizontal,
.wpml-ls-legacy-list-vertical,
.wpml-ls-legacy-dropdown,
.wpml-ls-legacy-dropdown-click,
.wpml-ls-statics-post_translations,
.wpml-ls-statics-shortcode_actions,
nav.wpml-ls-statics-footer,
[class*="wpml-ls-widget"],
.widget_icl_lang_sel_widget,
.widget_polylang_switcher,
#wpml-language-selector-widget,
#footer .wpml-ls,
.site-footer .wpml-ls,
footer .wpml-ls,
#colophon .wpml-ls,
.wpml-footer-language-bar,
.icl_langs_in_the_footer,
#lang_sel_footer {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Hide ANY <menu> tag that's not our custom dropdown (WPML adds menu tags) */
body > div.site menu:not(#wpadminbar menu),
main ~ menu,
#main ~ menu,
main + menu,
.buddypress menu[role="menu"],
.bp-user menu {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

