/* AI聊天应用主样式文件 */
/* 模块化版本: 1.0.0 */
/* 兼容性: 支持模块化架构 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.chat-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.18);
    width: 100%;
    max-width: 800px;
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, var(--primary-color, #6a11cb) 0%, var(--secondary-color, #2575fc) 100%);
    padding: 15px 20px;
    border-radius: 25px 25px 0 0;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60px;
}

.chat-header h1 {
    color: white;
    font-size: 1.5rem;
    text-align: center;
    margin: 0;
    flex: 1;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    line-height: 1.6;
    letter-spacing: 0.3px;
}

.message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
    position: relative;
}

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

.message.user {
    align-items: flex-end;
}

.message-content {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.user .message-content {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.bot .message-content {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

/* 添加时间戳样式 */
.message::after {
    display: none; /* 隐藏时间戳 */
}

/* 移动端适配 */
@media (max-width: 768px) {
    .message-content {
        max-width: 85%;
        font-size: 14px;
        padding: 10px 16px;
    }
    
    .chat-messages {
        padding: 15px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .chat-messages {
        background: rgba(30, 32, 42, 0.95);
    }

    .bot .message-content {
        background: linear-gradient(135deg, #2a2a4a 0%, #1a1c2c 100%);
        color: #fff;
    }
}

.chat-input {
    background: rgba(255, 255, 255, 0.98);
    padding: 15px 20px;
    border-top: 1px solid rgba(106, 17, 203, 0.1);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 0 0 25px 25px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    min-height: 70px;
    box-sizing: border-box;
    /* 确保按钮垂直居中 */
    align-items: center;
}

/* 输入框容器，用于独立控制输入框高度 */
.input-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 50px;
    max-height: 200px;
    position: relative;
    align-self: stretch;
    /* 确保容器可以正确处理内部输入框的高度变化 */
    overflow: hidden;
    /* 添加过渡效果使高度变化更平滑 */
    transition: height 0.3s ease;
    /* 确保容器在flex布局中正确对齐 */
    align-items: stretch;
    justify-content: flex-start;
    /* 确保容器正确显示滚动条 */
    overflow-y: hidden;
    /* 确保容器内的文本正确换行 */
    word-break: break-word;
    /* 确保容器能够正确适应内容高度 */
    flex-shrink: 0;
    /* 设置初始高度为50px */
    height: 50px;
}

#userInput {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid rgba(106, 17, 203, 0.2);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(106, 17, 203, 0.1);
    outline: none;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    -webkit-user-select: text;
    user-select: text;
    -webkit-tap-highlight-color: transparent;
    height: auto;
    min-height: 50px;
    max-height: 200px;
    box-sizing: border-box;
    line-height: 1.4;
    resize: none;
    overflow-y: auto;
    /* 确保文本自动换行 */
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    /* 确保输入框可以正确调整高度 */
    transition: height 0.3s ease;
    /* 确保文本在容器内正确换行 */
    overflow-wrap: break-word;
    /* 确保textarea没有默认边框 */
    border: 2px solid rgba(106, 17, 203, 0.2);
    /* 确保textarea正确显示 */
    display: block;
    width: 100%;
    /* 设置初始高度为50px */
    height: 50px;
}

#userInput:hover {
    border-color: rgba(106, 17, 203, 0.3);
    box-shadow: 0 4px 12px rgba(106, 17, 203, 0.15);
}

#userInput:focus {
    border-color: rgba(106, 17, 203, 0.5);
    box-shadow: 0 4px 15px rgba(106, 17, 203, 0.2);
    background: #ffffff;
    /* 焦点状态下显示调整大小的提示 */
    transition: all 0.3s ease, height 0.3s ease-out;
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    #userInput {
        background: rgba(30, 32, 42, 0.95);
        border-color: rgba(255, 255, 255, 0.2);
        color: #fff;
    }

    #userInput:hover {
        border-color: rgba(255, 255, 255, 0.3);
        background: rgba(40, 42, 52, 0.95);
    }

    #userInput:focus {
        border-color: rgba(255, 255, 255, 0.4);
        background: rgba(50, 52, 62, 0.95);
    }

    .chat-input {
        background: rgba(20, 22, 32, 0.98);
    }
    
    /* 深色模式下的滚动条样式 */
    #userInput::-webkit-scrollbar {
        width: 8px;
    }
    
    #userInput::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 4px;
    }
    
    #userInput::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 4px;
    }
    
    #userInput::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }
    
    /* 深色模式下的输入框容器 */
    .input-container {
        /* 可以根据需要添加深色模式特定样式 */
    }
}

/* 确保输入框在所有情况下都能正确显示滚动条 */
#userInput::-webkit-scrollbar {
    width: 8px;
}

#userInput::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

#userInput::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

#userInput::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

