/* 语音克隆聊天式界面样式 */

.voice-clone-chat-container {
    height: 100vh; /* 使用全视口高度 */
    max-height: 100vh; /* 确保不超过视口高度 */
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden; /* 防止容器本身产生滚动条 */
    position: fixed; /* 固定定位，避免受body padding影响 */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    padding-top: 64px; /* 为导航栏留出空间 */
    box-sizing: border-box; /* 确保padding包含在总高度内 */
}

/* 主内容区域 */
.main-content-wrapper {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0; /* 确保在flex容器中正确收缩 */
    max-height: 100%; /* 限制最大高度 */
}

/* 左侧历史记录面板 */
.history-sidebar {
    width: 90px;
    background: white;
    border-right: 1px solid #e9ecef;
    display: none; /* 默认隐藏，通过JavaScript控制显示 */
    flex-direction: column;
    transition: width 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

/* 当用户已登录时显示侧边栏 */
.history-sidebar.visible {
    display: flex;
}

/* 新建对话按钮区域 */
.new-chat-section {
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
}

.new-chat-btn {
    width: 58px;
    height: 58px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    border-color: #007bff;
    color: #007bff;
    background: rgba(0, 123, 255, 0.05);
}

.new-chat-btn i {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.new-chat-btn span {
    display: none; /* 隐藏文字，只显示加号图标 */
}

/* 历史记录列表 */
.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* 🔥 自适应高度：只有内容超出时才显示滚动条 */
    min-height: 0; /* 确保flex子项可以收缩 */
    scrollbar-gutter: stable; /* 为滚动条预留空间，避免布局跳动 */
}

/* 美化滚动条 */
.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 强制隐藏侧栏板中的音频控件 */
.history-sidebar audio,
.history-sidebar .voice-preview audio,
.history-sidebar [controls],
.history-sidebar .audio-player,
.history-sidebar [data-audio] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
}

/* 阻止侧栏板中的音频播放相关交互 */
.history-sidebar .voice-preview,
.history-sidebar .audio-player,
.history-sidebar .voice-template-option .voice-preview {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* 彻底隐藏任何可能包含音频的元素 */
.history-sidebar *[src*=".mp3"],
.history-sidebar *[src*=".wav"],
.history-sidebar *[src*=".ogg"],
.history-sidebar *[src*=".m4a"],
.history-sidebar *[src*="audio"],
.history-sidebar audio[src],
.history-sidebar source[src] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

/* 阻止侧栏板中任何媒体元素的交互 */
.history-sidebar audio::before,
.history-sidebar audio::after {
    display: none !important;
}

.history-sidebar audio::-webkit-media-controls,
.history-sidebar audio::-webkit-media-controls-panel,
.history-sidebar audio::-webkit-media-controls-play-button,
.history-sidebar audio::-webkit-media-controls-timeline,
.history-sidebar audio::-webkit-media-controls-current-time-display,
.history-sidebar audio::-webkit-media-controls-time-remaining-display,
.history-sidebar audio::-webkit-media-controls-mute-button,
.history-sidebar audio::-webkit-media-controls-volume-slider {
    display: none !important;
    visibility: hidden !important;
}

/* 最强力的阻止规则 - 使用CSS动画来持续隐藏 */
@keyframes hideAudio {
    0%, 100% {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
    }
}

.history-sidebar audio,
.history-sidebar .voice-preview,
.history-sidebar .audio-player {
    animation: hideAudio 0.1s infinite !important;
}

/* 确保图标完全居中 */
.new-chat-btn,
.history-item.thumbnail-style .history-placeholder {
    position: relative;
}

.new-chat-btn::before,
.history-item.thumbnail-style .history-placeholder::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* 确保图标文字垂直居中 */
.new-chat-btn i,
.history-item.thumbnail-style .history-placeholder i {
    line-height: 1;
    vertical-align: middle;
}

/* 历史记录项 */
.history-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    backdrop-filter: blur(10px);
}

/* 缩略图样式的历史记录项 */
.history-item.thumbnail-style {
    padding: 0 !important;
    overflow: hidden;
    width: 58px !important;
    height: 58px !important;
    margin: 0 auto !important; /* 水平居中 */
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.1);
    display: flex !important;
    flex-direction: column;
    flex-shrink: 0;  /* 防止收缩 */
    border-radius: 12px !important;
    backdrop-filter: blur(10px);
}

.history-item.thumbnail-style:hover {
    border-color: rgba(255, 255, 255, 0.6) !important;
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.history-item.thumbnail-style.selected {
    border-color: #ffffff !important;
    border-width: 2px;
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.history-item.thumbnail-style .history-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    margin: 0;
    padding: 0;
}

.history-item.thumbnail-style video.history-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    pointer-events: none; /* 防止video元素拦截点击事件 */
}

