/* 百度语音合成系统样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* 头部样式 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header div {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.header h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 2.5rem;
    font-weight: 600;
}

.header h1 img {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.header p {
    color: #666;
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
}

/* 容器布局 */
.container-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.my-container {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.my-container h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 600;
    border-bottom: 3px solid #9b59b6;
    padding-bottom: 0.5rem;
    display: inline-block;
}

/* 文本输入区域 */
.text-input-section {
    margin-bottom: 2rem;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.input-header label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.text-stats {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.billing-info {
    color: #e74c3c;
    font-weight: 500;
}

#text-input {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s ease;
    font-family: inherit;
}

#text-input:focus {
    outline: none;
    border-color: #9b59b6;
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.input-tips {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #9b59b6;
}

.input-tips p {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.input-tips ul {
    list-style: none;
    padding-left: 0;
}

.input-tips li {
    margin-bottom: 0.25rem;
    color: #666;
    font-size: 0.9rem;
}

.input-tips li::before {
    content: "•";
    color: #9b59b6;
    margin-right: 0.5rem;
}

/* 语音配置 */
.voice-config {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #9b59b6;
}

.voice-config h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.config-grid {
    display: grid;
    gap: 2rem;
}

.config-section h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

/* 音库选项卡 */
.voice-library-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: #e9ecef;
    border-radius: 8px;
    padding: 0.25rem;
}

.library-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.library-tab:hover {
    background: #dee2e6;
}

.library-tab.active {
    background: #9b59b6;
    color: white;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.3);
}

/* 发音人选择 */
.voice-options {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.voice-options.active {
    display: grid;
}

.voice-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.voice-item:hover {
    border-color: #9b59b6;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.2);
}

.voice-item.selected {
    border-color: #9b59b6;
    background: rgba(155, 89, 182, 0.05);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.voice-avatar {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 50%;
    flex-shrink: 0;
}

.voice-info {
    flex: 1;
}

.voice-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.voice-desc {
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* 音频参数 */
.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.param-item label {
    display: block;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #9b59b6;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(155, 89, 182, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #9b59b6;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(155, 89, 182, 0.3);
}

.slider-value {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: #9b59b6;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

#audio-format {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
}

#audio-format:focus {
    outline: none;
    border-color: #9b59b6;
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

/* 认证配置 */
.credential-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.credential-header h3 {
    color: #2c3e50;
    font-size: 1.3rem;
}

.credential-header label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #7f8c8d;
    cursor: pointer;
}

.credential-inputs {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.credential-inputs label {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    display: block;
}

.credential-inputs input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: monospace;
}

.credential-inputs input:focus {
    outline: none;
    border-color: #9b59b6;
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.1);
}

.credential-inputs input:disabled {
    background: #f8f9fa;
    color: #7f8c8d;
}

.credential-tips {
    background: #e8f4f8;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #9b59b6;
    margin-bottom: 2rem;
}

.credential-tips p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #34495e;
}

.credential-tips a {
    color: #9b59b6;
    text-decoration: none;
    font-weight: 500;
}

.credential-tips a:hover {
    text-decoration: underline;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.preview-btn, .clear-btn, .synthesize-btn {
    flex: 1;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.preview-btn {
    background: #3498db;
    color: white;
}

.preview-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.clear-btn {
    background: #95a5a6;
    color: white;
}

.clear-btn:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(127, 140, 141, 0.3);
}

.synthesize-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
}

.synthesize-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(155, 89, 182, 0.4);
}

.synthesize-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 加载动画 */
.loading {
    display: none;
    text-align: center;
    padding: 2rem;
    background: rgba(155, 89, 182, 0.05);
    border-radius: 12px;
    margin: 2rem 0;
    border: 2px dashed #9b59b6;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #9b59b6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #9b59b6;
    font-weight: 500;
    font-size: 1.1rem;
}

/* 结果容器 */
.result-container {
    min-height: 200px;
}

/* 错误消息 */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* 合成统计 */
.synthesis-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #9b59b6;
}

.stats-item {
    text-align: center;
}

.stats-label {
    display: block;
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
}

.stats-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: #9b59b6;
}

/* 音频播放器 */
.audio-player-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.player-header h4 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin: 0;
}

.player-actions {
    display: flex;
    gap: 0.5rem;
}

.player-btn {
    padding: 0.5rem 1rem;
    background: #9b59b6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.player-btn:hover {
    background: #8e44ad;
    transform: translateY(-1px);
}

.audio-player {
    margin-bottom: 1.5rem;
}

.audio-player audio {
    width: 100%;
    height: 50px;
    border-radius: 8px;
    background: white;
}

.waveform-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    border: 2px solid #e9ecef;
}

#waveform-canvas {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* 历史记录 */
.history-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.history-header h4 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin: 0;
}

.clear-history-btn {
    padding: 0.5rem 1rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.clear-history-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border-left: 4px solid #9b59b6;
    transition: all 0.3s ease;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.history-text {
    flex: 1;
    margin-right: 1rem;
}

.history-preview {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.history-details {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

.history-action-btn {
    padding: 0.25rem 0.5rem;
    background: #9b59b6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.history-action-btn:hover {
    background: #8e44ad;
}

/* 状态指示器 */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.waiting {
    background: #95a5a6;
}

.status-dot.ready {
    background: #f39c12;
}

.status-dot.processing {
    background: #9b59b6;
    animation: pulse 1.5s infinite;
}

.status-dot.success {
    background: #27ae60;
}

.status-dot.error {
    background: #e74c3c;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#status-text {
    color: #2c3e50;
    font-weight: 500;
}

/* 成功消息 */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #27ae60;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    z-index: 1000;
    font-weight: 500;
}

/* 动画效果 */
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in { animation: slideInRight 0.3s ease-out; }
.fade-in { animation: fadeIn 0.5s ease-out; }

/* 响应式设计 */
@media (max-width: 1200px) {
    .container-wrapper {
        grid-template-columns: 1fr;
        max-width: 800px;
    }
}

@media (max-width: 768px) {
    .container-wrapper {
        padding: 0 1rem 1rem;
        gap: 1rem;
    }
    
    .my-container {
        padding: 1.5rem;
    }
    
    .header {
        padding: 1rem 0;
    }
    
    .header h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .header h1 img {
        width: 60px;
        height: 60px;
    }
    
    .voice-library-tabs {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .voice-options {
        grid-template-columns: 1fr;
    }
    
    .params-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .synthesis-stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.5rem;
    }
    
    .player-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .player-actions {
        justify-content: center;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .history-actions {
        align-self: flex-end;
    }
}