#sendButton {
    background: linear-gradient(135deg, var(--primary-color, #6a11cb) 0%, var(--secondary-color, #2575fc) 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 80px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

/* 文件上传按钮样式 */
.file-upload-wrapper {
    position: relative;
    display: inline-block;
}

.file-upload-button {
    background: linear-gradient(135deg, rgba(106, 17, 203, 0.8) 0%, rgba(150, 51, 255, 0.8) 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    padding: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    box-shadow: 0 4px 12px rgba(106, 17, 203, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.file-upload-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(106, 17, 203, 0.4);
    background: linear-gradient(135deg, rgba(85, 14, 163, 0.9) 0%, rgba(120, 41, 204, 0.9) 100%);
    border-color: rgba(255, 255, 255, 0.5);
}

.file-upload-button:active {
    transform: scale(0.95);
}

/* 文件输入框样式 */
.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

#sendButton:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

/* 停止按钮样式 */
#stopButton {
    background: linear-gradient(135deg, var(--primary-color, #e74c3c) 0%, var(--secondary-color, #c0392b) 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 120px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    gap: 8px;
    animation: pulse-stop 2s infinite;
}

#stopButton:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 6px rgba(231, 76, 60, 0.3);
    background: linear-gradient(135deg, var(--primary-color, #c0392b) 0%, var(--secondary-color, #a93226) 100%);
}

#stopButton i {
    font-size: 14px;
}

#stopButton span {
    font-size: 14px;
    font-weight: 500;
}

/* 停止按钮脉冲动画 */
@keyframes pulse-stop {
    0% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

/* 继续按钮样式 */
.continue-generation-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    border: 1px solid rgba(76, 175, 80, 0.5);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 8px 0 0 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.2);
}

.continue-generation-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    border-color: rgba(76, 175, 80, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.continue-generation-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.2);
}

.continue-generation-btn i {
    font-size: 11px;
}

.continue-generation-btn:disabled {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    border-color: rgba(150, 150, 150, 0.5);
    color: rgba(255, 255, 255, 0.7);
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 继续按钮样式结束 */

/* 文件内容显示样式 */
.file-content {
    margin: 10px 0;
}

.file-content .file-icon {
    font-size: 24px;
    color: #6a11cb;
    margin-right: 10px;
}

.file-content .file-info {
    display: flex;
    flex-direction: column;
}

.file-content .file-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.file-content .file-size {
    font-size: 0.9em;
    color: #666;
}

.file-content .local-path,
.file-content .api-result {
    font-size: 0.8em;
    margin-top: 5px;
}

.file-content .api-result.success {
    color: #4CAF50;
}

.file-content .api-result.error {
    color: #f44336;
}

/* 内容操作按钮样式 */
.content-action-buttons {
    margin: 12px 0 8px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.content-action-btn {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    border: 1px solid rgba(33, 150, 243, 0.5);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    text-decoration: none;
    min-height: 28px;
}

.content-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(33, 150, 243, 0.3);
}

.content-action-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(33, 150, 243, 0.2);
}

.content-action-btn i {
    font-size: 10px;
}

/* 不同类型按钮的颜色 */
.view-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    border-color: rgba(76, 175, 80, 0.5);
}

.view-btn:hover {
    box-shadow: 0 3px 8px rgba(76, 175, 80, 0.3);
}

.download-btn {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    border-color: rgba(255, 152, 0, 0.5);
}

.download-btn:hover {
    box-shadow: 0 3px 8px rgba(255, 152, 0, 0.3);
}

.url-btn {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    border-color: rgba(156, 39, 176, 0.5);
}

.url-btn:hover {
    box-shadow: 0 3px 8px rgba(156, 39, 176, 0.3);
}

.program-btn {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    border-color: rgba(244, 67, 54, 0.5);
}

.program-btn:hover {
    box-shadow: 0 3px 8px rgba(244, 67, 54, 0.3);
}

.error-btn {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    border-color: rgba(244, 67, 54, 0.5);
    cursor: not-allowed;
    opacity: 0.7;
}

.error-btn:hover {
    transform: none;
    box-shadow: none;
}

/* 按钮组样式 */
.html-buttons-group,
.program-buttons-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* 文件信息样式 */
.file-info,
.program-info {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 8px;
    white-space: nowrap;
}

/* 禁用状态 */
.content-action-btn:disabled {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    border-color: rgba(150, 150, 150, 0.5);
    color: rgba(255, 255, 255, 0.6);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.content-action-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .content-action-buttons {
        gap: 6px;
    }
    
    .content-action-btn {
        font-size: 10px;
        padding: 5px 10px;
        min-height: 26px;
    }
    
    .file-info,
    .program-info {
        font-size: 9px;
    }
}

/* 头部按钮通用样式 */
.history-button,
.link-panel-button,
.translate-toggle,
.settings-button {
    position: absolute;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    cursor: pointer;
    font-size: 1rem;
    padding: 10px;
    transition: all 0.3s ease;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 50%;
    transform: translateY(-50%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10;
    box-sizing: border-box;
}

.history-button {
    left: 85px;
}

.link-panel-button {
    left: -30px;
}

.translate-toggle {
    right: 99px;
}

.settings-button {
    right: 10px;
}

.history-button:hover,
.link-panel-button:hover,
.translate-toggle:hover,
.settings-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.history-button:active,
.link-panel-button:active,
.translate-toggle:active,
.settings-button:active {
    transform: translateY(-50%) scale(0.95);
}

/* 确保按钮在小屏幕上不会重叠 */
@media (max-width: 768px) {
    .chat-header {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 15px;
        min-height: 55px;
    }
    
    .chat-header h1 {
        flex: 1;
        text-align: center;
        margin: 0 100px; /* 为左右按钮留出空间 */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 1.3rem;
    }
    
    .history-button,
    .link-panel-button,
    .translate-toggle,
    .settings-button {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
}

/* 超小屏幕适配 */
@media (max-width: 360px) {
    .chat-header {
        padding: 8px 5px;
        min-height: 45px;
    }
    
    .chat-header h1 {
        margin: 0 75px; /* 进一步减小边距 */
        font-size: 1rem;
    }
    
    .history-button,
    .link-panel-button,
    .translate-toggle,
    .settings-button {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .link-panel-button {
        left: -102px;
    }
    
    .history-button {
        left: 48px;
    }
    
    .translate-toggle {
        right: 42px;
    }
    
    .settings-button {
        right: 3px;
    }
}

/* 极小屏幕适配 */
@media (max-width: 320px) {
    .chat-header h1 {
        margin: 0 70px;
        font-size: 0.9rem;
    }
    
    .history-button,
    .link-panel-button,
    .translate-toggle,
    .settings-button {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
    
    .link-panel-button {
        left: -118px;
    }
    
    .history-button {
        left: 42px;
    }
    
    .translate-toggle {
        right: 38px;
    }
    
    .settings-button {
        right: 2px;
    }
}

/* 小屏幕适配 (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .history-button {
        left: 70px;
    }
    
    .link-panel-button {
        left: -35px;
    }
    
    .translate-toggle {
        right: 90px;
    }
    
    .settings-button {
        right: 10px;
    }
}

/* 中等屏幕适配 (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .history-button {
        left: 85px;
    }
    
    .link-panel-button {
        left: -30px;
    }
    
    .translate-toggle {
        right: 95px;
    }
    
    .settings-button {
        right: 10px;
    }
}

/* 翻译开关激活状态样式 */
.translate-toggle.active {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    animation: translate-active-pulse 2s ease-in-out infinite;
}

.translate-toggle.active:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%) !important;
    transform: translateY(-50%) scale(1.1);
}

/* 翻译开关激活状态的脉冲动画 */
@keyframes translate-active-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
        transform: translateY(-50%) scale(1);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(220, 53, 69, 0);
        transform: translateY(-50%) scale(1.05);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
        transform: translateY(-50%) scale(1);
    }
}

.settings-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-color, #1a1c2d) 0%, var(--secondary-color, #2d1f3d) 100%);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow: hidden;
    color: #fff;
}

.settings-panel.active {
    right: 0;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-header h2 {
    margin: 0;
    color: #fff;
    font-size: 1.5em;
}

.close-button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.3s ease;
}

.close-button:hover {
    transform: rotate(90deg);
}

