* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans SC', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 95%;
    max-width: 1400px;
    height: 97vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: 250px;
    background: #f8f9fa;
    border-right: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eaeaea;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
    color: #333;
}

.new-session-btn {
    background: #667eea;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.new-session-btn:hover {
    background: #764ba2;
    transform: scale(1.05);
}

.new-session-btn:active {
    transform: scale(0.95);
}

.sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

#session-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.session-item {
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid transparent;
}

.session-item:hover {
    background: #f0f2f5;
}

.session-item.active {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.session-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.session-date {
    font-size: 0.75rem;
    color: #777;
    margin-top: 2px;
}

.session-prompt {
    font-size: 0.75rem;
    color: #666;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.session-item:hover .session-prompt {
    color: #333;
}

.session-item.active .session-prompt {
    color: #667eea;
}

.session-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    color: #777;
    opacity: 0;
    transition: all 0.2s ease;
}

.session-item:hover .session-delete-btn {
    opacity: 1;
}

.session-delete-btn:hover {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

/* 主聊天区域样式 */
.main-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    text-align: center;
}

.chat-header h1 {
    font-size: 1.5rem;
    font-weight: 500;
}

.chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
    position: relative;
    will-change: transform;
    contain: layout style paint;
    scroll-behavior: smooth;
}

.message {
    border-radius: 16px;
    line-height: 1.4;
    position: relative;
    animation: fadeIn 0.3s ease;
    font-size: 0.95rem;
    width: auto;
    max-width: 85%;
    display: block;
    transform: translateZ(0); /* 强制硬件加速 */
    backface-visibility: hidden; /* 提高渲染性能 */
    -webkit-font-smoothing: antialiased; /* 文字渲染优化 */
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    margin-bottom: 0; /* 防止外边距塌陷 */
    will-change: transform, opacity; /* 优化变换性能 */
    box-sizing: border-box; /* 确保尺寸计算包含内边距 */
    transition: transform 0.15s ease-out, opacity 0.15s ease-out, height 0.15s ease-out;
}

.avatar {
    display: none; /* 隐藏头像 */
}

.message-content {
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 0.8;
    width: 100%;
    box-sizing: border-box;
    padding-right: 10px;
    padding-left: 10px;
    /* 添加渲染优化 */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: contents; /* 优化内容变化 */
    min-height: 22px; /* 设置最小高度防止闪烁 */
}

/* .message-content > *:first-child {
    margin-top: 0;
}

.message-content > *:last-child {
    margin-bottom: 0;
} */

.message-content p:first-of-type {
    margin-top: 0;
}

.message-content p:last-of-type {
    margin-bottom: 0;
}

.message-content p {
    margin: 0.05em 0;
    line-height: 1.6;
}

.message-content ul,
.message-content ol {
    margin: 0.05em 0;
    padding-left: 1.2em;
    line-height: 0.6;
}

.message-content li {
    margin: 0.05em 0;
    line-height: 1.6;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 0.6em 0 0.3em;
    line-height: 1.0;
}

.message-content h1 { font-size: 1.8em; }
.message-content h2 { font-size: 1.5em; }
.message-content h3 { font-size: 1.3em; }
.message-content h4 { font-size: 1.2em; }
.message-content h5 { font-size: 1.1em; }
.message-content h6 { font-size: 1em; }

.message-content blockquote {
    margin: 0.05em 0;
    padding: 0.05em 0.3em;
    border-left: 4px solid #667eea;
    background: rgba(102, 126, 234, 0.1);
    color: #666;
}

.message-content blockquote p {
    margin: 0;
}

.message-content code:not(pre code) {
    padding: 0.05em 0.2em;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
}

.message-content pre {
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}

.message-content a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.message-content a:hover {
    border-bottom-color: #667eea;
}

.message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.3em 0;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.3em 0;
}

.message-content th,
.message-content td {
    padding: 0.3em;
    border: 1px solid #ddd;
    text-align: left;
}

.message-content th {
    background: #f5f5f5;
    font-weight: 500;
}

.message-content tr:nth-child(even) {
    background: #f9f9f9;
}

.message-content hr {
    margin: 0.5em 0;
    border: none;
    border-top: 1px solid #bbb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-message {
    align-self: flex-end;
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
    position: relative;
    padding: 12px 20px 12px 20px;
    margin-left: auto; /* 强制右对齐 */
    margin-right: 0;
    transform: translateZ(0); /* 确保在自己的图层上渲染 */
    transition: transform 0.1s ease; /* 添加微小的过渡效果 */
}

