/* ===== 言語切り替え機能のスタイル ===== */

/* 言語切り替えボタンのコンテナ */
.language-toggle {
    display: flex;
    align-items: center;
    margin-left: 20px;
}

/* 言語表示コンテナ */
.lang-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
    color: #333;
}

/* 言語ラベル */
.lang-label {
    font-weight: 600;
    color: #444;
    font-size: 13px;
    letter-spacing: 0.5px;
}

/* 言語切り替えボタン */
.lang-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    border: none;
    border-radius: 20px;
    color: white;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.25);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ホバー効果 */
.lang-btn:hover,
.lang-btn.hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
    background: linear-gradient(135deg, #ff5252, #ff7a7a);
}

/* アクティブ状態 */
.lang-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

/* 切り替えアニメーション */
.lang-btn.switching {
    transform: scale(0.95);
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #ff5252, #ff7a7a);
    box-shadow: 0 3px 12px rgba(255, 82, 82, 0.35);
}

.lang-btn.switching .lang-current,
.lang-btn.switching .lang-other {
    animation: textSwitch 0.3s ease;
}

.lang-btn.switching .lang-separator {
    animation: separatorPulse 0.3s ease;
}

/* テキスト切り替えアニメーション */
@keyframes textSwitch {
    0% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
        text-decoration-color: #333;
    }
    50% { 
        opacity: 0.7; 
        transform: translateY(-2px) scale(1.05); 
        text-decoration-color: #1a1a1a;
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
        text-decoration-color: #333;
    }
}

/* セパレーター点滅アニメーション */
@keyframes separatorPulse {
    0% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); color: #ffffff; }
    100% { opacity: 0.6; transform: scale(1); }
}

/* 言語テキストのスタイル */
.lang-current {
    padding: 2px 4px;
    transition: all 0.3s ease;
    /* デフォルトスタイルは JavaScript で動的に設定される */
}

.lang-separator {
    font-weight: 400;
    opacity: 0.6;
    margin: 0 4px;
    color: rgba(255, 255, 255, 0.8);
    transition: opacity 0.3s ease;
}

.lang-other {
    padding: 2px 4px;
    transition: all 0.3s ease;
    /* デフォルトスタイルは JavaScript で動的に設定される */
}

/* ホバー時の効果 */
.lang-btn:hover .lang-other,
.lang-btn:hover .lang-current {
    opacity: 0.9 !important;
}

.lang-btn:hover .lang-separator {
    opacity: 0.8;
}

/* レスポンシブ対応 - タブレット */
@media (max-width: 768px) and (min-width: 481px) {
    .language-toggle {
        order: -1;
        margin-left: 0;
        margin-right: auto;
    }
    
    .lang-display {
        font-size: 14px;
        gap: 8px;
    }
    
    .lang-label {
        font-size: 13px;
        font-weight: 600;
    }
    
    .lang-btn {
        padding: 8px 16px;
        font-size: 13px;
        gap: 4px;
        border-radius: 25px;
        min-width: 120px;
        justify-content: center;
    }
    
    .lang-current, .lang-other {
        font-size: 13px;
        padding: 2px 4px;
    }
    
    /* タブレットではヘッダーに常時表示 */
    .language-toggle {
        display: flex;
    }
}