.setting-item {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* 翻译开关样式 */
.translation-setting {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.switch-container {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.switch {
    display: none;
}

.switch-label {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.switch-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch-text {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    min-width: 30px;
    transition: all 0.3s ease;
}

.switch:checked + .switch-label {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    border-color: rgba(255, 255, 255, 0.5);
}

.switch:checked + .switch-label .switch-slider {
    left: 32px;
}

.switch:checked + .switch-label .switch-text::after {
    content: attr(data-on);
}

.switch:not(:checked) + .switch-label .switch-text::after {
    content: attr(data-off);
}

.switch-label:hover {
    background: rgba(255, 255, 255, 0.3);
}

.switch:checked + .switch-label:hover {
    background: linear-gradient(135deg, #7a21db 0%, #3585fc 100%);
}

/* 翻译结果样式 */
.translation-result {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(33, 150, 243, 0.3);
    border-radius: 8px;
    padding: 12px;
    font-size: 15px; /* 调整为与聊天内容一致的字体大小 */
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.translation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 15px; /* 增大标题字体，从13px改为15px */
}

/* 新增：AI回复翻译样式 */
.ai-translation {
    margin-top: 15px;
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.2);
    border-radius: 8px;
    padding: 12px;
    font-size: 15px; /* 调整为与聊天内容一致的字体大小 */
    animation: fadeIn 0.3s ease;
}

.ai-translation .translation-header {
    color: rgba(33, 150, 243, 0.9);
    margin-bottom: 8px;
}

.ai-translation .translation-content {
    color: #333;
    background: rgba(255, 255, 255, 0.95);
    line-height: 1.6; /* 提高行高 */
    padding: 12px 15px; /* 增大内边距，从8px改为12px 15px */
    border-radius: 4px;
    font-weight: 500;
    font-size: 15px; /* 调整为与聊天内容一致的字体大小 */
}

/* 用户输入翻译信息样式 */
.translation-info {
    margin-top: 8px;
    padding: 6px 10px; /* 增大内边距，从4px 8px改为6px 10px */
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: 4px;
    font-size: 13px; /* 增大字体，从12px改为13px */
    color: rgba(76, 175, 80, 0.9);
}

.translation-info small {
    display: flex;
    align-items: center;
    gap: 4px;
}

.translation-header i {
    margin-right: 5px;
    color: #6a11cb;
}

.close-translation {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 12px;
}

.close-translation:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.translation-content {
    color: #333;
    background: rgba(255, 255, 255, 0.95);
    line-height: 1.6; /* 提高行高，从1.5改为1.6 */
    border-left: 3px solid #6a11cb;
    padding: 12px 15px; /* 增大内边距，从8px 10px改为12px 15px */
    border-radius: 4px;
    font-weight: 500;
    font-size: 15px; /* 调整为与聊天内容一致的字体大小 */
}

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

.setting-item select,
.setting-item input[type="text"],
.setting-item input[type="password"] {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    transition: all 0.3s ease;
}

.setting-item select:hover,
.setting-item input[type="text"]:hover,
.setting-item input[type="password"]:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.setting-item select:focus,
.setting-item input[type="text"]:focus,
.setting-item input[type="password"]:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    outline: none;
}

.test-api-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    margin-top: 15px;
}

.test-api-button:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.test-api-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.model-settings {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin: 15px;
    padding: 20px;
}

.model-settings h3 {
    color: #fff;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.model-selection {
    margin-bottom: 20px;
}

.model-selection select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 10px;
    width: 100%;
    color: #fff;
    cursor: pointer;
}

.api-settings {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    margin-top: 15px;
}

.api-settings .setting-group {
    margin-bottom: 15px;
}

.api-settings input {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    transition: all 0.3s ease;
}

.api-settings input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.test-button-container {
    padding: 15px;
    margin-top: -10px;
    text-align: center;
}

.test-button {
    background: linear-gradient(135deg, var(--primary-color, #6a11cb) 0%, var(--secondary-color, #2575fc) 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.test-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.test-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .chat-header {
        padding: 12px 15px;
        min-height: 55px;
    }
    
    .chat-header h1 {
        font-size: 1.3rem;
        margin: 0 100px; /* 为按钮留出空间 */
        text-align: center;
    }
    
    .history-button,
    .link-panel-button,
    .translate-toggle,
    .settings-button {
        width: 38px;
        height: 38px;
        font-size: 1rem;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .chat-input {
        padding: 12px 15px;
        gap: 10px;
    }
    
    .voice-button {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }

    #sendButton {
        padding: 12px 20px;
        min-width: 60px;
        font-size: 0.95rem;
    }

    .test-button {
        width: 90%;
        max-width: 300px;
    }
}

/* 更小屏幕适配 */
@media (max-width: 480px) {
    .chat-header {
        padding: 10px 10px;
        min-height: 50px;
    }
    
    .chat-header h1 {
        font-size: 1.1rem;
        margin: 0 90px; /* 为按钮留出空间 */
        text-align: center;
    }
    
    .history-button,
    .link-panel-button,
    .translate-toggle,
    .settings-button {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }
    
    .link-panel-button {
        left: -25px;
    }
    
    .history-button {
        left: 60px;
    }
    
    .translate-toggle {
        right: 78px;
    }
    
    .settings-button {
        right: 5px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 360px) {
    .chat-header h1 {
        font-size: 1rem;
        margin: 0 80px; /* 为按钮留出空间 */
    }
    
    .history-button,
    .link-panel-button,
    .translate-toggle,
    .settings-button {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .link-panel-button {
        left: -102px;
    }
    
    .history-button {
        left: 48px;
    }
    
    .translate-toggle {
        right: 42px;
    }
    
    .settings-button {
        right: 3px;
    }
}

/* 调整设置面板在移动端的布局 */
@media (max-width: 768px) {
    .settings-panel {
        width: 100%;
        right: -100%;
        border-radius: 0;
    }

    .settings-header {
        padding: 12px 15px;
    }

    .settings-content {
        padding: 12px;
    }

    .setting-item {
        margin-bottom: 12px;
    }

    /* 头像选择部分 */
    .avatar-setting {
        margin-bottom: 20px;
    }
    
    .avatar-preview {
        display: flex;
        justify-content: center;
        margin-bottom: 15px;
    }
    
    .avatar-preview img {
        width: 80px;
        height: 80px;
        border-radius: 50%;
        border: 3px solid rgba(255, 255, 255, 0.3);
        object-fit: cover;
        transition: all 0.3s ease;
    }
    
    .avatar-preview img:hover {
        border-color: rgba(255, 255, 255, 0.6);
        transform: scale(1.05);
    }

    .preset-avatars {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
        margin-bottom: 15px;
    }

    .avatar-option {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        border-radius: 50%;
        border: 2px solid rgba(255, 255, 255, 0.2);
        cursor: pointer;
        transition: all 0.3s ease;
        object-fit: cover;
    }
    
    .avatar-option:hover {
        border-color: rgba(255, 255, 255, 0.5);
        transform: scale(1.1);
    }
    
    .avatar-option.selected {
        border-color: #6a11cb;
        border-width: 3px;
        transform: scale(1.05);
    }

    /* 滑块设置 */
    .setting-item label {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .setting-item input[type="range"] {
        margin: 8px 0;
        height: 24px;
    }

    .setting-item span {
        font-size: 12px;
    }

    /* 测试按钮 */
    .test-button {
        position: relative;
        margin: 15px auto;
        padding: 10px 20px;
        font-size: 15px;
        width: calc(100% - 24px);
        max-width: none;
    }
}

/* 确保设置面板内容可滚动 */
.settings-content {
    height: calc(100vh - 70px); /* 进一步减少头部高度占用，增加更多内容空间 */
    overflow-y: auto;
    padding: 10px 15px; /* 进一步减少padding，提供更多可用空间 */
}

/* 录音按钮基础样式 */
.voice-button {
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.8) 0%, rgba(51, 133, 255, 0.8) 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    padding: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.voice-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.voice-button:hover::before {
    left: 100%;
}

.voice-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.4);
    background: linear-gradient(135deg, rgba(0, 82, 204, 0.9) 0%, rgba(26, 117, 255, 0.9) 100%);
    border-color: rgba(255, 255, 255, 0.5);
}

.voice-button:active {
    transform: scale(0.95);
}

/* 录音状态样式 */
.voice-button.recording {
    background: linear-gradient(135deg, rgba(255, 51, 51, 0.9) 0%, rgba(255, 0, 0, 0.9) 100%) !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    animation: recording-pulse 1.5s ease-in-out infinite;
}

/* 录音状态下的hover效果 */
.voice-button.recording:hover {
    background: linear-gradient(135deg, rgba(255, 20, 20, 0.95) 0%, rgba(220, 0, 0, 0.95) 100%) !important;
    transform: scale(1.05);
}

/* 增强的脉冲动画 */
@keyframes recording-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 30px 15px rgba(255, 0, 0, 0);
        transform: scale(1.08);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
        transform: scale(1);
    }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .voice-button {
        background: linear-gradient(135deg, rgba(0, 102, 255, 0.5) 0%, rgba(51, 133, 255, 0.5) 100%);
        box-shadow: 0 2px 6px rgba(0, 102, 255, 0.3);
    }

    .voice-button:hover {
        background: linear-gradient(135deg, rgba(0, 82, 204, 0.6) 0%, rgba(26, 117, 255, 0.6) 100%);
        box-shadow: 0 4px 8px rgba(0, 102, 255, 0.4);
    }

    .voice-button.recording {
        background: linear-gradient(135deg, rgba(255, 51, 51, 0.8) 0%, rgba(255, 0, 0, 0.8) 100%) !important;
        border-color: rgba(255, 255, 255, 0.9) !important;
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
}

/* 禁用状态 */
.voice-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 转写按钮样式 */
#transcribeButton {
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.8) 0%, rgba(51, 133, 255, 0.8) 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    padding: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    margin-left: 10px;
}

