/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主要内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* 方言选择器 */
.dialect-selector {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    height: fit-content;
}

.dialect-selector h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.dialect-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.dialect-option {
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.dialect-option:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.dialect-option.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.dialect-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.dialect-option h3 {
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.dialect-option p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 聊天容器 */
.chat-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.btn-secondary {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.3);
}

/* 聊天消息 */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.welcome-message {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.message-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 15px;
    max-width: 80%;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
}

.user-message {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    justify-content: flex-end;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #28a745;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* 语音控制 */
.voice-controls {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
}

.voice-buttons {
    margin-bottom: 20px;
}

.voice-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.voice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.voice-btn.stop {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.recording-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #28a745;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* 发音反馈 */
.pronunciation-feedback {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.pronunciation-feedback h3 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.feedback-content {
    display: flex;
    gap: 30px;
    align-items: center;
}

.score-display {
    flex-shrink: 0;
}

.score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.score-circle small {
    font-size: 0.8rem;
    opacity: 0.8;
}

.feedback-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.feedback-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    background: #f8f9fa;
}

.feedback-item i {
    font-size: 1.2rem;
}

.feedback-item:first-child i {
    color: #28a745;
}

.feedback-item:last-child i {
    color: #ffc107;
}

/* 设置面板 */
.settings-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.settings-panel.open {
    right: 0;
}

.settings-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-content {
    padding: 20px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.setting-group input[type="password"],
.setting-group input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

/* API密钥输入框特殊样式 */
.api-key-input {
    background-color: #f8f9fa;
    border-color: #667eea !important;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.api-key-input:focus {
    background-color: #fff;
    border-color: #4c63d2 !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.api-key-hint {
    color: #6c757d !important;
    font-size: 0.85rem !important;
    font-style: italic;
    margin-top: 8px !important;
}

.setting-group input:focus {
    outline: none;
    border-color: #667eea;
}

.setting-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9rem;
}

.setting-group input[type="range"] {
    width: 100%;
    margin-right: 10px;
}

.setting-group input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}

#speedValue {
    font-weight: bold;
    color: #667eea;
}

/* 设置按钮 */
.settings-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    z-index: 999;
}

.settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 15px;
    }
    
    .settings-panel {
        width: 100%;
        right: -100%;
    }
    
    .feedback-content {
        flex-direction: column;
        text-align: center;
    }
    
    .chat-container {
        height: 400px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
} 