/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei UI', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 顶部控制栏 */
.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.mode-switcher {
    display: flex;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
}

.mode-btn {
    padding: 12px 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #666;
}

.mode-btn.active {
    background: #007aff;
    color: white;
}

.mode-btn:hover:not(.active) {
    background: #e0e0e0;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-selector label {
    font-weight: 600;
    color: #333;
}

.language-selector select {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.language-selector select:focus {
    outline: none;
    border-color: #007aff;
}

/* 模式面板 */
.mode-panel {
    display: none;
    flex: 1;
    flex-direction: column;
}

.mode-panel.active {
    display: flex;
}

/* 语音控制区域 */
.voice-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.primary-btn {
    padding: 12px 30px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

.primary-btn.recording {
    background: #dc3545;
}

.primary-btn.recording:hover {
    background: #c82333;
}

.secondary-btn {
    padding: 12px 24px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.status-text {
    font-size: 16px;
    font-weight: 500;
    color: #666;
    margin-left: 10px;
}

.status-text.recording {
    color: #dc3545;
    animation: pulse 1.5s infinite;
}

.status-text.processing {
    color: #007aff;
}

.status-text.success {
    color: #28a745;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* 翻译面板 */
.translation-panels {
    display: flex;
    gap: 20px;
    flex: 1;
}

.panel {
    flex: 1;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.panel-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.play-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #007aff;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-btn:hover:not(:disabled) {
    background: #0056b3;
    transform: scale(1.1);
}

.play-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.text-content {
    flex: 1;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    overflow-y: auto;
    background: white;
    border: none;
    resize: none;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.text-input {
    flex: 1;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    border: none;
    resize: none;
    outline: none;
    font-family: inherit;
}

.text-input::placeholder {
    color: #aaa;
}

/* 状态栏 */
.status-bar {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    border-left: 4px solid #007aff;
}

#global-status {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* 打字机效果 */
.typewriter {
    overflow: hidden;
    border-right: 2px solid #007aff;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { border-color: #007aff; }
    51%, 100% { border-color: transparent; }
}

/* 加载动画 */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007aff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .control-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .mode-switcher {
        justify-content: center;
    }
    
    .translation-panels {
        flex-direction: column;
    }
    
    .voice-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* 音频可视化效果 */
.audio-visualizer {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 10px;
}

.audio-bar {
    width: 3px;
    height: 20px;
    background: #007aff;
    border-radius: 2px;
    animation: visualize 1.5s infinite ease-in-out;
}

.audio-bar:nth-child(2) { animation-delay: 0.1s; }
.audio-bar:nth-child(3) { animation-delay: 0.2s; }
.audio-bar:nth-child(4) { animation-delay: 0.3s; }
.audio-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes visualize {
    0%, 40%, 100% { transform: scaleY(0.4); }
    20% { transform: scaleY(1); }
}

/* 成功/错误提示样式 */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 10px 0;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* 滚动条样式 */
.text-content::-webkit-scrollbar {
    width: 6px;
}

.text-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.text-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.text-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}