/* 转写按钮提示信息样式 */
.voice-button-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    margin-bottom: 8px;
}

#transcribeButton:hover .voice-button-tooltip {
    opacity: 1;
}

.voice-button-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
}

#transcribeButton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

#transcribeButton:hover::before {
    left: 100%;
}

#transcribeButton:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.4);
    background: linear-gradient(135deg, rgba(0, 82, 204, 0.9) 0%, rgba(26, 117, 255, 0.9) 100%);
    border-color: rgba(255, 255, 255, 0.5);
}

#transcribeButton:active {
    transform: scale(0.95);
}

/* 转写状态样式 */
#transcribeButton.recording {
    background: linear-gradient(135deg, rgba(255, 51, 51, 0.9) 0%, rgba(255, 0, 0, 0.9) 100%) !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    animation: recording-pulse 1.5s ease-in-out infinite;
}

/* 转写状态下的hover效果 */
#transcribeButton.recording:hover {
    background: linear-gradient(135deg, rgba(255, 20, 20, 0.95) 0%, rgba(220, 0, 0, 0.95) 100%) !important;
    transform: scale(1.05);
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    #transcribeButton {
        background: linear-gradient(135deg, rgba(0, 102, 255, 0.5) 0%, rgba(51, 133, 255, 0.5) 100%);
        box-shadow: 0 2px 6px rgba(0, 102, 255, 0.3);
    }

    #transcribeButton:hover {
        background: linear-gradient(135deg, rgba(0, 82, 204, 0.6) 0%, rgba(26, 117, 255, 0.6) 100%);
        box-shadow: 0 4px 8px rgba(0, 102, 255, 0.4);
    }

    #transcribeButton.recording {
        background: linear-gradient(135deg, rgba(255, 51, 51, 0.8) 0%, rgba(255, 0, 0, 0.8) 100%) !important;
        border-color: rgba(255, 255, 255, 0.9) !important;
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
}

/* 禁用状态 */
#transcribeButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 数字人形象样式 */
.avatar-container {
    padding: 25px;
    background: linear-gradient(180deg, #e6f3ff 0%, #ffffff 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    min-height: 200px;
}

.avatar-wrapper {
    position: relative;
    display: inline-block;
    transition: transform 0.3s ease;
}

.avatar-wrapper.speaking {
    animation: speaking 2s ease-in-out infinite;
}

@keyframes speaking {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.avatar-image {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(106, 17, 203, 0.25);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 25px rgba(106, 17, 203, 0.15), 
                0 0 0 0 rgba(106, 17, 203, 0);
    cursor: pointer;
    position: relative;
}

.avatar-image:hover {
    border-color: rgba(106, 17, 203, 0.4);
    transform: scale(1.03);
    box-shadow: 0 12px 35px rgba(106, 17, 203, 0.25), 
                0 0 0 8px rgba(106, 17, 203, 0.1);
}

/* 在说话状态下，头像的优雅呼吸效果 */
.avatar-wrapper.speaking .avatar-image {
    cursor: pointer;
    border-color: rgba(52, 199, 89, 0.6);
    animation: speaking-glow 2s ease-in-out infinite;
    box-shadow: 0 8px 25px rgba(52, 199, 89, 0.3), 
                0 0 0 0 rgba(52, 199, 89, 0.4);
}

.avatar-wrapper.speaking .avatar-image:hover {
    border-color: rgba(52, 199, 89, 0.8);
    box-shadow: 0 12px 35px rgba(52, 199, 89, 0.4), 
                0 0 0 12px rgba(52, 199, 89, 0.15);
}

@keyframes speaking-glow {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(52, 199, 89, 0.3), 
                    0 0 0 0 rgba(52, 199, 89, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 12px 35px rgba(52, 199, 89, 0.4), 
                    0 0 0 8px rgba(52, 199, 89, 0.2);
        transform: scale(1.02);
    }
}

.avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 60px;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
    cursor: pointer;
}

.avatar-wrapper:hover .avatar-image {
    transform: scale(1.05);
}

.avatar-animation {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.avatar-animation.speaking {
    opacity: 1;
}

/* 声波动画 */
.sound-wave {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80px;
    gap: 12px;
    padding: 0 30px;
    background: rgba(0, 132, 255, 0.1);
    border-radius: 40px;
}

.sound-wave span {
    width: 8px;
    height: 30px;
    background-color: rgba(0, 132, 255, 0.8);
    border-radius: 4px;
    transition: all 0.1s ease;
    transform-origin: bottom;
}

.avatar-animation.speaking .sound-wave span {
    animation: sound-wave-animation 0.5s infinite ease-in-out;
}

/* 为每个条设置不同的初始高度和动画延迟 */
.sound-wave span:nth-child(1) { 
    animation-delay: 0.0s;
    height: 20px;
}
.sound-wave span:nth-child(2) { 
    animation-delay: 0.1s;
    height: 40px;
}
.sound-wave span:nth-child(3) { 
    animation-delay: 0.2s;
    height: 60px;
}
.sound-wave span:nth-child(4) { 
    animation-delay: 0.3s;
    height: 40px;
}
.sound-wave span:nth-child(5) { 
    animation-delay: 0.4s;
    height: 20px;
}

/* 添加更多声波条 */
.sound-wave::before,
.sound-wave::after {
    content: '';
    width: 8px;
    height: 15px;
    background-color: rgba(0, 132, 255, 0.8);
    border-radius: 4px;
}

@keyframes sound-wave-animation {
    0% {
        transform: scaleY(0.8);
    }
    50% {
        transform: scaleY(1.5);
    }
    100% {
        transform: scaleY(0.8);
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .chat-container {
        border-radius: 0;
        height: 100vh;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .settings-panel {
        width: 100%;
        right: -100%;
    }
}

/* 头像设置样式 */
.avatar-setting {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.avatar-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.preset-avatars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 10px;
}

.avatar-option {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    background-color: white;
    padding: 2px;
}

.avatar-option:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 132, 255, 0.2);
}

.avatar-option.selected {
    border-color: #0084ff;
    box-shadow: 0 2px 8px rgba(0, 132, 255, 0.3);
}

.custom-avatar {
    margin-top: 10px;
}

.upload-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.upload-button:hover {
    background: linear-gradient(135deg, #5a0cb7 0%, #1565e8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.upload-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 角色选择样式 */
.role-setting {
    margin-bottom: 30px;
}

.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 15px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
}

/* 自定义滚动条样式 */
.role-grid::-webkit-scrollbar {
    width: 6px;
}

.role-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.role-grid::-webkit-scrollbar-thumb {
    background: rgba(106, 17, 203, 0.3);
    border-radius: 3px;
}

.role-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(106, 17, 203, 0.5);
}

.role-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    min-height: 120px;
    overflow: hidden;
}

.role-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: rgba(106, 17, 203, 0.3);
}

