/* 語言切換器樣式 */
.language-switcher {
    position: relative;
    display: inline-block;
    margin-left: auto;
}

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

.language-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.language-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.language-short {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    color: #2196F3;
    min-width: 32px;
    text-align: center;
}

.language-name {
    font-weight: 500;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.language-button.active .dropdown-arrow {
    transform: rotate(180deg);
}

.language-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 160px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 4px;
}

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

.language-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 6px;
    margin: 2px;
}

.language-option:hover {
    background: rgba(33, 150, 243, 0.1);
    color: #1976d2;
}

.language-option.active {
    background: rgba(33, 150, 243, 0.15);
    color: #1976d2;
    font-weight: 600;
}

.language-option .language-short {
    font-size: 16px;
    min-width: 32px;
}

.language-option .language-name {
    font-size: 14px;
    font-weight: 500;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .language-switcher {
        margin-left: 0;
        margin-top: 0;
    }
    
    .language-button {
        padding: 6px 10px;
        font-size: 13px;
        background: rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .language-button:hover {
        background: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.4);
    }
    
    .language-menu {
        min-width: 140px;
        right: -10px;
        top: 100%;
        margin-top: 8px;
    }
    
    .language-option {
        padding: 8px 10px;
    }
    
    .language-short {
        font-size: 14px;
        min-width: 28px;
    }
    
    .language-name {
        font-size: 12px;
    }
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
    .language-menu {
        background: rgba(30, 30, 30, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .language-option {
        color: #ffffff;
    }
    
    .language-option:hover {
        background: rgba(33, 150, 243, 0.2);
        color: #64b5f6;
    }
    
    .language-option.active {
        background: rgba(33, 150, 243, 0.25);
        color: #64b5f6;
    }
}

/* 動畫效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-menu.show {
    animation: fadeInUp 0.3s ease;
}

/* 高對比度模式支援 */
@media (prefers-contrast: high) {
    .language-button {
        border-width: 2px;
    }
    
    .language-menu {
        border-width: 2px;
    }
    
    .language-option {
        border: 1px solid transparent;
    }
    
    .language-option:hover,
    .language-option.active {
        border-color: #1976d2;
    }
}

/* 語言選擇模態框 */
.language-selection-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.language-selection-content {
    max-width: 800px;
    width: 90%;
    padding: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.language-selection-content .modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.language-selection-content .modal-header h2 {
    font-size: 28px;
    margin-bottom: 5px;
    color: #ffffff;
    font-weight: 700;
}

.language-selection-content .modal-header h3 {
    font-size: 24px;
    margin-bottom: 10px;
    opacity: 0.9;
    color: #ffffff;
    font-weight: 600;
}

.language-selection-content .modal-header p {
    font-size: 16px;
    opacity: 0.7;
    color: #ffffff;
}

.language-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.language-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.language-card:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.language-code {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #ffffff;
}

.language-grid .language-name {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 5px;
}

.language-native {
    font-size: 14px;
    opacity: 0.7;
    color: #ffffff;
}

@media (max-width: 768px) {
    .language-selection-content {
        padding: 30px 20px;
    }
    
    .language-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .language-card {
        padding: 20px 15px;
    }
    
    .language-code {
        font-size: 28px;
    }
    
    .language-grid .language-name {
        font-size: 16px;
    }
    
    .language-selection-content .modal-header h2 {
        font-size: 24px;
    }
    
    .language-selection-content .modal-header h3 {
        font-size: 20px;
    }
}
