/* Hide original top bar Polylang dropdown when nav switcher is active */
.top-bar:has(~ .site-header .apb-lang-switcher),
body.apb-has-hero .top-bar {
    display: none;
}

/* Language Switcher - Continent-grouped dropdown */
.apb-lang-switcher {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: auto;
    order: 999;
}
.apb-lang-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}
.apb-lang-toggle:hover {
    border-color: rgba(255,255,255,0.6);
}
.apb-lang-toggle img {
    width: 20px;
    height: 14px;
    border-radius: 2px;
}
.apb-lang-toggle::after {
    content: "\25BE";
    font-size: 10px;
    opacity: 0.7;
}

/* Dropdown panel */
.apb-lang-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #dce0e6;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    width: 780px;
    max-width: 95vw;
    z-index: 9999;
    padding: 20px;
}
.apb-lang-panel.apb-lang-open {
    display: flex;
    gap: 20px;
}

/* Continent columns */
.apb-lang-group {
    flex: 1;
    min-width: 120px;
}
/* Europe gets double width since it has the most countries */
.apb-lang-group:first-child {
    flex: 2;
}
.apb-lang-group:first-child .apb-lang-list {
    columns: 2;
    column-gap: 16px;
}
.apb-lang-group:first-child .apb-lang-list li {
    break-inside: avoid;
}
.apb-lang-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888 !important;
    margin: 0 0 8px;
    padding: 0 6px;
}
.apb-lang-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.apb-lang-list li {
    margin: 0;
}
.apb-lang-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    text-decoration: none !important;
    color: #333 !important;
    font-size: 13px;
    white-space: nowrap;
    line-height: 1.4;
}
.apb-lang-list a:hover {
    background: #f0f4f0;
    color: #1a1a2e;
}
.apb-lang-list a.apb-lang-active {
    background: #e8f5e9;
    font-weight: 600;
}
.apb-lang-list img {
    width: 18px;
    height: 13px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Rest of Europe link */
.apb-lang-external {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    color: #2d6a2e !important;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none !important;
    border-top: 1px solid #eee;
    margin-top: 4px;
    padding-top: 8px;
}
.apb-lang-external:hover {
    color: #245523 !important;
}

/* Mobile */
@media (max-width: 800px) {
    .apb-lang-switcher {
        margin-left: 0;
    }
    .apb-lang-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 16px 16px 0 0;
        min-width: 0;
        max-height: 70vh;
        overflow-y: auto;
        flex-wrap: wrap;
    }
    .apb-lang-group {
        flex: 0 0 50%;
    }
}