.role-card:active {
    transform: translateY(0);
    transition: transform 0.1s ease;
}

.role-card.selected {
    border-color: var(--primary-color, #6a11cb);
    background: linear-gradient(135deg, rgba(106, 17, 203, 0.1), rgba(37, 117, 252, 0.1));
    box-shadow: 0 4px 16px rgba(106, 17, 203, 0.2);
    transform: translateY(-1px);
}

.role-card img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    transition: transform 0.3s ease;
    background: white;
    padding: 3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    object-fit: cover;
}

.role-card:hover img {
    transform: scale(1.1);
}

.role-card span {
    display: block;
    color: #333;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-card.selected span,
.role-card.custom-saved span {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Delete button style */
.delete-role-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ff4757;
    font-size: 11px;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.delete-role-btn:hover {
    background: #ff4757;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.3);
}

.role-card:hover .delete-role-btn {
    opacity: 1;
}

/* Show delete button on mobile */
@media (max-width: 768px) {
    .delete-role-btn {
        opacity: 0.8;
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    .delete-role-btn:hover {
        opacity: 1;
    }
}

/* Role card loading animation */
@keyframes roleCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.role-card {
    animation: roleCardFadeIn 0.3s ease-out;
}

/* Custom role theme support */
.role-card[data-role^="custom_"] {
    border: 2px solid rgba(var(--primary-color-rgb, 106, 17, 203), 0.2);
}

.role-card[data-role^="custom_"]:hover {
    border-color: rgba(var(--primary-color-rgb, 106, 17, 203), 0.5);
}

.role-card[data-role^="custom_"].selected {
    background: linear-gradient(135deg, 
        rgba(var(--primary-color-rgb, 106, 17, 203), 0.1), 
        rgba(var(--secondary-color-rgb, 37, 117, 252), 0.1));
    border-color: var(--primary-color, #6a11cb);
}

/* Role name tooltip */
.role-card span {
    position: relative;
}

.role-card span:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    animation: tooltipFadeIn 0.3s ease-out 0.5s forwards;
    pointer-events: none;
    z-index: 1000;
}

@keyframes tooltipFadeIn {
    to {
        opacity: 1;
    }
}

/* 角色网格滚动提示 */
.role-grid::after {
    content: '可以滚动查看更多角色';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: rgba(106, 17, 203, 0.6);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.role-setting:hover .role-grid::after {
    opacity: 1;
}

/* 移动端适配 */
@media (max-width: 480px) {
    .role-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
        max-height: 250px;
    }
    
    .role-card {
        padding: 12px 8px;
        min-height: 100px;
    }
    
    .role-card img {
        width: 50px;
        height: 50px;
        padding: 2px;
    }
    
    .role-card span {
        font-size: 0.8rem;
    }
}

/* 角色切换动画 */
.avatar-container {
    position: relative;
}

.avatar-image {
    transition: all 0.3s ease;
}

.avatar-image.switching {
    transform: scale(0.8);
    opacity: 0;
}

/* 主题颜色变量 */
:root {
    --primary-color: #6a11cb;
    --secondary-color: #2575fc;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .role-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    
    .role-card {
        padding: 12px 8px;
    }
}

@media (max-width: 480px) {
    .role-grid {
        grid-template-columns: 1fr;
    }
}

/* 头像说话动画 */
.avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 60px;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
}

/* 说话时的头像动画 */
@keyframes subtle-bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-2px) scale(1.02);
    }
}

.avatar-wrapper.speaking .avatar-image {
    animation: subtle-bounce 1s ease-in-out infinite;
    cursor: pointer;
    border-color: rgba(255, 87, 34, 0.6) !important;
    box-shadow: 0 4px 15px rgba(255, 87, 34, 0.3) !important;
}

/* 说话时的光环效果 */
.avatar-wrapper::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 60px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.avatar-wrapper.speaking::after {
    opacity: 0.3;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        opacity: 0.2;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(1.05);
    }
}

/* 声波动画容器 */
.sound-wave-container {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 15px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.avatar-wrapper.speaking .sound-wave-container {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

.sound-wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 20px;
}

.sound-wave span {
    width: 3px;
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 3px;
    animation: sound-wave 0.5s ease infinite;
}

.sound-wave span:nth-child(1) { animation-delay: 0.1s; }
.sound-wave span:nth-child(2) { animation-delay: 0.2s; }
.sound-wave span:nth-child(3) { animation-delay: 0.3s; }
.sound-wave span:nth-child(4) { animation-delay: 0.4s; }
.sound-wave span:nth-child(5) { animation-delay: 0.5s; }

@keyframes sound-wave {
    0%, 100% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
}

/* 在PC端使用更宽的消息框 */
@media (min-width: 768px) {
    .message-content {
        max-width: 90%;
    }
    
    .chat-container {
        max-width: 1000px;  /* 增加整体容器宽度 */
    }
}

/* 移动端保持原有宽度 */
@media (max-width: 768px) {
    .message-content {
        max-width: 85%;
        font-size: 14px;
        padding: 10px 16px;
    }
}

/* 知识库管理样式 */
.knowledge-base {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

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

.knowledge-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.knowledge-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 450px; /* 从300px增加到450px，提供更多显示空间 */
    overflow-y: auto;
    padding: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.knowledge-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.knowledge-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.knowledge-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 102, 255, 0.1);
    border-radius: 8px;
    color: #0066ff;
}

.file-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
}