.user-message .copy-button {
    display: none;
}

.user-message .resend-button {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    z-index: 10;
}

.user-message:hover .resend-button {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.resend-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.resend-button svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    transition: fill 0.3s ease;
}

/* 重新发送按钮的提示文本 */
.resend-button::after {
    content: '重新发送';
    position: absolute;
    top: -25px;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.resend-button:hover::after {
    opacity: 1;
}

.ai-message {
    align-self: flex-start;
    background: #f0f2f5;
    color: #333;
    border-bottom-left-radius: 4px;
    position: relative;
    padding: 12px 20px 12px 20px;
    margin-right: auto; /* 强制左对齐 */
    margin-left: 0;
    transform: translateZ(0); /* 确保在自己的图层上渲染 */
    transition: transform 0.1s ease; /* 添加微小的过渡效果 */
}

/* 使加载状态的AI消息背景透明 */
.ai-message.loading {
    background: transparent;
    padding: 6px 10px;
    margin-bottom: -20px;
    min-height: 40px; /* 添加最小高度预占位 */
    transform: translateZ(0); /* 确保在GPU层渲染 */
}

/* 加载消息内容容器的特殊样式 */
.ai-message.loading .message-content {
    padding: 0; /* 覆盖默认的内边距 */
}

/* 加载点容器的特殊样式 */
.ai-message.loading .loading-dots {
    margin: 8px auto; /* 上下外边距8px，左右自动居中 */
}

.chat-input-container {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    border: none;
    background: #f0f2f5;
    border-radius: 20px;
    padding: 12px 16px;
    resize: none;
    outline: none;
    font-size: 1rem;
    max-height: 120px;
    transition: all 0.3s ease;
}

#user-input:focus {
    box-shadow: 0 0 0 2px #667eea;
}

#send-button {
    background: #667eea;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

#send-button:hover {
    background: #764ba2;
    transform: scale(1.05);
}

