/* 多人配音面板样式 */
.multi-voice-panel {
    display: none; /* 默认隐藏 */
    width: 100%;
}

/* 当容器处于多人配音模式时显示多人配音面板 */
.tts-container[data-mode="multi"] .multi-voice-panel {
    display: block;
}

/* 当容器处于多人配音模式时隐藏单人配音面板 */
.tts-container[data-mode="multi"] .tts-right-panel {
    display: none;
}

/* 移动端适配 */
@media screen and (max-width: 992px) {
    .multi-voice-panel {
        padding: 0 12px;
    }

    /* 确保面板在切换时正确显示 */
    .tts-container[data-mode="multi"] {
        display: flex;
        flex-direction: column;
    }

    .tts-container[data-mode="multi"] .multi-voice-panel {
        order: 2; /* 确保面板显示在左侧面板之后 */
    }
}

@media screen and (max-width: 768px) {
    .multi-voice-panel {
        padding: 12px;
        font-size: 16px;
        margin-bottom: 12px;
    }
}

/* 特小屏幕适配 */
@media screen and (max-width: 480px) {
    .multi-voice-panel {
        padding: 0 8px;
    }
}

/* 多人配音右侧容器 */
.multi-voice-container {
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    margin: 15px 0;
}

.multi-voice-text {
    width: 100%;
    min-height: 100px;
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.voice-selector {
    margin-bottom: 15px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 200px;
}

.multi-voice-synthesize {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

.multi-voice-synthesize:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.multi-voice-player {
    margin-top: 15px;
    width: 100%;
    display: none;
}

/* 角色绑定区域 */
.role-binding-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8eef7;
}

.role-binding-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.role-binding-title h3 {
    font-size: 18px;
    color: #1a73e8;
    font-weight: 600;
    margin: 0;
}

.role-count {
    background: #e8f0fe;
    color: #1967d2;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.role-binding-actions {
    display: flex;
    gap: 12px;
}

.role-binding-actions button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

#add-binding-btn {
    background: #e8f0fe;
    color: #1967d2;
    border: 1px solid #e8f0fe;
}

#add-binding-btn:hover {
    background: #d2e3fc;
}

#save-binding-btn {
    background: #1a73e8;
    color: white;
    border: none;
}

#save-binding-btn:hover {
    background: #1557b0;
}

/* 搜索筛选区域 */
.search-filter-row {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    gap: 12px;
    position: relative;
    width: 100%; /* 改为100%宽度 */
}

.search-filter-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e8eef7;
    border-radius: 6px;
    background: #fff;
    transition: all 0.3s ease;
}

.search-filter-wrapper:hover {
    border-color: #d2e3fc;
}

/* 选中的角色标签 */
.selected-role {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin-right: 8px;
    background: #f4f8fe;
    border-radius: 4px;
    font-size: 13px;
    color: #1967d2;
    white-space: nowrap;
}

.role-remove {
    font-size: 16px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    transition: color 0.2s ease;
}

.role-remove:hover {
    color: #d93025;
}

/* 搜索输入框 */
.search-filter-input {
    flex: 1;
    border: none;
    padding: 0;
    font-size: 13px;
    background: transparent;
    min-width: 100px;
}

/* 移除 IE 的下拉箭头 */
.search-filter-input::-ms-expand {
    display: none;
}

.search-filter-input:focus {
    outline: none;
}

.search-filter-input::placeholder {
    color: #666;
}

/* 下拉列表 */
.search-filter-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e8eef7;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 200px; /* 添加最大高度 */
    overflow-y: auto; /* 添加垂直滚动条 */
}

.search-filter-dropdown.active {
    display: block;
}

/* 美化滚动条样式 */
.search-filter-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-filter-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.search-filter-dropdown::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.search-filter-dropdown::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.search-filter-option {
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
    font-size: 13px;
}

.search-filter-option:not(.disabled):hover {
    background: #f4f8fe;
    color: #1a73e8;
}

.search-filter-option.disabled {
    color: #999;
    cursor: default;
    font-size: 13px;
    text-align: center;
    padding: 16px;
}

.role-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.voice-name {
    font-size: 13px;
    color: #666;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0; /* 防止按钮被压缩 */
}

.action-buttons button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap; /* 防止文字换行 */
    cursor: pointer;
}

#insert-role-btn {
    background: #1a73e8;
    color: white;
    border: none;
}

#insert-role-btn:hover {
    background: #1557b0;
}

#delete-role-btn {
    background: #fce8e8;
    color: #d93025;
    border: none;
}

#delete-role-btn:hover {
    background: #fad2d2;
}

/* 文本输入区域 */
.text-input-area {
    margin-bottom: 24px;
}

.text-input-area textarea {
    width: 100%;
    min-height: 240px;
    padding: 16px;
    border: 2px solid #e8eef7;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    transition: all 0.3s ease;
    resize: vertical;
    white-space: pre-line; /* 保留换行符 */
}