.file-meta {
    font-size: 0.8rem;
    color: #666;
}

.knowledge-actions {
    display: flex;
    gap: 8px;
}

.action-button {
    padding: 6px;
    border: none;
    background: none;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.action-button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.action-button.delete:hover {
    background: rgba(255, 0, 0, 0.1);
    color: #ff3333;
}

.upload-knowledge {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.5) 0%, rgba(51, 133, 255, 0.5) 100%);
    border: 2px dashed rgba(0, 102, 255, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.upload-knowledge:hover {
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.6) 0%, rgba(51, 133, 255, 0.6) 100%);
    border-color: rgba(0, 102, 255, 0.5);
    transform: translateY(-2px);
}

.upload-icon {
    font-size: 24px;
    color: white;
}

.upload-text {
    color: white;
    font-size: 0.9rem;
    text-align: center;
}

.file-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 5px;
}

.progress-bar {
    height: 100%;
    background: white;
    transition: width 0.3s ease;
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .knowledge-title {
        color: #fff;
    }

    .knowledge-list {
        background: rgba(0, 0, 0, 0.2);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .knowledge-item {
        background: rgba(255, 255, 255, 0.05);
    }

    .file-name {
        color: #fff;
    }

    .file-meta {
        color: #999;
    }

    .action-button {
        color: #999;
    }

    .action-button:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    .action-button.delete:hover {
        background: rgba(255, 0, 0, 0.2);
        color: #ff4444;
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .knowledge-list {
        max-height: 250px;
    }

    .knowledge-item {
        padding: 10px;
    }

    .file-icon {
        width: 28px;
        height: 28px;
    }

    .file-details {
        font-size: 0.85rem;
    }

    .knowledge-actions {
        flex-direction: column;
        gap: 5px;
    }

    .action-button {
        width: 100%;
        justify-content: center;
    }
}

/* 角色知识库管理样式 */
.knowledge-section {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 15px !important;
    margin: 15px 0 !important;
    background: rgba(0, 0, 0, 0.1);
}

.role-knowledge-list {
    max-height: 300px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 10px;
    margin: 10px 0;
}

.role-knowledge-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.role-knowledge-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(3px);
}

.knowledge-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.knowledge-file-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 123, 255, 0.2);
    border-radius: 4px;
    color: #007bff;
}

.knowledge-file-details {
    flex: 1;
}

