/* 语言选择按钮样式 */
#heroLanguageButton {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    padding: 8px 16px;
    border-radius: 9999px;
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    z-index: 1002;
    position: relative;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s ease;
}

#heroLanguageButton:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

#heroLanguageButton i {
    font-size: 12px;
}

#heroLanguageButton span {
    display: inline-block;
    color: white;
}

/* 确保语言选择器容器可见 - 适应右上角位置 */
#hero .absolute.top-4.right-4.z-20 {
    display: block;
    visibility: visible;
    opacity: 1;
    z-index: 1002;
    position: absolute;
    top: 16px;
    right: 16px;
}

/* 语言选择器下拉菜单样式 */
#heroLanguageDropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 256px;
    min-width: 256px;
    max-height: 240px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    overflow-y: auto;
    background-color: white;
    border-radius: 8px;
    margin-top: 8px;
    pointer-events: auto;
    transition: all 0.3s ease;
}

/* 隐藏类的默认行为 */
#heroLanguageDropdown.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
}

/* 语言选项样式 */
.language-quick-select {
    width: 100%;
    text-align: left;
    padding: 8px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
    min-height: 40px;
}

.language-quick-select:hover {
    background-color: rgba(0,0,0,0.05);
}

/* 选中状态样式 */
.language-quick-select.bg-gray-100 {
    background-color: rgba(0,0,0,0.08);
    font-weight: 500;
}

/* 国家/地区旗帜样式优化 */
.language-quick-select span:first-child {
    font-size: 16px;
    min-width: 20px;
    text-align: center;
}

/* 响应式调整 - 在小屏幕上优化显示 */
@media (max-width: 640px) {
    #hero .absolute.top-4.right-4.z-20 {
        right: 8px;
        top: 8px;
    }
    
    #heroLanguageButton {
        padding: 6px 12px;
        font-size: 12px;
        gap: 6px;
    }
    
    #heroLanguageDropdown {
        width: 200px;
        min-width: 200px;
        font-size: 12px;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    #heroLanguageButton {
        font-size: 12px;
        padding: 6px 12px;
        min-width: 60px;
        min-height: 36px;
    }
    
    #heroLanguageDropdown {
        min-width: 200px;
        max-height: 200px;
        right: 10px;
        left: auto;
    }
}

/* 平板设备优化 */
@media (min-width: 641px) and (max-width: 1024px) {
    #heroLanguageButton {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    #heroLanguageDropdown {
        width: 220px;
        min-width: 220px;
    }
}

/* 苹果设备特殊优化 */
@media (-webkit-device-pixel-ratio: 2), (device-pixel-ratio: 2) {
    /* 优化高分辨率屏幕上的渲染 */
    #heroLanguageButton,
    .language-quick-select {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-width: 900px) {
    /* 横屏时调整位置避免遮挡内容 */
    #heroLanguageDropdown {
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 触摸设备上增强反馈 */
    .language-quick-select:active {
        background-color: rgba(0,0,0,0.1);
    }
    
    /* 增加触摸目标大小 */
    #heroLanguageButton {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 16px;
    }
    
    .language-quick-select {
        min-height: 40px;
    }
}

/* 修复Font Awesome图标问题 - 使用正确的Font Awesome 4.7.0设置 */
#heroLanguageButton i.fa {
    font-family: 'FontAwesome';
    font-weight: normal;
    font-style: normal;
}

/* 自定义滚动条样式 */
#heroLanguageDropdown::-webkit-scrollbar {
    width: 6px;
}

#heroLanguageDropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#heroLanguageDropdown::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#heroLanguageDropdown::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 下拉菜单展开时旋转箭头图标 */
#heroLanguageDropdown:not(.hidden) + #heroLanguageButton i.fa-chevron-down {
    transform: rotate(180deg);
}

/* 加载状态样式 */
.language-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: #666;
    font-size: 14px;
}

.language-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}