/* Переключатель языков в стиле шахматной доски */
.language-switcher {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: linear-gradient(45deg, #3c518e 0%, #2d3f73 100%);
    border-radius: 6px;
    box-shadow: 
        0 3px 10px rgba(60, 81, 142, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.15);
    font-family: 'PT Sans', sans-serif;
    list-style: none;
    margin: 0;
    border: 2px solid #2d3f73;
}

/* Позиционирование справа от меню */
#menu {
    position: relative;
}

.language-toggle-container {
    position: absolute;
    top: 50%;
    right: -20px;
    transform: translateY(-50%);
    z-index: 10;
}

.language-toggle::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4), rgba(255,255,255,0.1));
    border-radius: 20px;
    z-index: -1;
}

/* Квадратные кнопки в стиле шахматной доски */
.lang-current, .lang-option {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 4px;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

/* Текущий язык - белая клетка (как король на доске) */
.lang-current {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    color: #2c3e50;
    border: 1px solid #e9ecef;
    box-shadow: 
        0 2px 8px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.8),
        inset 0 -1px 0 rgba(0,0,0,0.1);
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
    font-weight: 800;
}

/* Другие языки - темные клетки в корпоративном стиле */
.lang-option {
    background: linear-gradient(145deg, #4a5f8a 0%, #3c518e 100%);
    color: #ffffff;
    border: 1px solid #2d3f73;
    box-shadow: 
        0 2px 6px rgba(60, 81, 142, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
    text-shadow: 0 1px 2px rgba(45, 63, 115, 0.8);
}

/* Эффект наведения - клетка "подсвечивается" в корпоративном стиле */
.lang-option:hover {
    background: linear-gradient(145deg, #5a73b8 0%, #4a63a8 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 4px 12px rgba(60, 81, 142, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.2);
    border-color: #3c518e;
}

/* Эффект нажатия */
.lang-option:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 
        0 1px 3px rgba(0,0,0,0.3),
        inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Паттерн шахматной доски (тонкие линии) */
.lang-current::before,
.lang-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(45deg, transparent 25%, rgba(0,0,0,0.03) 25%, rgba(0,0,0,0.03) 50%, transparent 50%, transparent 75%, rgba(0,0,0,0.03) 75%);
    background-size: 8px 8px;
    pointer-events: none;
}

.lang-current::before {
    background-image: 
        linear-gradient(45deg, transparent 25%, rgba(0,0,0,0.05) 25%, rgba(0,0,0,0.05) 50%, transparent 50%, transparent 75%, rgba(0,0,0,0.05) 75%);
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 54px;
    height: 34px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 17px;
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 
        0 2px 8px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.2);
    z-index: 1;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    border-radius: 15px;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* Позиции слайдера для разных языков */
.language-toggle.ru .toggle-slider {
    transform: translateX(0px);
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.language-toggle.en .toggle-slider {
    transform: translateX(60px);
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.language-toggle.jp .toggle-slider {
    transform: translateX(120px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Анимация при переключении */
.language-toggle.switching .toggle-slider {
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Адаптивность для мобильных */
@media (max-width: 640px) {
    .language-toggle-container {
        position: static;
        transform: none;
        margin: 10px 0;
        text-align: center;
    }
    
    .language-switcher {
        gap: 1px;
        padding: 2px;
    }
    
    .lang-current, .lang-option {
        width: 32px;
        height: 32px;
        font-size: 10px;
    }
}

/* Интеграция с существующим меню */
@media (min-width: 641px) {
    #menu {
        overflow: visible;
    }
    
    .language-toggle-container {
        white-space: nowrap;
    }
}

/* Интеграция в существующее меню */
#menu .language-toggle {
    vertical-align: middle;
    margin-left: 20px;
}

/* Эффект свечения при наведении */
.language-toggle:hover {
    box-shadow: 
        inset 0 2px 4px rgba(0,0,0,0.1),
        0 2px 12px rgba(0,0,0,0.2),
        0 0 0 1px rgba(255,255,255,0.1);
}

.language-toggle:hover .toggle-slider {
    box-shadow: 
        0 4px 12px rgba(102, 126, 234, 0.5),
        inset 0 1px 0 rgba(255,255,255,0.3);
}