.knowledge-file-name {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.knowledge-file-size {
    color: #ccc;
    font-size: 0.75rem;
}

.knowledge-file-actions {
    display: flex;
    gap: 5px;
}

.knowledge-file-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.knowledge-file-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.knowledge-file-btn.edit:hover {
    color: #28a745;
}

.knowledge-file-btn.delete:hover {
    color: #dc3545;
}

.knowledge-action-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 统一知识库按钮高度和样式 */
.knowledge-action-btn {
    height: 36px;
    line-height: 20px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: top;
    box-sizing: border-box;
    font-size: 14px;
    font-weight: 500;
}

/* 上传按钮样式 */
.knowledge-action-btn[for="uploadKnowledgeFile"] {
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.knowledge-action-btn[for="uploadKnowledgeFile"]:hover {
    background: #138496 !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.knowledge-action-btn[for="uploadKnowledgeFile"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.knowledge-empty {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

/* 知识库文件编辑模态框样式 */
.knowledge-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.knowledge-editor-content {
    background: #2c3e50;
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 800px;
    max-height: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.knowledge-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.knowledge-editor-title {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.knowledge-editor-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.knowledge-editor-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.knowledge-editor-form {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.knowledge-editor-input {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.knowledge-editor-textarea {
    width: 100%;
    min-height: 300px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    margin-bottom: 15px;
}

.knowledge-editor-textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.knowledge-editor-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.knowledge-editor-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.knowledge-editor-btn.save {
    background: #28a745;
    color: white;
}

.knowledge-editor-btn.cancel {
    background: #6c757d;
    color: white;
}

.knowledge-editor-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .file-icon {
        width: 28px;
        height: 28px;
    }

    .file-name {
        font-size: 0.9rem;
    }

    .file-meta {
        font-size: 0.75rem;
    }

    .upload-knowledge {
        padding: 12px;
    }
}

/* 文件预览样式 */
.file-preview {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    animation: fadeIn 0.3s ease;
}

.preview-content {
    background: white;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

.preview-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.preview-header button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.preview-header button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.preview-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.preview-body pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #333;
}

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

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .preview-content {
        background: #1a1c2c;
    }

    .preview-header {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    .preview-header h3 {
        color: #fff;
    }

    .preview-header button {
        color: #999;
    }

    .preview-header button:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    .preview-body pre {
        color: #fff;
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .preview-content {
        width: 95%;
        max-height: 85vh;
    }

    .preview-header {
        padding: 12px 15px;
    }

    .preview-body {
        padding: 15px;
    }

    .preview-body pre {
        font-size: 0.85rem;
    }
}

/* 代码块样式 */
.code-block {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 10px;
    white-space: pre-wrap;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.code-block:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.code-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

/* 媒体内容样式 */
.media-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.media-images-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.media-image-item {
    position: relative;
}

.media-image-item img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 5px;
    cursor: pointer;
}

.media-videos-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.media-video-item {
    position: relative;
}

.media-video-item video {
    max-width: 300px;
    max-height: 200px;
    border-radius: 5px;
}

.media-audios-container {
    margin-top: 10px;
}

.media-audio-item {
    margin-bottom: 10px;
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .code-block {
        background: #2d2d2d;
        color: #f8f8f2;
    }
    
    .code-title,
    .media-title {
        color: #fff;
    }
}

/* 编辑器样式 */
.editor-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.save-button {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.save-button:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-1px);
}

.file-editor {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.file-editor:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .file-editor {
        background: rgba(30, 32, 42, 0.95);
        color: #fff;
        border-color: #444;
    }
    
    .file-editor:focus {
        border-color: var(--primary-color);
    }
}

/* 自定义角色设置样式 */
.custom-role-settings {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.setting-group {
    margin-bottom: 15px;
}

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

.setting-group input[type="text"],
.setting-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    transition: all 0.3s ease;
}

.setting-group textarea {
    resize: vertical;
    min-height: 100px;
}

.setting-group input[type="text"]:focus,
.setting-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(106, 17, 203, 0.1);
    outline: none;
}

.color-pickers {
    display: flex;
    gap: 10px;
}

.color-pickers input[type="color"] {
    width: 50px;
    height: 50px;
    padding: 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.save-custom-role {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-custom-role:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.role-card.custom img {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .custom-role-settings {
        background: rgba(0, 0, 0, 0.2);
    }

    .setting-group label {
        color: #fff;
    }

    .setting-group input[type="text"],
    .setting-group textarea {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
        color: #fff;
    }

    .setting-group input[type="text"]:focus,
    .setting-group textarea:focus {
        border-color: var(--primary-color);
    }


    .setting-group textarea:focus {
        border-color: var(--primary-color);
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .custom-role-settings {
        padding: 15px;
    }

    .setting-group input[type="text"],
    .setting-group textarea {
        font-size: 16px;
    }
}

.role-card.custom-saved {
    position: relative;
    --card-primary: #6a11cb;
    --card-secondary: #2575fc;
    background: linear-gradient(135deg, 
        var(--card-primary, #6a11cb) 0%, 
        var(--card-secondary, #2575fc) 100%
    );
}

.role-card.custom-saved.selected {
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--card-primary, #6a11cb);
}

.role-card.custom-saved span {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}



/* 语音按钮提示样式 */
.voice-button-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: normal;
    max-width: 140px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    margin-bottom: 8px;
    text-align: center;
    width: max-content;
}

.voice-button-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
}

.voice-button:hover .voice-button-tooltip {
    opacity: 1;
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .voice-button-tooltip {
        background: rgba(255, 255, 255, 0.9);
        color: #333;
    }

    .voice-button-tooltip::after {
        border-color: rgba(255, 255, 255, 0.9) transparent transparent transparent;
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .voice-button-tooltip {
        font-size: 11px;
        padding: 6px 10px;
        max-width: 110px;
    }
}

/* 打字指示器样式 */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    color: #666;
    font-style: italic;
}

.typing-indicator::after {
    content: '';
    width: 4px;
    height: 4px;
    background-color: #666;
    border-radius: 50%;
    margin-left: 5px;
    animation: typing-blink 1.4s infinite;
}

@keyframes typing-blink {
    0%, 44% {
        opacity: 1;
    }
    45%, 55% {
        opacity: 0.5;
    }
    56%, 100% {
        opacity: 1;
    }
}

/* 深色模式下的打字指示器 */
@media (prefers-color-scheme: dark) {
    .typing-indicator {
        color: #ccc;
    }
    
    .typing-indicator::after {
        background-color: #ccc;
    }
}

/* 消息操作按钮样式 */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    justify-content: flex-start;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-action-btn:hover {
    background: #f0f0f0;
    border-color: #bbb;
    color: #333;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.message-action-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-action-btn.success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.message-action-btn.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.message-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.copy-btn:hover {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1976d2;
}

.save-btn:hover {
    background: #e8f5e8;
    border-color: #4caf50;
    color: #2e7d32;
}

.speech-btn:hover {
    background: #fff3e0;
    border-color: #ff9800;
    color: #ef6c00;
}

.translate-btn:hover {
    background: #f3e5f5;
    border-color: #9c27b0;
    color: #7b1fa2;
}

/* 深色模式下的消息操作按钮 */
@media (prefers-color-scheme: dark) {
    .message-action-btn {
        background: rgba(0, 0, 0, 0.7);
        border-color: #555;
        color: #ccc;
    }
    
    .message-action-btn:hover {
        background: rgba(0, 0, 0, 0.8);
        border-color: #777;
        color: #fff;
    }
    
    .copy-btn:hover {
        background: rgba(33, 150, 243, 0.2);
        border-color: #2196f3;
        color: #64b5f6;
    }
    
    .save-btn:hover {
        background: rgba(76, 175, 80, 0.2);
        border-color: #4caf50;
        color: #81c784;
    }
    
    .speech-btn:hover {
        background: rgba(255, 152, 0, 0.2);
        border-color: #ff9800;
        color: #ffb74d;
    }
    
    .translate-btn:hover {
        background: rgba(156, 39, 176, 0.2);
        border-color: #9c27b0;
        color: #ba68c8;
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .message-actions {
        opacity: 1; /* 移动端始终显示按钮 */
    }
    
    .message-action-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* 模型设置样式 */
.model-settings {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.model-settings h3 {
    margin-bottom: 15px;
    color: #fff;
    font-size: 1.1em;
}

.model-selection {
    margin-bottom: 15px;
}

.model-selection select {
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    margin-top: 5px;
}

.api-settings {
    padding: 10px 0;
}

.api-settings .setting-group {
    margin-bottom: 12px;
}

.api-settings input {
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    margin-top: 5px;
}

.api-settings input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.test-api-button {
    width: 100%;
    padding: 8px;
    background: #4CAF50;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.test-api-button:hover {
    background: #45a049;
}

.api-settings input[readonly] {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    opacity: 0.7;
}

.api-settings input[readonly]:hover,
.api-settings input[readonly]:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.api-settings input[type="password"] {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.api-settings input[type="password"]:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.api-settings input[type="password"]:focus {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.test-api-button,
.apply-api-button,
.apply-model-button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.test-api-button {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.apply-api-button {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.apply-model-button {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    width: 100%;
}

.test-api-button:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.apply-api-button:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.apply-model-button:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.test-api-button:active,
.apply-api-button:active,
.apply-model-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.test-api-button:disabled,
.apply-api-button:disabled,
.apply-model-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 对话模式设置样式 */
.chat-mode-setting {
    margin: 30px 0;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.mode-card {
    padding: 15px;
    text-align: center;
    background-color: #f5f5f5;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s;
    border: 1px solid #ddd;
}

/* 对话模式链接样式 */
a.mode-card.mode-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

a.mode-card.mode-link:hover {
    text-decoration: none;
    color: inherit;
}

a.mode-card.mode-link:visited {
    color: inherit;
}

a.mode-card.mode-link:active {
    color: inherit;
}

a.mode-card.mode-link:focus {
    text-decoration: none;
    color: inherit;
    outline: none;
}

.mode-card:hover {
    background-color: #e0e0e0;
    transform: translateY(-5px);
}

.mode-card.selected {
    background-color: #5a9cff;
    color: white;
}

.mode-card i {
    font-size: 24px;
    margin-bottom: 10px;
    display: block;
    color: #1a73e8;
}

.mode-card span {
    font-size: 14px;
    color: #333;
}

/* 会议模式卡片的特殊样式 */
.mode-card[data-mode="meeting"] {
    background-color: #f0f8ff;
    border: 1px dashed #1a73e8;
}

.mode-card[data-mode="meeting"]:hover {
    background-color: #e0f0ff;
}

/* 清除浮动 */
.chat-messages::after {
    content: '';
    display: table;
    clear: both;
}

/* 确保消息容器可以正确显示浮动元素 */
.chat-messages {
    overflow-y: auto;
    padding: 20px;
}

.message-content p {
    text-indent: 2em;  /* 设置段落缩进为2个字符 */
    margin: 0.5em 0;   /* 设置段落间距 */
}

/* 声音选择下拉框样式 */
select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background-color: #ffffff;  /* 改为纯白色背景 */
    color: #333;  /* 深色文字 */
    width: 100%;
    max-width: 400px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23666"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

/* 为具有内联样式的下拉框强制显示下拉箭头 */
#modelSelect,
#customRoleVoice {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23666"><path d="M7 10l5 5 5-5z"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
    padding-right: 35px !important;
}

select:hover {
    border-color: #aaa;
    background-color: #f8f9fa;
}

/* 为具有内联样式的下拉框的hover状态也显示下拉箭头 */
#modelSelect:hover,
#customRoleVoice:hover {
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23666"><path d="M7 10l5 5 5-5z"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
}

select:focus {
    outline: none;
    border-color: #6a11cb;
    box-shadow: 0 0 0 2px rgba(106, 17, 203, 0.1);
    background-color: #ffffff;
}

/* 为具有内联样式的下拉框的focus状态也显示下拉箭头 */
#modelSelect:focus,
#customRoleVoice:focus {
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23666"><path d="M7 10l5 5 5-5z"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
}

/* 下拉选项的样式 */
select option {
    background-color: #ffffff;  /* 选项背景色 */
    color: #333;  /* 选项文字颜色 */
    padding: 8px;
}

select option:hover,
select option:focus,
select option:active,
select option:checked {
    background-color: #6a11cb;
    color: #ffffff;
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    select {
        background-color: #2c2c2c;
        color: #ffffff;
        border-color: #444;
    }

    select:hover {
        background-color: #3a3a3a;
        border-color: #555;
    }

    select:focus {
        background-color: #2c2c2c;
        border-color: #6a11cb;
    }

    select option {
        background-color: #2c2c2c;
        color: #ffffff;
    }

    select option:hover,
    select option:focus,
    select option:active,
    select option:checked {
        background-color: #6a11cb;
        color: #ffffff;
    }
}

/* 声音选择标签样式 */
.voice-select-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: #333;
}

@media (prefers-color-scheme: dark) {
    .voice-select-label {
        color: #ffffff;
    }
}

/* 停止生成按钮样式 */
.stop-generation-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    opacity: 0.9;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.stop-generation-btn:hover {
    background-color: #d32f2f;
    opacity: 1;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.2);
}

.stop-generation-btn:active {
    transform: scale(0.97);
}

.stop-generation-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* 移动端适配样式 */
@media (max-width: 768px) {
    /* 基本布局调整 */
    body {
        margin: 0;
        padding: 0;
        overflow: hidden;
        -webkit-tap-highlight-color: transparent;
    }
    
    .chat-container {
        flex-direction: column;
        max-width: 100%;
        width: 100%;
        height: 100vh;
        margin: 0;
        box-shadow: none;
        border-radius: 0;
    }
    
    /* 头像区域调整 */
    .avatar-container {
        position: relative;
        width: 100%;
        height: auto;
        padding: 20px 0;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .avatar-wrapper {
        width: 120px;
        height: 120px;
    }
    
    /* 聊天区域调整 */
    .chat-header {
        position: relative;
        width: 100%;
        padding: 10px;
        justify-content: space-between;
    }
    
    .chat-messages {
        max-height: calc(100vh - 180px);
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .chat-input {
        margin: 5px 10px 10px;
        padding: 5px 8px;
    }
    
    /* 录音按钮样式 */
    .voice-button {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* 设置面板调整 */
    .settings-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow: hidden;
    }
    
    .settings-panel.active {
        transform: translateX(0);
    }
    
    .settings-content {
        padding: 10px;
        height: calc(100vh - 90px); /* 与桌面版保持一致，提供更多空间 */
        overflow-y: auto;
    }
    

}



/* 横屏适配 */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-messages {
        max-height: calc(100vh - 100px);
    }
    
    .role-grid, .mode-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .history-button,
    .link-panel-button,
    .translate-toggle,
    .settings-button {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
}



/* 复制按钮样式 */
.copy-button {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.8) 100%);
    border: 1px solid rgba(106, 17, 203, 0.15);
    border-radius: 20px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6a11cb;
    font-size: 13px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(5px) scale(0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(106, 17, 203, 0.1);
}

.bot .message-content {
    position: relative;
}

.bot .message-content:hover .copy-button {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: subtlePulse 2s ease-in-out infinite;
}

@keyframes subtlePulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(106, 17, 203, 0.1);
    }
    50% {
        box-shadow: 0 2px 12px rgba(106, 17, 203, 0.2);
    }
}

.copy-button:hover {
    background: linear-gradient(135deg, rgba(106, 17, 203, 0.1) 0%, rgba(106, 17, 203, 0.15) 100%);
    border-color: rgba(106, 17, 203, 0.3);
    color: #6a11cb;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(106, 17, 203, 0.2);
}

.copy-button:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 6px rgba(106, 17, 203, 0.15);
}

.copy-button i {
    transition: transform 0.2s ease;
}

.copy-button:hover i {
    transform: scale(1.1);
}

/* 复制提示框样式 */
.copy-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.copy-toast.success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.95) 0%, rgba(32, 201, 151, 0.95) 100%);
}

.copy-toast.error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.95) 0%, rgba(253, 126, 20, 0.95) 100%);
}

.copy-toast i {
    font-size: 16px;
    animation: bounceIn 0.6s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .copy-button {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.1) 100%);
        border-color: rgba(255, 255, 255, 0.2);
        color: #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    .copy-button:hover {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.2) 100%);
        border-color: rgba(255, 255, 255, 0.35);
        color: #fff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .bot .message-content:hover .copy-button {
        animation: subtlePulseDark 2s ease-in-out infinite;
    }
}

@keyframes subtlePulseDark {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .copy-button {
        width: 36px;
        height: 36px;
        font-size: 15px;
        bottom: 8px;
        right: 8px;
        border-radius: 18px;
    }
    
    .copy-button:hover {
        transform: translateY(-1px) scale(1.03);
    }
    
    .copy-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        font-size: 13px;
        padding: 10px 16px;
    }
}