.text-input-area textarea:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
    outline: none;
}

.text-input-area textarea::placeholder {
    color: #999;
    white-space: pre-line; /* 保留换行符 */
    line-height: 1.8; /* 增加行间距 */
}

/* 语音控制区域 */
.voice-control-area {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #f8fafe;
    border-radius: 8px;
    border: 1px solid #e8eef7;
}

/* 控制按钮 */
.voice-control-area .control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.voice-control-area .control-btn svg {
    width: 24px;
    height: 24px;
    fill: #1a73e8;
}

.voice-control-area .control-btn:hover {
    background: #f4f8fe;
}

/* 控制按钮禁用状态样式 */
.voice-control-area .control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f4f4f4; /* 添加灰色背景 */
}

.voice-control-area .control-btn:disabled svg {
    fill: #999; /* 图标变灰 */
}

/* 禁用状态下不显示hover效果 */
.voice-control-area .control-btn:disabled:hover {
    background: #f4f4f4;
}

/* 禁用状态下不显示tooltip */
.voice-control-area .control-btn:disabled[data-tooltip]:hover::after {
    display: none;
}

/* 进度条容器 */
.progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 15px;
}

/* 进度条 */
.progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: #1a73e8;
    border-radius: 2px;
    width: 0;
    transition: width 0.1s linear;
}

.progress-bar:hover .progress {
    background: #1557b0;
}

/* 时间显示 */
.time-display {
    font-size: 12px;
    color: #666;
    min-width: 85px;
    text-align: right;
}

.current-time,
.duration {
    font-family: monospace;
}

/* 工具提示 */
.voice-control-area .control-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    margin-bottom: 8px;
}

/* 弹窗样式 */
.binding-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.binding-modal.active {
    display: flex !important;
}

