/* ──────────────────────────────────────
   GHG Translate — Language Switcher
   Floating, accessible, brand-matched
   ────────────────────────────────────── */

.ghg-lang-switcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Position variants (set via admin) */
body.ghg-switcher-bottom-left .ghg-lang-switcher {
    right: auto;
    left: 24px;
}

body.ghg-switcher-top-right .ghg-lang-switcher {
    bottom: auto;
    top: 90px;
}

body.ghg-switcher-top-left .ghg-lang-switcher {
    bottom: auto;
    top: 90px;
    right: auto;
    left: 24px;
}

/* Toggle Button */
.ghg-lang-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #1E3A8A;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow:
        0 4px 16px rgba(30, 58, 138, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.ghg-lang-toggle:hover {
    background: #1E3A8Acc;
    box-shadow:
        0 6px 24px rgba(30, 58, 138, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.ghg-lang-toggle:focus-visible {
    outline: 2px solid #F97316;
    outline-offset: 2px;
}

.ghg-lang-flag {
    font-size: 1.2rem;
    line-height: 1;
}

.ghg-lang-code {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.ghg-lang-chevron {
    transition: transform 0.3s ease;
    opacity: 0.7;
}

.ghg-lang-toggle[aria-expanded="true"] .ghg-lang-chevron {
    transform: rotate(180deg);
}

/* Dropdown */
.ghg-lang-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    list-style: none;
    margin: 0;
    padding: 8px;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    overflow: hidden;
}

.ghg-lang-dropdown.open {
    display: block !important;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Top-positioned dropdowns open downward */
body.ghg-switcher-top-right .ghg-lang-dropdown,
body.ghg-switcher-top-left .ghg-lang-dropdown {
    bottom: auto;
    top: calc(100% + 8px);
}

/* Language Option */
.ghg-lang-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    color: #1f2937;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.ghg-lang-option:hover {
    background: #f0f4ff;
    color: #1E3A8A;
}

.ghg-lang-option.active {
    background: linear-gradient(135deg, #1E3A8A08, #0D948808);
    font-weight: 700;
    color: #1E3A8A;
}

.ghg-lang-option .ghg-lang-flag {
    font-size: 1.3rem;
}

.ghg-lang-native {
    flex: 1;
}

.ghg-lang-check {
    color: #0D9488;
    font-weight: 700;
    font-size: 0.85rem;
}

/* RTL adjustments for the switcher itself */
[dir="rtl"] .ghg-lang-switcher {
    right: auto;
    left: 24px;
}

[dir="rtl"] .ghg-lang-dropdown {
    right: auto;
    left: 0;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .ghg-lang-switcher {
        bottom: 80px; /* Above mobile donate bar */
        right: 16px;
    }

    [dir="rtl"] .ghg-lang-switcher {
        right: auto;
        left: 16px;
    }

    .ghg-lang-dropdown {
        min-width: 200px;
    }
}

/* Animation for the whole component entering */
@keyframes ghgSwitcherEnter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ghg-lang-switcher {
    animation: ghgSwitcherEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) 1s both;
}