/* 链接展示样式 */
.link-display-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(106, 17, 203, 0.05) 0%, rgba(106, 17, 203, 0.08) 100%);
    border: 1px solid rgba(106, 17, 203, 0.1);
    border-radius: 8px;
    animation: fadeInUp 0.3s ease;
}

.link-title-badge {
    display: inline-block;
    background: linear-gradient(90deg, #6a11cb 0%, #2575fc 100%);
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 24px;
    border-radius: 32px;
    margin: 0;
    box-shadow: 0 2px 8px rgba(106, 17, 203, 0.10);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    outline: none;
    border: none;
    text-align: center;
    letter-spacing: 1px;
    user-select: text;
}

.link-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 6px;
    background: #f5f6fa;
    border: 1px solid #e0e0e0;
}

.link-item:last-child {
    margin-bottom: 0;
}

.link-item:hover {
    background: #e6e8f3;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(106, 17, 203, 0.10);
}

.link-text {
    flex: 1;
    font-size: 15px;
    color: #222;
    text-decoration: none;
    word-break: break-word;
    line-height: 1.4;
    font-weight: 500;
}

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

/* 深色模式下的链接展示样式 */
@media (prefers-color-scheme: dark) {
    .link-display-container {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.08) 100%);
        border-color: rgba(255, 255, 255, 0.15);
    }
    .link-item {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
    }
    .link-item:hover {
        background: rgba(255, 255, 255, 0.15);
    }
    .link-text {
        color: #fff;
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .link-display-container {
        margin-top: 6px;
        padding: 6px 10px;
    }
    .link-item {
        padding: 10px 12px;
        margin-bottom: 8px;
    }
    .link-text {
        font-size: 14px;
    }
}