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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    margin-bottom: 30px;
    color: white;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-left {
    text-align: left;
}

.header-right {
    text-align: right;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.user-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
}

.user-info span {
    color: white;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 主要内容区域 */
main {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

/* 文本输入区域 */
.text-section {
    margin-bottom: 25px;
}

.text-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

#text {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

#text:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 模式选择器 */
.mode-selector {
    margin-bottom: 30px;
}

.mode-tabs {
    display: flex;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.mode-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #666;
}

.mode-tab.active {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.mode-tab:hover:not(.active) {
    background: #e9ecef;
}

/* 合成模式 */
.synthesis-mode {
    margin-bottom: 30px;
}

.synthesis-mode.hidden {
    display: none;
}

/* 音色选择区域 */
.voice-section, .mix-voice-section {
    margin-bottom: 25px;
}

.voice-header, .mix-voice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.voice-header h3, .mix-voice-header h3 {
    font-size: 1.2rem;
    color: #333;
    font-weight: 600;
}

.select-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.select-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.selected-voice {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
}

.selected-voice:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.voice-avatar {
    font-size: 2rem;
    margin-right: 15px;
}

.voice-info {
    flex: 1;
}

.voice-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.voice-desc {
    color: #666;
    font-size: 0.9rem;
}

.voice-arrow {
    font-size: 1.2rem;
    color: #999;
}

/* 混音音色选择 */
.selected-mix-voices {
    min-height: 80px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.mix-placeholder {
    color: #999;
    text-align: center;
    font-style: italic;
}

.selected-mix-voice-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #e9ecef;
}

.selected-mix-voice-item:last-child {
    margin-bottom: 0;
}

.selected-mix-voice-avatar {
    font-size: 1.5rem;
    margin-right: 10px;
}

.selected-mix-voice-info {
    flex: 1;
}

.selected-mix-voice-name {
    font-weight: 500;
    color: #333;
}

.selected-mix-voice-desc {
    color: #666;
    font-size: 0.8rem;
}

.remove-voice-btn {
    background: #dc3545;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 参数调节区域 */
.params-section, .mix-params-section {
    margin-bottom: 25px;
}

.param-group {
    margin-bottom: 20px;
}

.param-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.emotion-select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.emotion-select:focus {
    outline: none;
    border-color: #667eea;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 8px;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.slider-value {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    min-width: 30px;
    text-align: center;
}

/* 混音权重 */
.mix-weights {
    margin-bottom: 25px;
}

.mix-weights h4 {
    margin-bottom: 15px;
    color: #333;
    font-weight: 600;
}

.weight-sliders {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.weight-slider-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.weight-voice-info {
    display: flex;
    align-items: center;
    min-width: 150px;
}

.weight-voice-avatar {
    font-size: 1.5rem;
    margin-right: 10px;
}

.weight-voice-name {
    font-weight: 500;
    color: #333;
}

.weight-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #e9ecef 0%, #667eea 100%);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.weight-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.weight-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.weight-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.weight-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.weight-slider:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.weight-value {
    min-width: 60px;
    text-align: center;
    font-weight: 600;
    color: #667eea;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.mix-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* 格式选择区域 */
.format-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.format-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.format-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.format-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* 操作按钮区域 */
.action-section {
    text-align: center;
    margin-bottom: 25px;
}

.synthesize-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.synthesize-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.synthesize-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.tip {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    min-height: 20px;
}

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

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

.tip.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 音频播放器区域 */
.audio-section {
    text-align: center;
    margin-bottom: 30px;
}

#player {
    width: 100%;
    max-width: 500px;
    margin-bottom: 15px;
    border-radius: 8px;
}

.download-btn {
    display: inline-block;
    background: #28a745;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.download-btn:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-header h2 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.modal-description {
    padding: 0 30px 20px;
    color: #666;
    font-size: 0.9rem;
}

.voice-source-tabs {
    display: flex;
    padding: 0 30px 20px;
    gap: 10px;
}

.source-tab {
    padding: 8px 16px;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.source-tab.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.search-section {
    padding: 0 30px 20px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.filter-section {
    padding: 0 30px 20px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #333;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tab {
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-tab.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.filter-tab:hover:not(.active) {
    background: #e9ecef;
}

.voice-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 0 30px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.voice-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.voice-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.voice-card.selected {
    border-color: #667eea;
    background: #f0f4ff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.voice-card-avatar {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 10px;
}

.voice-card-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    text-align: center;
}

.voice-card-desc {
    color: #666;
    font-size: 0.8rem;
    text-align: center;
    margin-bottom: 8px;
}

.voice-card-emotions {
    color: #999;
    font-size: 0.75rem;
    text-align: center;
    line-height: 1.3;
}

.voice-card .checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.voice-card.selected .checkbox {
    background: #667eea;
    border-color: #667eea;
}

.voice-card.selected .checkbox::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* 已选音色摘要 */
.selected-summary {
    padding: 20px 30px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.selected-count {
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.selected-voices {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.selected-voice-tag {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.selected-voice-tag-avatar {
    font-size: 1rem;
    margin-right: 6px;
}

.selected-voice-tag-name {
    margin-right: 8px;
}

.remove-tag-btn {
    background: #dc3545;
    color: white;
    border: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.btn-cancel, .btn-confirm {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-cancel {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e9ecef;
}

.btn-cancel:hover {
    background: #e9ecef;
}

.btn-confirm {
    background: #667eea;
    color: white;
}

.btn-confirm:hover {
    background: #5a6fd8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    main {
        padding: 20px;
    }
    
    .format-section {
        grid-template-columns: 1fr;
    }
    
    .mix-controls {
        grid-template-columns: 1fr;
    }
    
    .voice-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .filter-tabs {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
    }
    
    .voice-list {
        grid-template-columns: 1fr;
    }
    
    .weight-slider-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .weight-voice-info {
        min-width: auto;
    }
}