/* モバイル対応 - 大幅なデザイン変更 */
@media (max-width: 480px) {
    /* モバイル用の特別なレイアウト - 常に表示 */
    .language-toggle {
        display: flex; /* 常に表示 */
        position: fixed;
        top: 15px;
        right: 80px; /* ハンバーガーメニューと重ならないように調整 */
        z-index: 1001;
        background: none; /* 背景削除 */
        backdrop-filter: none;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
        animation: slideInRight 0.3s ease-out;
    }
    
    /* モバイル用の横型レイアウト（シンプル） */
    .lang-display {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        font-size: 12px;
    }
    
    .lang-label {
        display: block; /* モバイルでもラベルを表示 */
        font-size: 11px;
        font-weight: 600;
        color: #333;
        text-shadow: none;
        margin-right: 4px;
    }
    
    /* モバイル用ボタンデザイン - 単一言語表示 */
    .lang-btn {
        flex-direction: row;
        padding: 6px 12px;
        font-size: 13px;
        gap: 0;
        border-radius: 15px;
        min-width: 70px;
        min-height: 32px;
        justify-content: center;
        align-items: center;
        background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
        box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
    }
    
    /* モバイルでは現在の言語のみ表示 */
    .lang-current {
        font-size: 12px;
        font-weight: 600;
        padding: 0;
        border-radius: 0;
        background: none;
        opacity: 1;
        color: #333;
    }
    
    /* モバイルではセパレーターと他の言語を非表示 */
    .lang-separator {
        display: none;
    }
    
    .lang-other {
        display: none;
    }
    
    /* モバイル用ホバー効果（タッチ対応） */
    .lang-btn:active {
        transform: scale(0.95);
        box-shadow: 0 2px 10px rgba(255, 107, 107, 0.4);
    }
}

/* 初期表示アニメーション */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 超小画面用（320px以下） */
@media (max-width: 320px) {
    .language-toggle {
        top: 12px;
        right: 70px; /* ハンバーガーメニューと重ならないように調整 */
        padding: 0;
    }
    
    .lang-btn {
        min-width: 60px;
        min-height: 28px;
        padding: 4px 10px;
        font-size: 11px;
    }
    
    .lang-current {
        font-size: 11px;
        color: #333;
    }
    
    /* 超小画面でも他の言語は非表示 */
    .lang-other {
        display: none;
    }
    
    .lang-separator {
        display: none;
    }
    
    .lang-label {
        font-size: 10px;
        color: #333;
        text-shadow: none;
    }
}

/* ヘッダーナビゲーションのレイアウト調整 */
.nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    margin: 0;
    padding: 0;
}

/* デスクトップでのナビゲーション調整 */
@media (min-width: 769px) {
    .nav {
        flex-direction: row;
        align-items: center;
    }
    
    .language-toggle {
        display: flex;
    }
    
    .hamburger {
        display: none;
    }
}

/* タブレット対応 */
@media (max-width: 1024px) and (min-width: 769px) {
    .nav-menu {
        gap: 20px;
    }
    
    .language-toggle {
        margin-left: 15px;
    }
}

/* 言語切り替え時のページ全体の微細なアニメーション */
body.language-switching {
    transition: opacity 0.2s ease;
}

body.language-switching * {
    transition: opacity 0.2s ease;
}

/* モバイル用の特別なスタイリング */
@media (max-width: 480px) {
    /* タッチフレンドリーなサイズ */
    .lang-btn {
        -webkit-tap-highlight-color: rgba(255, 107, 107, 0.3);
        touch-action: manipulation;
        user-select: none;
    }
    
    /* モバイル専用のプレスエフェクト */
    .lang-btn:active {
        background: linear-gradient(135deg, #ff5252, #ff7a7a);
        transform: scale(0.95);
        transition: all 0.1s ease;
    }
    
    /* フォーカス時のスタイル（モバイル） */
    .lang-btn:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.5);
    }
    
    /* モバイル用の言語切り替えアニメーション - シンプル */
    .lang-btn.switching {
        animation: mobileLanguageSwitchSimple 0.3s ease;
    }
}

@keyframes mobileLanguageSwitchSimple {
    0% { transform: scale(1); background: linear-gradient(135deg, #ff6b6b, #ff8e8e); }
    50% { transform: scale(0.95); background: linear-gradient(135deg, #ff5252, #ff7a7a); }
    100% { transform: scale(1); background: linear-gradient(135deg, #ff6b6b, #ff8e8e); }
}

/* アクセシビリティ: フォーカス表示 */
.lang-btn:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4), 0 0 0 4px rgba(255, 255, 255, 0.3);
}

/* 大画面デスクトップ用の調整 */
@media (min-width: 1200px) {
    .language-toggle {
        margin-left: 30px;
    }
    
    .lang-display {
        font-size: 15px;
        gap: 10px;
    }
    
    .lang-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
}