#send-button:active {
    transform: scale(0.95);
}

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

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* 加载动画样式 */
.loading-dots {
    display: flex;
    gap: 4px;
    background: transparent;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: loading 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loading {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 禁用状态样式 */
#send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

#send-button:disabled:hover {
    background: #ccc;
    transform: none;
}

/* 设置按钮样式 */
.settings-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

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

.settings-button svg {
    width: 24px;
    height: 24px;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
    /* 设置更高品质的渲染 */
    backface-visibility: hidden;
}

/* 模态框显示状态 */
.modal.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-content {
    position: relative;
    background: white;
    margin: 2% auto;   /* 将原来的10%改为2%，使模态框离顶部更近 */
    padding: 20px;
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translate3d(0, -20px, 0);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    /* 添加文本渲染优化 */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    backface-visibility: hidden;
}

.modal.show .modal-content {
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

/* 模态框内文本元素样式优化 */
.modal-content h2,
.modal-content label,
.modal-content input,
.modal-content textarea,
.modal-content button,
.modal-content select,
.modal-content option {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
    /* 添加文本渲染优化 */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.close-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 5px;
    line-height: 1;
}

.close-button:hover {
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #333;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.modal-footer {
    text-align: right;
    margin-top: 20px;
}

.save-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    /* 添加文本渲染优化 */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.save-button:hover {
    background: #764ba2;
}

/* 密码输入框容器样式 */
.password-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-container input {
    padding-right: 40px;
    width: 100%;
}

/* 密码可见性切换按钮样式 */
.toggle-password {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #333;
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

/* 模型选择容器样式 */
.model-select-container {
    position: relative;
    display: flex;
    align-items: center;
}

.model-select {
    flex: 1;
    padding: 10px;
    padding-right: 70px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.model-select:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.model-select:hover {
    border-color: #667eea;
}

/* 下拉选项样式 */
.model-select option {
    padding: 10px;
    font-size: 1rem;
}

.model-select optgroup {
    font-weight: 500;
    color: #666;
    padding: 5px 0;
}

.model-select optgroup option {
    font-weight: normal;
    color: #333;
    padding-left: 20px;
}

.refresh-button {
    position: absolute;
    right: 50px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.3s ease;
    z-index: 1;
    border-radius: 50%;
}

.refresh-button:hover {
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.1);
}

.refresh-button svg {
    width: 16px;
    height: 16px;
}

/* 加载动画 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.refresh-button.loading {
    animation: spin 1s linear infinite;
}

/* 系统提示词容器样式 */
.system-prompt-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.system-prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #f8f9fa;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #ddd;
}

.system-prompt-header span {
    color: #666;
    font-size: 0.85rem;
}

.toggle-prompt {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.toggle-prompt:hover {
    color: #333;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.system-prompt-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.system-prompt-content.expanded {
    max-height: 300px;
}

#system-prompt {
    width: 100%;
    padding: 12px;
    border: none;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    line-height: 1.5;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
    cursor: default;
    font-size: 0.9rem;
}

#system-prompt:focus {
    outline: none;
    box-shadow: none;
}

/* 头部按钮容器 */
.header-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* 清空按钮样式 */
.clear-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

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

.prompt-button svg {
    width: 24px;
    height: 24px;
}

.clear-button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* 代码块样式改进 */
.code-block {
    position: relative;
    margin: 0.5em 0;
    background: #1e1e1e;
    border-radius: 6px;
    overflow: hidden;
    z-index: 1;
    border: 1px solid #333;
    width: 100%;
    box-sizing: border-box;
}

.code-language {
    position: absolute;
    top: 0;
    right: 0;
    padding: 2px 8px;
    font-size: 0.8em;
    color: #ccc;
    background: #2d2d2d;
    border-bottom-left-radius: 4px;
    opacity: 0.8;
}

.code-block .copy-button {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #aaa;
    transition: all 0.3s ease;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    z-index: 10;
}

.code-block:hover .copy-button {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.code-block .copy-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.code-block pre {
    margin: 0;
    padding: 12px;
    overflow-x: auto;
    background: transparent;
    color: #e0e0e0;
    width: 100%;
    box-sizing: border-box;
}

.code-block code {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    line-height: 1.4;
    padding: 0 !important;
    background: transparent !important;
    color: #e0e0e0;
    white-space: pre;
}

.code-block .copy-button svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* 确保代码不会被格式化损坏 */
.message-content pre code {
    white-space: pre;
    word-break: normal;
    word-wrap: normal;
    overflow-wrap: normal;
}

/* 代码块滚动条样式 */
.code-block pre::-webkit-scrollbar {
    height: 6px;
}

.code-block pre::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.code-block pre::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.code-block pre::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* 调整代码块内的段落间距 */
.message-content pre {
    margin: 0.5em 0;
}

/* 确保消息内的所有内容都不会超出 */
.message-content > * {
    max-width: 100%;
    box-sizing: border-box;
}

/* 代码高亮样式覆盖 */
.hljs {
    white-space: pre;
    word-break: normal;
    word-wrap: normal;
}

/* 确保滚动正常显示 */
.message-content .code-block {
    max-width: 100%;
    overflow-x: auto;
}

/* 基础复制按钮样式 - 通用部分 */
.copy-button,
.message-copy-button {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    z-index: 10;
}

/* 不同类型复制按钮的特定样式 */
.ai-message .copy-button {
    color: #666;
}

.code-block .copy-button {
    color: #aaa;
}

.message-copy-button {
    color: #666;
}

/* 悬停效果 */
.message:hover .copy-button,
.message:hover .message-copy-button {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

.code-block:hover .copy-button {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.copy-button:hover,
.message-copy-button:hover {
    background: rgba(0, 0, 0, 0.1);
}

.code-block .copy-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* SVG图标样式 */
.copy-button svg,
.message-copy-button svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    transition: fill 0.3s ease;
}

/* 复制成功/失败状态样式 */
.copy-button.copied svg,
.code-block .copy-button.copied svg,
.message-copy-button.copied svg {
    fill: #4CAF50 !important;
}

.copy-button.error svg,
.code-block .copy-button.error svg,
.message-copy-button.error svg {
    fill: #f44336 !important;
}

/* 提示文本样式 */
.copy-button::after,
.code-block .copy-button::after,
.message-copy-button::after {
    content: '复制';
    position: absolute;
    top: -25px;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.copy-button:hover::after,
.code-block .copy-button:hover::after,
.message-copy-button:hover::after {
    opacity: 1;
}

.copy-button.copied::after,
.code-block .copy-button.copied::after,
.message-copy-button.copied::after {
    content: '已复制';
    opacity: 1;
    background: rgba(76, 175, 80, 0.8);
}

.copy-button.error::after,
.code-block .copy-button.error::after,
.message-copy-button.error::after {
    content: '复制失败';
    opacity: 1;
    background: rgba(244, 67, 54, 0.8);
}

/* 响应式设计，适配移动设备 */
@media screen and (max-width: 768px) {
    .chat-container {
        flex-direction: column;
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid #eaeaea;
    }
    
    .main-chat-area {
        height: 60vh;
    }
}

/* 设置模态框中的标签页 */
.tab-container {
    width: 100%;
}

.tab-header {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 8px 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
    position: relative;
    transition: all 0.3s ease;
    /* 添加文本渲染优化 */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    font-weight: 500;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #667eea;
}

.tab-content {
    position: relative;
    min-height: 300px; /* 设置最小高度，避免布局抖动 */
}

.tab-pane {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    backface-visibility: hidden;
    /* 添加文本渲染优化 */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.tab-pane.active {
    position: relative;
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

/* 标签页内的表单元素渲染优化 */
.tab-pane input,
.tab-pane select,
.tab-pane textarea,
.tab-pane button,
.tab-pane label {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    backface-visibility: hidden;
}

/* 提示词管理样式 */
.saved-prompts-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 8px;
    margin-bottom: 15px;
}

.prompt-item {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 8px;
    border: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.prompt-item:hover {
    background-color: #f8f9fa;
}

.prompt-item.active {
    background-color: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
}

.prompt-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.prompt-name {
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.prompt-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    margin-bottom: 5px;
}

.prompt-edit-container {
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 15px;
}

.prompt-edit-container label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 0.9rem;
}

.prompt-edit-container input[type="text"],
.prompt-edit-container textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.prompt-edit-container textarea {
    resize: vertical;
    min-height: 100px;
}

.action-button {
    background-color: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    margin-top: 0;
}

.action-button:hover {
    background-color: #764ba2;
}

.prompt-button-group {
    display: flex;
    gap: 8px;
}

.edit-prompt-btn, 
.delete-prompt-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.edit-prompt-btn {
    color: #667eea;
}

.edit-prompt-btn:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.delete-prompt-btn {
    color: #f44336;
}

.delete-prompt-btn:hover {
    background-color: rgba(244, 67, 54, 0.1);
}

.default-badge {
    font-size: 0.7rem;
    padding: 2px 5px;
    background-color: #667eea;
    color: white;
    border-radius: 3px;
    margin-left: 5px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    height: 100%;
}

.checkbox-container input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    margin: 0;
}

.checkbox-container label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
    line-height: 1;
}

/* 新会话模态框样式 */
.new-session-modal .form-group {
    margin-bottom: 15px;
}

.new-session-modal label {
    display: block;
    margin-bottom: 8px;
}

.prompt-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.url-history-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.url-history-item {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.url-history-item:hover {
    background-color: var(--primary-color);
    color: white;
}

.url-history-item .delete-btn {
    margin-left: 0.5rem;
    color: var(--text-color);
    opacity: 0.5;
    cursor: pointer;
}

.url-history-item:hover .delete-btn {
    color: white;
    opacity: 1;
}

.prompt-preview {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

/* 滑块容器样式 */
.slider-container {
    width: 100%;
    margin: 10px 0;
}

/* 滑块样式 */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.slider:hover {
    opacity: 1;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: all 0.2s;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: all 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    background: #764ba2;
    transform: scale(1.1);
}

.slider::-moz-range-thumb:hover {
    background: #764ba2;
    transform: scale(1.1);
}

/* 滑块描述文本样式 */
.slider-description {
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
    line-height: 1.4;
}

/* 滑块值显示样式 */
#temperature-value, #top-p-value {
    font-weight: 500;
    color: #667eea;
    margin-left: 5px;
}

/* 问号图标样式 */
.question-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 16px;
    height: 16px;
    background-color: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    margin-left: 6px;
    cursor: help;
    position: relative;
    font-weight: bold;
}

/* Tooltip 样式 */
.question-icon[data-tooltip] {
    position: relative;
}

.question-icon[data-tooltip]::before,
.question-icon[data-tooltip]::after {
    position: absolute;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: all 0.15s ease;
    z-index: 999;
}

/* 提示内容 */
.question-icon[data-tooltip]::before {
    content: attr(data-tooltip);
    padding: 10px;
    width: 200px;
    border-radius: 6px;
    background-color: rgba(17, 17, 17, 0.9);
    color: #fff;
    text-align: center;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.4;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* 提示箭头 */
.question-icon[data-tooltip]::after {
    content: '';
    border-width: 5px;
    border-style: solid;
    border-color: rgba(17, 17, 17, 0.9) transparent transparent transparent;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
}

/* 悬停时显示提示 */
.question-icon[data-tooltip]:hover::before,
.question-icon[data-tooltip]:hover::after {
    visibility: visible;
    opacity: 1;
} 