.history-item.thumbnail-style .history-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    font-size: 18px;
    position: relative;
}

.history-item.thumbnail-style .history-placeholder i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.history-item.thumbnail-style:hover .history-placeholder {
    color: #ffffff;
    transform: scale(1.1);
}

.history-item.thumbnail-style:hover .history-placeholder i {
    transform: scale(1.1);
    transition: transform 0.3s ease;
    border-radius: 6px;
    font-size: 18px;
    position: relative;
}

.history-item.thumbnail-style .history-placeholder i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* 移除info区域，因为58x58太小无法容纳文字 */
.history-item.thumbnail-style .history-info {
    display: none;
}

/* 音频历史记录项样式 */
.history-thumbnail.audio-thumbnail {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #6c757d;
    border-radius: 6px;
    cursor: pointer;
}

.history-thumbnail.audio-thumbnail .fa-volume-up {
    font-size: 20px;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 6px;
}

.history-thumbnail.audio-thumbnail:hover .play-overlay {
    opacity: 1;
}

.play-overlay .play-btn {
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.play-overlay .play-btn:hover {
    transform: scale(1.2);
}

/* Tooltip 样式 */
.history-tooltip {
    position: absolute;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    max-width: 250px;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.history-tooltip.show {
    opacity: 1;
}

.history-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

/* 删除了所有旧的文本显示样式 */

/* 调整历史记录项的样式 */
/* 删除重复的基础历史记录项样式 */

/* 删除了旧的悬停样式 */


.history-loading,
.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6c757d;
    text-align: center;
}

.history-loading i {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.history-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #dee2e6;
}

.history-empty p {
    margin: 0.5rem 0;
    font-weight: 500;
    color: #495057;
}

.history-empty small {
    color: #6c757d;
}

/* 删除了重复的旧历史记录项样式，使用新的缩略图样式 */

/* 页面标题 */
.page-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-icon {
    width: 40px;
    height: 40px;
    background: #6c757d;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: white;
    font-size: 18px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

/* 聊天内容区域 */
.chat-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    margin-bottom: 100px; /* 为居中的输入框留出空间 */
    position: relative;
    z-index: 1;
    min-height: 0; /* 确保flex子项可以收缩 */
}

.chat-content-area.with-fixed-input {
    margin-bottom: 0; /* 输入框固定在底部时不需要额外空间 */
}

.messages-container {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* 消息项 */
.message-item {
    margin-bottom: 24px;
    animation: fadeInUp 0.3s ease-out;
}

.user-message {
    display: flex;
    justify-content: flex-end;
}

.ai-message {
    display: flex;
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.user-message .message-bubble {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message .message-bubble {
    background: white;
    color: #2c3e50;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 音色列表消息 */
.voice-list-message {
    margin: 16px 0;
}

.voice-template-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.voice-template-option {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
    cursor: pointer;
    background: white;
    border: 1px solid #e9ecef;
}

.voice-template-option:hover {
    transform: scale(1.02);
    border-color: #007bff;
}

.voice-template-option .voice-info {
    padding: 12px;
}

.voice-template-option .voice-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: #2c3e50;
}

.voice-template-option .voice-description {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
}

.voice-template-option .voice-preview {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 12px;
}

.voice-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.voice-template-option:hover .voice-actions {
    opacity: 1;
}

.voice-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: rgba(0,0,0,0.7);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s ease;
}

.voice-action-btn:hover {
    background: rgba(0,0,0,0.9);
}

/* 加载状态 */
.loading-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 70%;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.generate-btn .loading-spinner {
    display: none;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    vertical-align: middle;
}

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

/* 错误消息 */
.error-message {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    max-width: 70%;
}

/* 底部输入区域 */
.input-area {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 20px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
    /* 默认在中间位置 */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    border-radius: 20px;
    z-index: 100;
    box-sizing: border-box;
}

/* 带动画效果的输入框 */
.input-area.with-transition {
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 点击生成按钮后固定在底部 */
.input-area.fixed-bottom {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: none;
    border-radius: 0;
    margin: 0;
}

.chat-input-form {
    max-width: 800px;
    margin: 0 auto;
}

/* 图片上传区域 */
.image-upload-section {
    padding: 1rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: none;
}

.uploaded-image-preview {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

#previewImage {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.remove-image-btn:hover {
    background: #ff2e43;
    transform: scale(1.1);
}

/* 主输入容器 */
.main-input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 文本输入区域 */
.text-input-wrapper {
    display: flex;
    align-items: flex-end;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    padding: 12px 16px;
    transition: border-color 0.2s ease;
    gap: 8px;
}

.text-input-wrapper:focus-within {
    border-color: #007bff;
}

.text-input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: 16px;
    line-height: 1.4;
    min-height: 24px;
    max-height: 120px;
    font-family: inherit;
    color: #2c3e50;
}

.text-input-wrapper textarea::placeholder {
    color: #adb5bd;
}

/* 输入框内的按钮组 */
.input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 输入框内的按钮基础样式 */
.input-action-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 上传按钮样式 */
.input-action-btn.upload-btn {
    color: #6c757d;
    padding: 6px;
    font-size: 16px;
}

.input-action-btn.upload-btn:hover {
    color: #007bff;
    background: rgba(0, 123, 255, 0.1);
}

/* 生成按钮样式 */
.input-action-btn.generate-btn {
    background: #007bff;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.input-action-btn.generate-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.input-action-btn.generate-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.input-action-btn.generate-btn i {
    font-size: 12px;
}

.input-action-btn.generate-btn span {
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .text-input-wrapper {
        padding: 10px 12px;
    }
    
    .input-actions {
        gap: 6px;
    }
    
    .input-action-btn.generate-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .input-action-btn.generate-btn span {
        font-size: 13px;
    }
    
    .input-action-btn.upload-btn {
        padding: 4px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .input-action-btn.generate-btn span {
        display: none; /* 在很小的屏幕上只显示图标 */
    }
    
    .input-action-btn.generate-btn {
        padding: 6px 8px;
    }
}

/* 保留原上传按钮样式作为备用 */
.upload-btn:not(.input-action-btn) {
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s ease;
    margin-left: 8px;
}

.upload-btn:not(.input-action-btn):hover {
    color: #007bff;
}

/* 参数按钮组 */
.params-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.param-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
    transition: all 0.2s ease;
}

.param-btn:hover {
    border-color: #007bff;
    color: #007bff;
}

.param-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.param-btn i {
    font-size: 12px;
}

/* 原生成按钮样式（已移到输入框内，保留作为备用） */
.generate-btn:not(.input-action-btn) {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s ease;
    align-self: flex-end;
}

.generate-btn:not(.input-action-btn):hover {
    background: #0056b3;
}

.generate-btn:not(.input-action-btn):disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* 参数面板 */
.params-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 60vh;
    overflow-y: auto;
    pointer-events: auto !important; /* 确保面板可交互 */
    display: block; /* 确保面板可见 */
}

/* 当输入框固定在底部时，参数面板需要更高的z-index */
.input-area.fixed-bottom ~ .params-panel {
    z-index: 1001;
}

.params-panel.show {
    transform: translateY(0);
    pointer-events: auto !important; /* 确保显示时可交互 */
    display: block; /* 确保显示时可见 */
}

/* 确保参数面板内容可见 */
.params-content {
    position: relative;
    z-index: 1001;
    pointer-events: auto !important; /* 确保内容可交互 */
}

.params-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

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

.param-section h6 {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
}

/* 选项按钮样式 */
.voice-template-options,
.ratio-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.voice-template-options {
    max-height: 400px; /* 模板选项更多，需要更大的高度 */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* 响应式网格 */
}

.voice-template-option,
.ratio-option {
    padding: 8px 16px;
    border: 1px solid #e9ecef;
    background: white;
    border-radius: 16px;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
    text-align: center;
}

.voice-template-option {
    font-size: 13px; /* 模板选项字体稍小 */
    padding: 12px 8px; /* 增加内边距提高点击区域 */
    pointer-events: auto !important; /* 确保可点击 */
    z-index: 999 !important; /* 确保在最上层 */
    position: relative !important; /* 确保定位正确 */
    min-height: 32px; /* 确保最小点击区域 */
    display: flex; /* 使用flex布局 */
    flex-direction: column;
    align-items: center; /* 水平居中 */
    justify-content: center; /* 垂直居中 */
}

.voice-template-option:hover,
.ratio-option:hover {
    border-color: #007bff;
    color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,123,255,0.2);
}

.voice-template-option.active,
.ratio-option.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

/* 模板选项的滚动条样式 */
.voice-template-options::-webkit-scrollbar {
    width: 4px;
}

.voice-template-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.voice-template-options::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.voice-template-options::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 高级选项 */
.advanced-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-item label {
    font-size: 14px;
    color: #2c3e50;
    min-width: 80px;
}

.option-item input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.option-item select {
    padding: 4px 8px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
}

.option-item input[type="checkbox"] {
    margin-right: 8px;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .voice-clone-chat-container {
        /* 移动端保持相同的固定定位方式 */
        height: 100vh;
        max-height: 100vh;
        padding-top: 64px;
        box-sizing: border-box;
    }
    
    .page-header {
        padding: 16px;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .chat-content-area {
        padding: 16px;
    }
    
    .input-area {
        padding: 16px;
    }
    
    .params-buttons {
        justify-content: center;
    }
    
    .param-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .generate-btn {
        align-self: stretch;
        justify-content: center;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .voice-template-options {
        grid-template-columns: 1fr;
    }
    
    /* 移动端输入框样式优化 */
    .text-input-wrapper {
        padding: 10px 12px;
    }
    
    .input-actions {
        gap: 6px;
    }
    
    .input-action-btn.generate-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .input-action-btn.generate-btn span {
        font-size: 13px;
    }
    
    .input-action-btn.upload-btn {
        padding: 4px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .input-action-btn.generate-btn span {
        display: none; /* 在很小的屏幕上只显示图标 */
    }
    
    .input-action-btn.generate-btn {
        padding: 6px 8px;
    }
    
    .voice-template-options {
        grid-template-columns: 1fr;
    }
    
    .param-btn span {
        display: none; /* 在很小的屏幕上只显示图标 */
    }
    
    .param-btn {
        padding: 6px 8px;
    }
    
    .param-btn i {
        font-size: 14px;
    }
}

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

.chat-content-area::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

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

/* 拖拽效果 */
.text-input-wrapper.drag-over {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.05);
}

/* 用户消息中的图片样式 */
.user-image img {
    max-width: 120px;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.user-prompt {
    font-size: 14px;
    line-height: 1.4;
}

/* 生成信息样式 */
.generation-info {
    margin-top: 12px;
    font-size: 12px;
    color: #6c757d;
    line-height: 1.3;
}

.generation-info div {
    margin-bottom: 4px;
}

/* 改进的按钮悬停效果 */
.param-btn:hover i,
.generate-btn:hover i {
    transform: scale(1.1);
}

/* 改进的消息动画 */
.message-item {
    animation: slideInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 改进的加载动画 */
.loading-spinner {
    animation: spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

/* 改进的图片悬停效果 */
.voice-template-option {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.voice-template-option:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* 参数面板动画优化 */
.params-panel {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 输入框聚焦效果 */
.text-input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* 按钮点击效果 */
.generate-btn:active {
    transform: scale(0.98);
}

.param-btn:active,
.voice-template-option:active,
.ratio-option:active {
    transform: scale(0.95);
}

/* 创建音色模态框 */
.voice-clone-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.voice-clone-modal.show {
    display: flex;
}

.voice-clone-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.voice-clone-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.close-modal-btn:hover {
    background: #f8f9fa;
    color: #000;
}

.voice-clone-modal-body {
    padding: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid #dc3545;
    color: #dc3545;
}

.btn-outline-danger:hover {
    background: #dc3545;
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
}

.audio-preview {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.audio-preview audio {
    width: 100%;
    margin-top: 8px;
}

.progress-container {
    margin: 16px 0;
}

.progress {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #007bff;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 16px;
}

.mb-3 {
    margin-bottom: 16px;
}

.mb-4 {
    margin-bottom: 20px;
}

.w-100 {
    width: 100%;
}

/* 🔥 新增：骨架屏动画样式 */
.history-skeleton-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
}

.history-skeleton-item {
    display: flex;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 8px;
    gap: 10px;
    opacity: 0.8;
}

.skeleton-thumbnail {
    width: 48px;
    height: 48px;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 6px;
    flex-shrink: 0;
}

.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

.skeleton-line {
    height: 12px;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 6px;
}

.skeleton-line.skeleton-title {
    width: 70%;
    height: 14px;
}

.skeleton-line.skeleton-text {
    width: 90%;
    height: 12px;
}

.skeleton-line.skeleton-meta {
    width: 50%;
    height: 10px;
    margin-top: 4px;
}

/* 骨架屏动画关键帧 */
@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 骨架屏项目的显示动画 */
.history-skeleton-item:nth-child(1) {
    animation-delay: 0s;
}

.history-skeleton-item:nth-child(2) {
    animation-delay: 0.1s;
}

.history-skeleton-item:nth-child(3) {
    animation-delay: 0.2s;
}

.history-skeleton-item:nth-child(4) {
    animation-delay: 0.3s;
}

/* 骨架屏项目的显示动画 */
.history-skeleton-item {
    animation: fadeInSkeleton 0.3s ease-out;
}

@keyframes fadeInSkeleton {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 0.8;
        transform: translateY(0);
    }
}