.language-switcher {
    position: relative;
    margin-right: 20px;
    z-index: 1001; /* Ensure it's above other header elements */
}

.language-switcher-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1002; /* Higher z-index for clickability */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.language-switcher-btn .flag-icon {
    width: 24px;
    height: 18px;
    border-radius: 0px;
    object-fit: cover;
    pointer-events: none; /* Prevent flag from blocking clicks */
}

.language-options {
    position: absolute;
    top: 100%;
    right: 0;
    background: #1a1f2d;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 1003; /* Higher than button */
    min-width: 120px;
    padding: 8px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform-origin: top right;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.language-options.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.language-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.language-option .flag-icon {
    width: 20px;
    height: 15px;
    margin-right: 8px;
    border-radius: 4px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    object-fit: cover;
    pointer-events: none; /* Prevent flag from blocking clicks */
}

.uicore-extra .language-switcher {
    display: flex;
    align-items: center;
}

/* Mobile specific fixes */
@media (max-width: 768px) {
    .language-switcher {
        margin-right: 10px;
        z-index: 9999; /* Very high z-index on mobile */
    }
    
    .language-switcher-btn {
        padding: 12px; /* Larger tap target on mobile */
        min-width: 44px; /* Minimum touch target size */
        min-height: 44px;
        justify-content: center;
        touch-action: manipulation; /* Improve touch responsiveness */
    }
    
    .language-options {
        z-index: 10000; /* Ensure dropdown is above everything */
        margin-top: 4px; /* Small gap for better visual separation */
    }
    
    .language-option {
        padding: 12px 16px; /* Larger tap targets */
        min-height: 44px;
    }
}

/* Dark theme specific adjustments */
@media (prefers-color-scheme: dark) {
    .language-options {
        background: #1a1f2d;
        border-color: rgba(255, 255, 255, 0.1);
    }
}