/* 确保弹窗内容在最上层 */
.binding-modal-content {
    position: relative;
    z-index: 100000;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.binding-modal-header h3 {
    margin: 0;
    color: #1a73e8;
    font-size: 18px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* 步骤指示器 */
.binding-steps {
    display: flex;
    padding: 20px;
    gap: 20px;
    border-bottom: 1px solid #e8eef7;
}

.binding-steps .step {
    padding: 8px 16px;
    border-radius: 20px;
    background: #f4f8fe;
    color: #666;
    font-size: 14px;
}

.binding-steps .step.active {
    background: #1a73e8;
    color: white;
}

/* 步骤内容 */
.binding-step-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.step-pane {
    display: none;
}

.step-pane.active {
    display: block;
}

/* 昵称输入 */
.nickname-input-group {
    margin-bottom: 20px;
}

.nickname-input-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.nickname-input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e8eef7;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.nickname-input-group input:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
    outline: none;
}

/* 昵称输入验证样式 */
.nickname-input-group input.invalid {
    border-color: #d93025;
}

.nickname-input-group .error-tip {
    color: #d93025;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* 音色选择区域 */
.voice-selection {
    height: 680px; /* 增加整体高度 */
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
}

/* 搜索和筛选区域 */
.search-filter-area {
    display: flex;
    gap: 12px;
    padding: 8px;
    background: #f8fafe;
    border-radius: 6px;
}

/* 控制器区域 */
.voice-controls {
    padding: 12px;
    background: #f8fafe;
    border-radius: 6px;
}

.control-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.control-group {
    flex: 1;
}

.emotion-controls {
    padding-top: 12px;
    border-top: 1px solid #e8eef7;
}

/* 滑块和选择器样式 */
.slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

input[type="range"] {
    flex: 1;
}

.emotion-style-select {
    width: 100%;
    padding: 6px;
    border: 1px solid #e8eef7;
    border-radius: 4px;
}

/* 搜索和筛选区域 - 一行布局 */
.modal-search-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #f8fafe;
    border-radius: 8px;
    border: 1px solid #e8eef7;
}

/* 搜索框样式 */
.modal-search {
    flex: 2; /* 搜索框占更多空间 */
    position: relative;
}

.modal-search input {
    width: 100%;
    height: 40px;
    padding: 0 40px 0 16px;
    border: 1px solid #e8eef7;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

/* 筛选选项样式 */
.modal-filters {
    flex: 1.5;
    display: flex;
    gap: 16px;
}

.modal-filters .filter-group {
    flex: 1;
}

.modal-filters select {
    width: 100%;
    height: 40px;
    padding: 0 16px;
    border: 1px solid #e8eef7;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

/* 弹窗中的音色卡片容器 */
.modal-cards {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    height: 400px; /* 增加滚动容器高度 */
}

.modal-cards .voice-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

/* 弹窗中的音色卡片样式 - 与左侧保持一致 */
.modal-cards .voice-card {
    width: 120px;
    height: 160px;
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    border: 2px solid transparent;
    position: relative;
}

.modal-cards .voice-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-cards .voice-card.active {
    border-color: #1a73e8;
    background: #f4f8fe;
}

.modal-cards .voice-avatar-wrapper {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    position: relative;
}

.modal-cards .voice-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #e8f0fe;
}

.modal-cards .voice-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin: 0 0 4px;
}

.modal-cards .voice-desc {
    font-size: 12px;
    color: #666;
    margin: 0;
}

/* 预览按钮样式 */
.modal-cards .preview-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: rgba(26, 115, 232, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-cards .voice-avatar-wrapper:hover .preview-btn {
    opacity: 1;
}

.modal-cards .preview-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.modal-cards .emotion-tag {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #1a73e8;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1;
}

/* 底部按钮 */
.binding-modal-footer {
    padding: 20px;
    border-top: 1px solid #e8eef7;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.binding-modal-footer button {
    padding: 8px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.prev-step {
    background: #f4f8fe;
    color: #1967d2;
    border: 1px solid #e8eef7;
}

.prev-step:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.next-step {
    background: #1a73e8;
    color: white;
    border: none;
}

.next-step:hover {
    background: #1557b0;
}

/* 添加加载状态样式 */
.control-btn.loading {
    position: relative;
    pointer-events: none;
}

.control-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 禁用状态样式 */
.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 音频播放器样式 */
#multi-voice-player {
    width: 100%;
    margin-top: 10px;
}

/* 消息提示样式 */
.message-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    width: auto;
    max-width: 90%;
    pointer-events: none;
}

.tts-message {
    background: #333;  /* 默认使用纯色深灰背景 */
    border-radius: 4px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(-20px);
    min-width: 280px;
    max-width: 480px;
}

/* 成功提示 */
.tts-message.success {
    background: #2E7D32;  /* 成功提示使用纯色绿色 */
    border-left: 4px solid #1b5e20;
    color: #1e8e3e;
}

/* 错误提示 */
.tts-message.error {
    background: #D32F2F;  /* 错误提示使用纯色红色 */
    border-left: 4px solid #b71c1c;
    color: #d93025;
}

/* 警告提示 */
.tts-message.warning {
    background: #ED6C02;  /* 使用纯色背景 */
    border-left: 4px solid #f57c00;
    color: white;
}

/* 信息提示 */
.tts-message.info {
    background: #e8f0fe;
    color: #1a73e8;
    border-left: 4px solid #1a73e8;
}

.tts-message svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.tts-message.success svg { fill: #1e8e3e; }
.tts-message.error svg { fill: #d93025; }
.tts-message.warning svg { fill: #f57c00; }
.tts-message.info svg { fill: #1a73e8; }

.message-text {
    flex: 1;
    word-break: break-word;
}

/* 消息动画 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.tts-message.fade-in {
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.tts-message.fade-out {
    animation: slideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.voice-params {
    margin: 15px 0;
}

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

.param-group label {
    display: block;
    margin-bottom: 5px;
}

.param-slider {
    width: 100%;
    margin: 10px 0;
}

.param-value {
    display: inline-block;
    margin-left: 10px;
}

.tts-input-container {
    position: relative;
}

.long-text-switch {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.long-text-switch input[type="checkbox"] {
    margin-right: 5px;
}

/* 多人配音字数统计样式 */
.multi-voice-panel .char-counter {
    margin-left: 15px;
    font-size: 12px;
    color: #666;
    display: inline-flex;
    align-items: center;
}

/* 多人配音长文本开关和字数统计布局 */
.multi-voice-panel .long-text-switch {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
}

/* 确保输入框容器有正确的定位 */
.multi-voice-panel .text-input-area {
    position: relative;
}

.multi-voice-panel .tts-input-container {
    position: relative;
}

/* 角色昵称输入框样式 */
.role-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.role-input:focus {
    border-color: #0EA5E9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.1);
    outline: none;
}

.role-input.error {
    border-color: #EF4444;
    background-color: #FEF2F2;
}

/* 优化提示框样式 */
.tts-message.warning {
    background: rgba(251, 191, 36, 0.1);
    border-left-color: #F59E0B;
    color: #92400E;
}

.tencent-tts-container {
    background: #f8faff;
    border: 1px solid #e0e7ff;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tencent-tts-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.tencent-tts-button {
    background: #2563eb;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tencent-tts-button:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.tencent-tts-button:active {
    transform: translateY(0);
}

.tencent-tts-button[disabled] {
    background: #94a3b8;
    cursor: not-allowed;
}

.tencent-tts-progress {
    flex: 1;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.tencent-tts-progress-bar {
    height: 100%;
    background: #2563eb;
    transition: width 0.3s ease;
}

.tencent-tts-time {
    font-size: 14px;
    color: #64748b;
    min-width: 60px;
    text-align: right;
}

.tencent-tts-voice-selector {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #1e293b;
    font-size: 14px;
    cursor: pointer;
}

.tencent-tts-voice-selector:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}