/* 🌐 全局悬浮语言切换器：右侧窄条（地球 + 语言标记） */

.language-switcher-container {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99999;
}

.language-switcher-main-btn {
    width: 32px;
    height: 64px;
    border-radius: 8px 0 0 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    cursor: default;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 0 6px;
    font-size: 18px;
    line-height: 1;
    transition: box-shadow 0.2s ease, filter 0.2s ease;
    position: relative;
    user-select: none;
    box-sizing: border-box;
    overflow: hidden;
}

.language-switcher-main-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
    transition: left 0.8s ease;
    pointer-events: none;
    z-index: 1;
}

.language-switcher-main-btn:hover::before {
    left: 100%;
}

.language-switcher-globe {
    display: inline-block;
    position: relative;
    z-index: 2;
    transform-origin: center center;
}

.language-switcher-main-btn:hover {
    filter: brightness(1.08);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.language-switcher-main-btn:hover .language-switcher-globe {
    animation: language-switcher-globe-spin 5.5s linear infinite;
}

.language-switcher-container.dragging .language-switcher-globe {
    animation-play-state: paused;
}

.language-switcher-container.dragging {
    transition: none !important;
}

.language-switcher-container.dragging .language-switcher-main-btn {
    cursor: default;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

.language-switcher-container.dragging .language-switcher-panel {
    opacity: 0 !important;
    pointer-events: none !important;
}

.language-switcher-main-btn .current-lang-indicator {
    position: relative;
    z-index: 2;
    background: white;
    color: #667eea;
    font-size: 9px;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #667eea;
    text-transform: uppercase;
    line-height: 1;
}

.language-switcher-panel {
    position: absolute;
    right: 40px;
    top: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 12px;
    min-width: 220px;
    max-height: 500px;
    overflow-y: auto;
    opacity: 0;
    transform: translateX(20px) scale(0.9);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.language-switcher-panel.show {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: auto;
}

.language-switcher-panel::-webkit-scrollbar {
    width: 6px;
}

.language-switcher-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.language-switcher-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.language-switcher-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.language-switcher-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.language-switcher-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.language-switcher-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.language-switcher-close:hover {
    background: #f5f5f5;
    color: #333;
}

.language-switcher-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.language-switcher-item {
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #555;
    position: relative;
}

.language-switcher-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
    transform: translateX(-3px);
}

.language-switcher-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.language-switcher-item.active::after {
    content: '✓';
    position: absolute;
    right: 12px;
    font-size: 16px;
}

.language-switcher-flag {
    font-size: 20px;
    width: 28px;
    text-align: center;
}

.language-switcher-name {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.language-switcher-name-main {
    font-weight: 500;
}

.language-switcher-name-native {
    font-size: 11px;
    opacity: 0.7;
}

.language-switcher-loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #999;
}

.language-switcher-loading.show {
    display: block;
}

@media (max-width: 768px) {
    .language-switcher-main-btn {
        width: 28px;
        height: 56px;
        font-size: 16px;
    }

    .language-switcher-panel {
        right: 36px;
        min-width: 200px;
        max-height: 400px;
    }
}

@media (prefers-color-scheme: dark) {
    .language-switcher-panel {
        background: #2d2d2d;
        color: #e0e0e0;
    }

    .language-switcher-title {
        color: #e0e0e0;
    }

    .language-switcher-item {
        color: #b0b0b0;
    }

    .language-switcher-item:hover {
        background: rgba(102, 126, 234, 0.2);
        color: #a0a5ea;
    }

    .language-switcher-close:hover {
        background: #3a3a3a;
        color: #e0e0e0;
    }

    .language-switcher-panel::-webkit-scrollbar-track {
        background: #3a3a3a;
    }
}

@keyframes language-switcher-globe-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .language-switcher-main-btn:hover .language-switcher-globe {
        animation: none;
    }

    .language-switcher-main-btn::before {
        display: none;
    }
}

@keyframes pulse {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.15);
    }
}

.language-switcher-main-btn.pulse {
    animation: pulse 0.5s ease-in-out;
}
