.lang-switch {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.lang-switch .lang-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: var(--space-2) var(--space-3);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}

.lang-switch .lang-switch-btn:hover,
.lang-switch.is-open .lang-switch-btn {
    color: var(--text-primary);
    background: #eef0f2;
    border-color: var(--border-medium);
}

.lang-switch .lang-switch-btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.lang-switch .lang-switch-btn svg {
    flex-shrink: 0;
}

.lang-switch .lang-switch-btn {
    position: relative;
}

.lang-switch .lang-switch-btn::after {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: 50%;
    height: max(100%, 44px);
    transform: translateY(-50%);
}

.lang-switch .lang-switch-chev {
    transition: transform var(--transition-fast);
}

.lang-switch.is-open .lang-switch-chev {
    transform: rotate(180deg);
}

.lang-switch .lang-switch-list {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 10;
    min-width: 180px;
    margin: var(--space-1) 0 0;
    padding: var(--space-2);
    list-style: none;
    background: var(--bg-white);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-xl);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: opacity var(--transition-fast), visibility var(--transition-fast), transform var(--transition-fast);
}

.lang-switch.is-open .lang-switch-list,
.lang-switch:not(.is-ready):hover .lang-switch-list,
.lang-switch:not(.is-ready):focus-within .lang-switch-list {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.lang-switch .lang-switch-list li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.lang-switch .lang-switch-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 var(--space-3);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

.lang-switch a.lang-switch-opt:hover {
    background: #f5f5f5;
}

.lang-switch a.lang-switch-opt:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

.lang-switch .lang-switch-opt::before {
    content: "";
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border-radius: 50%;
    background: center / cover no-repeat;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.lang-switch .lang-switch-opt[lang="da"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpath fill='%23C8102E' d='M0 0h60v60H0z'/%3E%3Cpath fill='%23fff' d='M20 0h8v60h-8zM0 26h60v8H0z'/%3E%3C/svg%3E");
}

.lang-switch .lang-switch-opt[lang="en"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cpath fill='%23012169' d='M0 0h60v60H0z'/%3E%3Cpath stroke='%23fff' stroke-width='8' d='M0 0l60 60M60 0L0 60'/%3E%3Cpath stroke='%23C8102E' stroke-width='4' d='M0 0l60 60M60 0L0 60'/%3E%3Cpath fill='%23fff' d='M25 0h10v60H25zM0 25h60v10H0z'/%3E%3Cpath fill='%23C8102E' d='M27 0h6v60h-6zM0 27h60v6H0z'/%3E%3C/svg%3E");
}

.lang-switch .lang-switch-opt[aria-current] {
    font-weight: 600;
}

.lang-switch .lang-switch-opt[aria-current]::after {
    content: "";
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-left: auto;
    background: var(--brand-primary-hover);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.nav-cta-mobile .lang-switch--menu {
    display: flex;
    flex-direction: column;
}

.nav-cta-mobile .lang-switch--menu .lang-switch-btn {
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: var(--space-4);
    font-size: 14px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
}

.nav-cta-mobile .lang-switch--menu .lang-switch-btn:hover,
.nav-cta-mobile .lang-switch--menu.is-open .lang-switch-btn {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-cta-mobile .lang-switch--menu .lang-switch-list {
    position: static;
    display: none;
    min-width: 0;
    margin: var(--space-2) 0 0;
    padding: var(--space-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
}

.nav-cta-mobile .lang-switch--menu.is-open .lang-switch-list,
.nav-cta-mobile .lang-switch--menu:not(.is-ready):focus-within .lang-switch-list {
    display: block;
}

.nav-cta-mobile .lang-switch--menu .lang-switch-opt {
    min-height: 48px;
    font-size: 15px;
}

.lang-switch .lang-switch-code {
    display: none;
}

@media (min-width: 768px) and (max-width: 1279px) {
    .header-cta-group .lang-switch .lang-switch-btn {
        justify-content: center;
        gap: 0;
        width: 36px;
        padding-left: 0;
        padding-right: 0;
    }

    .header-cta-group .lang-switch .lang-switch-btn::after {
        left: -5px;
        right: -5px;
    }

    .header-cta-group .lang-switch .lang-switch-name {
        width: 0;
        min-width: 0;
        overflow: hidden;
    }

    .header-cta-group .lang-switch .lang-switch-globe,
    .header-cta-group .lang-switch .lang-switch-chev {
        display: none;
    }

    .header-cta-group .lang-switch .lang-switch-code {
        display: inline;
        font-size: 14px;
        font-weight: 600;
    }
}

@media (min-width: 1024px) and (max-width: 1135px) {
    .header:has(.lang-switch-name[lang="da"]) {
        padding-left: 16px;
        padding-right: 16px;
    }

    .header:has(.lang-switch-name[lang="da"]) .header-container {
        gap: 10px;
    }

    .header:has(.lang-switch-name[lang="da"]) .nav-link {
        padding-left: 5px;
        padding-right: 5px;
    }

    .header:has(.lang-switch-name[lang="da"]) .header-cta {
        padding-left: 10px;
        padding-right: 10px;
    }
}

@media (forced-colors: active) {
    .lang-switch .lang-switch-opt[aria-current]::after {
        background: CanvasText;
        forced-color-adjust: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lang-switch .lang-switch-list,
    .lang-switch .lang-switch-chev {
        transition: none;
    }
}
