.custom-language-switcher {
    position: relative;
    display: inline-block;
}

.custom-translate-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
    text-decoration: none;
    font-size: 14px;
    /* Enhanced touch target for mobile */
    min-height: 44px;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    touch-action: manipulation;
}

.custom-translate-btn:hover,
.custom-translate-btn:focus,
.custom-translate-btn:active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    text-decoration: none;
    outline: none;
}

.custom-translate-btn .flag-icon {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
}

.custom-translate-btn i {
    font-size: 12px;
    margin-left: auto;
    transition: transform 0.3s ease;
}

.translate-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1050;
    /* Higher z-index for mobile */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    /* Enhanced for mobile */
    -webkit-overflow-scrolling: touch;
}

.translate-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.translate-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    /* Increased padding for better touch */
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid #f0f0f0;
    /* Enhanced touch target */
    min-height: 44px;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
    touch-action: manipulation;
    cursor: pointer;
}

.translate-option:last-child {
    border-bottom: none;
}

.translate-option:hover,
.translate-option:focus,
.translate-option:active {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    text-decoration: none;
    outline: none;
}

.translate-option.active {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    font-weight: 600;
}

.translate-option .flag-icon {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
}

.translate-option .flag-text {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.translate-option span {
    font-size: 14px;
}

/* Hide Google Translate elements */
#google_translate_element,
.goog-te-banner-frame,
#goog-gt-tt,
.goog-te-balloon-frame {
    display: none !important;
}

body {
    top: 0 !important;
}

/* Enhanced mobile responsive */
@media (max-width: 768px) {
    .custom-translate-btn {
        padding: 8px 10px;
        font-size: 13px;
        min-width: 90px;
        min-height: 40px;
    }

    .translate-dropdown {
        min-width: 180px;
        right: -10px;
        max-height: 250px;
        border-radius: 6px;
        /* Enhanced mobile positioning */
        position: fixed;
        top: auto !important;
        bottom: auto;
        /* Better mobile viewport handling */
        max-width: calc(100vw - 20px);
    }

    .translate-option {
        padding: 10px 12px;
        font-size: 13px;
        min-height: 40px;
    }

    .translate-option .flag-icon {
        width: 18px;
        height: 14px;
    }

    /* Ensure dropdown appears above navbar on mobile */
    .navbar .custom-language-switcher .translate-dropdown {
        z-index: 1060;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .custom-translate-btn {
        min-width: 80px;
        font-size: 12px;
        padding: 6px 8px;
    }

    .translate-dropdown {
        right: -5px;
        min-width: 160px;
    }

    .translate-option {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .translate-dropdown {
        max-height: 200px;
    }
}