/* 系统通知样式 */
.system-notification {
    display: flex !important;
    justify-content: center;
    margin: 16px 0 !important;
    animation: slideInDown 0.3s ease-out;
}

.notification-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    max-width: 500px;
    min-width: 200px;
    position: relative;
}

.notification-toast.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.9), rgba(5, 150, 105, 0.9));
    color: white;
    border-color: rgba(16, 185, 129, 0.3);
}

.notification-toast.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9), rgba(220, 38, 38, 0.9));
    color: white;
    border-color: rgba(239, 68, 68, 0.3);
}

.notification-toast.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(217, 119, 6, 0.9));
    color: white;
    border-color: rgba(245, 158, 11, 0.3);
}

.notification-toast.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(37, 99, 235, 0.9));
    color: white;
    border-color: rgba(59, 130, 246, 0.3);
}

.notification-icon {
    font-size: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.notification-content {
    flex: 1;
    line-height: 1.4;
}

.notification-close {
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    padding: 0 4px;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.2);
}

/* 通知动画 */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 夜间模式下的通知样式调整 */
[data-theme="dark"] .notification-toast {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .notification-toast.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.8), rgba(5, 150, 105, 0.8));
}

[data-theme="dark"] .notification-toast.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.8), rgba(220, 38, 38, 0.8));
}

[data-theme="dark"] .notification-toast.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.8), rgba(217, 119, 6, 0.8));
}

[data-theme="dark"] .notification-toast.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.8), rgba(37, 99, 235, 0.8));
}

/* 思考指示器样式 */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    margin: 8px 0;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.3s ease-out;
}

.thinking-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.thinking-dots .dot {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: thinkingPulse 1.4s infinite ease-in-out;
}

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

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

.thinking-dots .dot:nth-child(3) {
    animation-delay: 0s;
}

.thinking-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
}

/* 思考指示器动画 */
@keyframes thinkingPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* 夜间模式下的思考指示器 */
[data-theme="dark"] .thinking-indicator {
    background: rgba(75, 85, 99, 0.5);
    border-color: rgba(107, 114, 128, 0.3);
}

[data-theme="dark"] .thinking-dots .dot {
    background: #60a5fa;
}

[data-theme="dark"] .thinking-text {
    color: #9ca3af;
}

/* 思考过程样式 */
.think-container {
    margin: 12px 0;
}

.think-details {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-tertiary);
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.think-summary {
    padding: 6px 12px;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.think-summary::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.2s ease;
}

.think-details[open] .think-summary::after {
    transform: rotate(-90deg);
}

.think-summary:hover {
    background-color: var(--hover-color);
    border-radius: 8px 8px 0 0;
}

.think-details[open] .think-summary {
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
}

.think-content {
    padding: 8px 12px;
    line-height: 1.5;
    word-break: break-word;
    font-family: 'Courier New', monospace;
    color: var(--text-secondary);
}

.think-content p {
    margin: 0 0 6px 0;
}

.think-content p:last-child {
    margin-bottom: 0;
}

/* CSS变量定义 */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f8fc;
    --bg-tertiary: #eef1f7;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --border-color: #d1d9e6;
    --accent-color: #2563eb;
    --hover-color: #e2e8f0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    --success-color: #059669;
    --warning-color: #d97706;
    --error-color: #dc2626;
    --info-color: #0284c7;
}

/* 夜间模式变量 */
[data-theme="dark"] {
    --bg-primary: #1f2937;
    --bg-secondary: #374151;
    --bg-tertiary: #4b5563;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border-color: #4b5563;
    --accent-color: #60a5fa;
    --hover-color: #4b5563;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* 全局滚动条隐藏 */
* {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

*::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
    border-right: none;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 260px; /* 保持最小宽度以防止内容挤压 */
}

.sidebar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.new-chat-btn, .sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.new-chat-btn:hover, .sidebar-toggle-btn:hover {
    background-color: var(--hover-color);
    color: var(--text-primary);
}

.sidebar-toggle-btn i {
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

/* 展开侧边栏按钮 */
.sidebar-expand-btn {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: none;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-width: 36px;
    margin-right: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sidebar-expand-btn:hover {
    background: var(--hover-color);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.sidebar.collapsed + .main-content .sidebar-expand-btn {
    display: flex;
}

/* 主内容区域调整 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    transition: all 0.3s ease;
    position: relative;
}

.chat-history {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 4px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    position: relative;
}

.chat-item:hover {
    background-color: var(--hover-color);
    color: var(--text-primary);
}

.chat-item.active {
    background-color: var(--hover-color);
    color: var(--text-primary);
}

.chat-item i {
    margin-right: 12px;
    font-size: 14px;
}

.chat-item span {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-actions {
    display: none;
    gap: 4px;
    margin-left: auto;
}

.chat-item:hover .chat-actions {
    display: flex;
}

.chat-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 12px;
}

.chat-actions button:hover {
    color: var(--text-primary);
    background-color: var(--hover-color);
}

.chat-item.active .chat-actions button {
    color: var(--text-primary);
}

.chat-item.active .chat-actions button:hover {
    background-color: var(--border-color);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.clearall {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.clearall:hover {
    background-color: var(--hover-color);
    color: var(--text-primary);
}

.avatar {
    width: 32px;
    height: 32px;
    background-color: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    transition: background-color 0.3s ease;
}

/* 聊天头部 */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* 右上角功能按钮区域 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto; /* 自动推到右侧 */
}

.header-actions .action-btn {
    width: 44px !important;
    height: 44px !important;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px !important;
    box-shadow: var(--shadow);
}

.header-actions .action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--accent-color);
}

.header-actions .action-btn.active {
    background: var(--accent-color);
    color: white;
}

/* 主题切换特殊样式 */
.theme-toggle.dark-mode {
    background: var(--bg-secondary);
    color: var(--accent-color);
}

/* 角色选择模态框 */
.role-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.role-modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: background-color 0.3s ease;
}

.role-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.role-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.role-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.role-close-btn:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.role-search {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.role-search:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.role-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.role-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
    border: 1px solid transparent;
    position: relative; /* 添加相对定位，为绝对定位的按钮提供参考 */
}

.role-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.role-item.selected {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.role-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 18px;
}

.role-info {
    flex: 1;
}

.role-name {
    font-weight: 500;
    margin-bottom: 4px;
    color: inherit;
}

.role-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.role-item.selected .role-description {
    color: rgba(255, 255, 255, 0.8);
}

.role-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* 桌面端：确认和取消按钮的容器 */
.role-action-buttons {
    display: flex;
    gap: 12px;
}

.role-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.role-btn-add {
    background: #10b981;
    color: white;
    margin-right: auto;
}

.role-btn-add:hover {
    background: #059669;
}

.role-btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.role-btn-cancel:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.role-btn-confirm {
    background: var(--accent-color);
    color: white;
}

.role-btn-confirm:hover {
    background: var(--hover-color);
}

.role-btn-confirm:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.theme-toggle.dark-mode:hover {
    background: var(--hover-color);
}

/* 添加角色表单样式 */
.add-role-form {
    padding: 10px 0;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 40px;
    font-family: inherit;
}

.form-group textarea[rows="4"] {
    min-height: 80px;
}

/* 自定义角色标识 */
.role-item.custom-role {
    border-left: 3px solid #10b981;
}

.role-item.custom-role .role-name::after {
    content: '自定义';
    font-size: 11px;
    background-color: #10b981;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
}

/* 自定义角色操作按钮容器 */
.role-item.custom-role .action-buttons {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.role-item.custom-role:hover .action-buttons {
    opacity: 1;
}

/* 编辑角色按钮 */
.edit-role-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.edit-role-btn:hover {
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
}

/* 删除角色按钮 */
.delete-role-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.delete-role-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* 模型选择器 */
.model-selector {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 改为左对齐，不居中 */
    gap: 12px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.model-dropdown {
    position: relative;
    display: inline-block;
    min-width: 180px; /* 减小最小宽度 */
    max-width: 250px; /* 减小最大宽度 */
    flex-shrink: 0; /* 防止收缩 */
}

.model-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    color: var(--text-primary);
}

.model-btn:hover {
    border-color: var(--text-secondary);
}

.model-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 1000;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.model-options.show {
    display: block;
}

.model-option {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    color: var(--text-primary);
}

.model-option:hover {
    background-color: var(--bg-tertiary);
}

.model-option.active {
    background-color: var(--accent-color);
    color: white;
}

/* 聊天容器 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 12px;
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease;
}

.messages {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 24px;
}

.message {
    display: flex;
    margin-bottom: 32px;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    animation: fadeInUp 0.4s ease-out;
}

.message.user {
    flex-direction: row-reverse;
    justify-content: flex-start; /* 改为flex-start，让用户消息靠右但宽度自适应 */
    margin-left: auto; /* 添加左边距自动，让整个消息容器靠右 */
    margin-bottom: 48px; /* 增加底部边距，为操作按钮留出空间 */
    width: fit-content; /* 宽度适应内容 */
    max-width: 100%; /* 最大宽度不超过容器 */
}

.message.assistant {
    flex-direction: row;
    align-items: flex-start;
    margin-bottom: 48px; /* 增加底部边距，为操作按钮留出空间 */
    width: fit-content;
    max-width: 100%;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--border-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--accent-color), #4f46e5);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.message-content {
    flex: 0 1 auto; /* 改为自适应宽度，不占满剩余空间 */
    max-width: 100%; /* 设置最大宽度，避免过长消息占满整行 */
    min-width: 70%; /* 设置最小宽度，避免过短消息太窄 */
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    background: var(--bg-secondary);
    padding: 20px 24px;
    border-radius: 16px;
    font-size: 15px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    position: relative;
}

.message.user .message-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
    margin-right: 12px;
    margin-left: 0;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

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

.message.assistant .message-content::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 20px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 12px solid var(--bg-secondary);
    filter: drop-shadow(-2px 0 4px rgba(0, 0, 0, 0.15));
}

.message.user .message-content::before {
    content: '';
    position: absolute;
    right: -12px;
    top: 20px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 12px solid var(--bg-secondary);
    filter: drop-shadow(2px 0 4px rgba(0, 0, 0, 0.15));
}

/* 悬停效果 */
.message-content:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.message.user .message-content:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

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

/* Markdown内容样式 */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    color: var(--text-primary);
}

.message-content h1 { font-size: 1.5em; }
.message-content h2 { font-size: 1.3em; }
.message-content h3 { font-size: 1.1em; }

.message-content p {
    margin: 8px 0;
    color: var(--text-primary);
}

.message-content ul,
.message-content ol {
    margin: 8px 0;
    padding-left: 20px;
    color: var(--text-primary);
}

.message-content li {
    margin: 4px 0;
}

.message-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding: 8px 16px;
    margin: 16px 0;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    font-style: italic;
}

.message-content code {
    background-color: var(--bg-tertiary);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9em;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.message-content pre {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
    position: relative;
    border: 1px solid var(--border-color);
}

.message-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 0.9em;
    line-height: 1.5;
}

/* 代码块复制按钮 */
.code-block-wrapper {
    position: relative;
}

.code-buttons {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.code-block-wrapper:hover .code-buttons {
    opacity: 1;
}

.copy-btn, .preview-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.copy-btn {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
}

.copy-btn:hover {
    background-color: var(--accent-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.preview-btn {
    background: rgba(34, 139, 34, 0.1);
    color: rgba(34, 139, 34, 0.9);
}

.preview-btn:hover {
    background: rgba(34, 139, 34, 1);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(34, 139, 34, 0.3);
}

/* 数学公式样式 */
.katex {
    font-size: 1.1em;
    color: var(--text-primary);
}

.katex-display {
    margin: 16px 0;
    text-align: center;
}

/* 流式传输动画 */
.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background-color: var(--accent-color);
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 消息渲染防闪烁 */
.message.rendering {
    opacity: 0.8;
}

.message.rendered {
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

/* 消息操作按钮 */
.message {
    position: relative;
}

.message-actions {
    position: absolute;
    top: -8px;
    right: -8px;
    display: flex;
    gap: 4px;
    opacity: 1;
    z-index: 10;
}

.message.user .message-actions {
    top: auto;
    bottom: -32px;
    right: 8px;
    left: auto;
}

.message.assistant .message-actions {
    top: auto;
    bottom: -32px;
    right: 8px;
    left: auto;
}

.action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    background-color: var(--accent-color);
    color: white;
    transform: scale(1.1);
}

/* 回复时长显示 */
.response-time {
    position: absolute;
    bottom: -20px;
    right: 0;
    font-size: 11px;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 1;
}

.message.user .response-time {
    left: 8px;
    right: auto;
    bottom: -20px;
}

.message.assistant .response-time {
    bottom: -20px;
    right: 8px;
    left: auto;
}

/* 代码块按钮增强样式已在上方统一定义 */

/* HTML预览模态框 */
.html-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.html-preview-modal .modal-content {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    max-height: 800px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.html-preview-modal .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.html-preview-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.html-preview-modal .close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.html-preview-modal .close-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.html-preview-modal .modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

.html-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* 输入区域 */
.input-container {
    padding: 24px;
    margin-top: 20px; /* 增加上边距 */
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    position: relative;
}

.input-wrapper {
    max-width: 2000px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

#messageInput {
    flex: 1;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    min-height: 48px;
    max-height: 120px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#messageInput:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.send-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 12px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.send-btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.send-btn:disabled {
    background-color: var(--text-secondary);
    cursor: not-allowed;
}

.send-btn.stop-mode {
    background-color: #ef4444;
    animation: pulse 2s infinite;
}

.send-btn.stop-mode:hover {
    background-color: #dc2626;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* @角色选择下拉菜单 */
.role-mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 24px;
    right: 24px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-bottom: 8px;
    display: none;
    animation: slideUp 0.2s ease-out;
}

.role-mention-dropdown.show {
    display: block;
}

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

.role-mention-list {
    padding: 8px 0;
}

.role-mention-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.role-mention-item:hover,
.role-mention-item.selected {
    background-color: var(--hover-color);
}

.role-mention-item.selected {
    background-color: rgba(37, 99, 235, 0.1);
}

.role-mention-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-right: 12px;
    flex-shrink: 0;
}

.role-mention-info {
    flex: 1;
    min-width: 0;
}

.role-mention-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.role-mention-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 夜间模式下的@角色选择下拉菜单 */
[data-theme="dark"] .role-mention-dropdown {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .role-mention-item:hover,
[data-theme="dark"] .role-mention-item.selected {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .role-mention-item.selected {
    background-color: rgba(37, 99, 235, 0.2);
}

/* 平板端适配 */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {
    .sidebar {
        width: 260px;
    }
    
    .sidebar.collapsed {
        width: 60px;
    }
    
    .main-content {
        width: calc(100% - 260px);
    }
    
    .sidebar.collapsed + .main-content {
        width: calc(100% - 60px);
    }
    
    .messages {
        padding: 0 12px;
    }
    
    .message-content {
        padding: 14px 18px;
        font-size: 14px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    .sidebar {
        width: 300px;
    }
    
    .sidebar.collapsed {
        width: 60px;
    }
    
    .main-content {
        width: calc(100% - 300px);
    }
    
    .sidebar.collapsed + .main-content {
        width: calc(100% - 60px);
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .sidebar.collapsed {
        width: 60px;
    }
    
    .main-content {
        width: calc(100% - 280px);
    }
    
    .sidebar.collapsed + .main-content {
        width: calc(100% - 60px);
    }
    
    .messages {
        padding: 0 16px;
    }
    
    .message {
        margin-bottom: 24px;
        gap: 10px;
    }
    
    .message-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .message-content {
        padding: 16px 20px;
        font-size: 14px;
        border-radius: 14px;
    }
    
    .input-container {
        padding: 16px 20px;
    }
    
    .input-wrapper {
        max-width: 100%;
        margin: 0 10px;
    }
    
    .role-modal-content {
        width: 85%;
        max-width: 600px;
    }
    
    .settings-modal .modal-content {
        width: 85%;
        max-width: 600px;
    }
    
    .custom-modal .modal-content {
        width: 85%;
        max-width: 600px;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: 100vh;
        position: absolute;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s;
        top: 0;
        left: 0;
    }
    
    .sidebar-header {
        min-width: unset;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
        width: 100%;
    }
    
    .main-content {
        width: 100%;
    }
    
    .sidebar-expand-btn {
        display: flex !important;
    }
    
    .sidebar.collapsed + .main-content .sidebar-expand-btn {
        display: flex !important;
    }
    
    /* 移动端角色模态框优化 */
    .role-modal-content {
        width: 95%;
        max-width: none;
        max-height: 90vh;
        margin: 20px;
        padding: 16px;
        border-radius: 8px;
    }
    
    .role-modal-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .role-modal-title {
        font-size: 18px;
    }
    
    .role-search {
        padding: 10px 12px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .role-list {
        max-height: 300px;
    }
    
    .role-item {
        padding: 10px;
        margin-bottom: 6px;
    }
    
    .role-avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
        margin-right: 10px;
    }
    
    .role-name {
        font-size: 14px;
    }
    
    .role-description {
        font-size: 11px;
    }
    
    .role-modal-footer {
        margin-top: 16px;
        padding-top: 12px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .role-btn {
        padding: 10px 16px;
        font-size: 14px;
        min-width: 80px;
    }
    
    .role-btn-add {
        width: 100%;
        margin-right: 0;
        margin-bottom: 4px;
        order: 1;
    }
    
    /* 创建确认和取消按钮的容器 */
    .role-action-buttons {
        display: flex;
        gap: 8px;
        order: 2;
    }
    
    .role-btn-confirm,
    .role-btn-cancel {
        flex: 1;
    }
    
    /* 移动端添加/编辑角色表单优化 */
    .add-role-form .form-group {
        margin-bottom: 16px;
    }
    
    .add-role-form label {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .add-role-form input,
    .add-role-form textarea {
        padding: 10px 12px;
        font-size: 16px; /* 防止iOS缩放 */
        border-radius: 6px;
    }
    
    .add-role-form textarea {
        min-height: 80px;
    }
    
    /* 移动端设置模态框优化 */
    .settings-modal .modal-content {
        width: 95%;
        max-width: none;
        margin: 20px;
        max-height: 90vh;
    }
    
    .settings-modal .modal-header {
        padding: 16px;
    }
    
    .settings-modal .modal-header h3 {
        font-size: 18px;
    }
    
    .settings-modal .modal-body {
        padding: 16px;
    }
    
    .settings-modal .setting-item {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .settings-modal .setting-label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .settings-modal .setting-value {
        font-size: 12px;
        min-width: 35px;
    }
    
    .settings-modal .modal-footer {
        padding: 16px;
        gap: 8px;
    }
    
    .settings-modal .btn-secondary,
    .settings-modal .btn-primary {
        padding: 10px 16px;
        font-size: 14px;
        flex: 1;
    }
    
    /* 移动端自定义对话框优化 */
    .custom-modal .modal-content {
        width: 95%;
        max-width: none;
        margin: 20px;
    }
    
    .custom-modal .modal-header {
        padding: 16px;
    }
    
    .custom-modal .modal-header h3 {
        font-size: 18px;
    }
    
    .custom-modal .modal-body {
        padding: 16px;
    }
    
    .custom-modal .modal-body p {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .custom-modal .input-field {
        padding: 10px 12px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .custom-modal .modal-footer {
        padding: 16px;
        gap: 8px;
    }
    
    .custom-modal .btn-secondary,
    .custom-modal .btn-primary {
        padding: 10px 16px;
        font-size: 14px;
        flex: 1;
    }
    
    /* 移动端头部操作按钮优化 */
    .header-actions {
        gap: 6px;
    }
    
    .header-actions .action-btn {
        width: 40px !important;
        height: 40px !important;
        font-size: 14px !important;
    }
    
    /* 移动端模型选择器优化 */
    .model-selector {
        padding: 8px 12px;
        gap: 8px;
    }
    
    .model-dropdown {
        flex: 1;
        min-width: 0;
    }
    
    .model-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .model-btn span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .sidebar-expand-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
        margin-right: 8px;
    }
    
    /* 移动端消息布局优化 */
    .messages {
        padding: 0 12px; /* 减少左右内边距 */
    }
    
    .message {
        margin-bottom: 20px; /* 减少消息间距 */
        gap: 8px; /* 减少头像和内容间距 */
    }
    
    .message.user {
        margin-left: 0; /* 移除左边距自动 */
        width: 100%; /* 占满容器宽度 */
        max-width: 100%;
    }
    
    .message-avatar {
        width: 32px; /* 减小头像尺寸 */
        height: 32px;
        font-size: 14px;
        flex-shrink: 0;
    }
    
    .message-content {
        flex: 1; /* 占满剩余空间 */
        max-width: calc(100% - 40px); /* 减去头像宽度和间距 */
        min-width: 0; /* 允许收缩 */
        padding: 14px 16px; /* 减少内边距 */
        font-size: 14px; /* 减小字体 */
        border-radius: 12px; /* 减小圆角 */
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    .message.user .message-content {
        margin-right: 0; /* 移除右边距 */
        margin-left: 0;
    }
    
    /* 移动端消息气泡箭头调整 */
    .message.assistant .message-content::before {
        left: -8px; /* 调整箭头位置 */
        border-right-width: 8px;
        border-top-width: 6px;
        border-bottom-width: 6px;
    }
    
    .message.user .message-content::before {
        right: -8px; /* 调整箭头位置 */
        border-left-width: 8px;
        border-top-width: 6px;
        border-bottom-width: 6px;
    }
    
    /* 移动端消息操作按钮优化 */
    .message-actions {
        gap: 4px; /* 减少按钮间距 */
    }
    
    .message-actions .action-btn {
        width: 32px; /* 减小按钮尺寸 */
        height: 32px;
        font-size: 12px;
    }
    
    /* 移动端代码块优化 */
    .message-content pre {
        padding: 12px; /* 减少代码块内边距 */
        font-size: 12px; /* 减小代码字体 */
        border-radius: 6px;
        overflow-x: auto;
        margin: 12px 0;
    }
    
    .message-content code {
        font-size: 12px; /* 减小行内代码字体 */
        padding: 1px 4px;
    }
    
    /* 移动端思考过程优化 */
    .thinking-process {
        margin: 6px 0 8px 0;
        padding: 10px 12px;
        font-size: 12px;
        border-radius: 8px;
    }
    
    .thinking-header {
        padding: 8px 12px;
    }
    
    .thinking-title {
        font-size: 11px;
    }
    
    .thinking-toggle {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
    
    /* 移动端输入区域优化 */
    .input-container {
        padding: 8px 12px; /* 减少输入区域内边距 */
    }
    
    .input-wrapper {
        gap: 8px; /* 减少输入框和发送按钮间距 */
    }
    
    #messageInput {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 12px 16px;
    }
    
    .send-btn {
        width: 44px; /* 调整发送按钮尺寸 */
        height: 44px;
        font-size: 16px;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

/* 优化的思考过程样式 */
.thinking-process {
    margin: 8px 0 12px 0;
    padding: 14px 18px;
    background: linear-gradient(145deg, rgba(34, 139, 34, 0.08), rgba(34, 139, 34, 0.04));
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    word-break: break-word;
    border: 1px solid rgba(34, 139, 34, 0.15);
    box-shadow: 0 2px 8px rgba(34, 139, 34, 0.12);
    position: relative;
    backdrop-filter: blur(5px);
    width: 100%; /* 确保思考过程占满消息内容的宽度 */
    box-sizing: border-box; /* 包含padding和border在内的宽度计算 */
    overflow: hidden;
    transition: all 0.3s ease;
}

/* 思考过程头部 */
.thinking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    background: rgba(34, 139, 34, 0.05);
    border-bottom: 1px solid rgba(34, 139, 34, 0.15);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.thinking-header:hover {
    background: rgba(34, 139, 34, 0.12);
}

.thinking-title {
    font-weight: 500;
    color: rgba(34, 139, 34, 0.95);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.thinking-title::before {
    font-size: 14px;
}

/* 折叠按钮 */
.thinking-toggle {
    background: none;
    border: none;
    color: rgba(34, 139, 34, 0.8);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.thinking-toggle:hover {
    background: rgba(34, 139, 34, 0.15);
    color: rgba(34, 139, 34, 1);
}

.thinking-toggle::before {
    content: '▼';
    transition: transform 0.3s ease;
}

.thinking-process.collapsed .thinking-toggle::before {
    transform: rotate(-90deg);
}

/* 思考过程内容 */
.thinking-content {
    padding: 14px 18px;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.thinking-process.collapsed .thinking-content {
    max-height: 0;
    padding: 0 18px;
    opacity: 0;
}

/* 思考过程状态指示器 */
.thinking-status {
    position: absolute;
    top: 12px;
    right: 50px;
    font-size: 10px;
    color: rgba(34, 139, 34, 0.7);
    font-weight: 500;
}

.thinking-status.thinking {
    animation: pulse 1.5s infinite;
}

.thinking-status.completed {
    color: rgba(34, 139, 34, 0.9);
}

.thinking-process::before {
    position: absolute;
    top: -8px;
    left: 16px;
    background: var(--bg-primary);
    padding: 0 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* 夜间模式下的思考过程样式 */
[data-theme="dark"] .thinking-process {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.03));
    border-color: rgba(16, 185, 129, 0.15);
    color: var(--text-secondary);
}

[data-theme="dark"] .thinking-header {
    background: rgba(16, 185, 129, 0.05);
    border-bottom-color: rgba(16, 185, 129, 0.15);
    border-radius: 12px;
}

[data-theme="dark"] .thinking-header:hover {
    background: rgba(16, 185, 129, 0.12);
}

[data-theme="dark"] .thinking-title {
    color: rgba(16, 185, 129, 1);
}

[data-theme="dark"] .thinking-toggle {
    color: rgba(16, 185, 129, 0.8);
}

[data-theme="dark"] .thinking-toggle:hover {
    background: rgba(16, 185, 129, 0.15);
    color: rgba(16, 185, 129, 1);
}

[data-theme="dark"] .thinking-status {
    color: rgba(16, 185, 129, 0.7);
}

[data-theme="dark"] .thinking-status.completed {
    color: rgba(16, 185, 129, 0.9);
}

/* 自定义模态框样式 */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.custom-modal .modal-content {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.custom-modal[style*="opacity: 1"] .modal-content {
    transform: scale(1);
}

.custom-modal .modal-header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.custom-modal .modal-header .notification-icon {
    font-size: 20px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
}

.custom-modal .modal-body {
    padding: 24px;
}

.custom-modal .modal-body p {
    margin: 0 0 16px 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
}

.custom-modal .input-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.custom-modal .input-field:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.custom-modal .modal-footer {
    padding: 16px 24px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.custom-modal .btn-primary,
.custom-modal .btn-secondary {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-width: 80px;
}

.custom-modal .btn-primary {
    background: var(--accent-color);
    color: white;
}

.custom-modal .btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.custom-modal .btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.custom-modal .btn-secondary:hover {
    background: var(--hover-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 确认对话框特殊样式 */
.custom-modal .confirm-dialog .modal-header .notification-icon {
    background: rgba(245, 158, 11, 0.1);
}

/* 输入对话框特殊样式 */
.custom-modal .input-dialog .modal-header .notification-icon {
    background: rgba(16, 185, 129, 0.1);
}

/* 警告对话框特殊样式 */
.custom-modal .alert-dialog .modal-header .notification-icon {
    background: rgba(239, 68, 68, 0.1);
}

/* 夜间模式下的模态框样式 */
[data-theme="dark"] .custom-modal {
    background-color: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .custom-modal .modal-content {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .custom-modal .input-field {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .custom-modal .btn-primary:hover {
    background: #1d4ed8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .custom-modal .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .custom-modal .modal-header,
    .custom-modal .modal-body,
    .custom-modal .modal-footer {
        padding: 16px;
    }
    
    .custom-modal .modal-footer {
        flex-direction: column;
    }
    
    .custom-modal .btn-primary,
    .custom-modal .btn-secondary {
        width: 100%;
    }
}

/* 编辑角色模态框样式 - 复用添加角色模态框的样式 */
#editRoleModal {
    /* 继承 .custom-modal 的所有样式 */
}

/* Toast 通知系统样式 */
.notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    align-items: center;
}

.toast-notification {
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-100%) scale(0.8);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast-notification.hide {
    opacity: 0;
    transform: translateY(-100%) scale(0.8);
    transition: all 0.3s ease-in;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 300px;
    max-width: 450px;
    position: relative;
    overflow: hidden;
}

.toast-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.6;
}

.toast-content.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.95));
    color: white;
    border-color: rgba(16, 185, 129, 0.3);
}

.toast-content.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
    color: white;
    border-color: rgba(239, 68, 68, 0.3);
}

.toast-content.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(217, 119, 6, 0.95));
    color: white;
    border-color: rgba(245, 158, 11, 0.3);
}

.toast-content.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(37, 99, 235, 0.95));
    color: white;
    border-color: rgba(59, 130, 246, 0.3);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.toast-message {
    flex: 1;
    line-height: 1.5;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    opacity: 0.7;
    transition: all 0.2s ease;
    padding: 4px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* 夜间模式下的toast样式调整 */
[data-theme="dark"] .toast-content {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .toast-content.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.9), rgba(5, 150, 105, 0.9));
}

[data-theme="dark"] .toast-content.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9), rgba(220, 38, 38, 0.9));
}

[data-theme="dark"] .toast-content.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(217, 119, 6, 0.9));
}

[data-theme="dark"] .toast-content.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(37, 99, 235, 0.9));
}

/* 移动端响应式设计 */
@media (max-width: 768px) {
    .notification-container {
        top: 10px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        align-items: center;
        width: calc(100% - 20px);
        max-width: 400px;
    }
    
    .toast-content {
        min-width: 280px;
        max-width: 380px;
        width: auto;
        padding: 12px 16px;
        font-size: 13px;
        border-radius: 10px;
    }
    
    .toast-icon {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }
    
    .toast-message {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .toast-close {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }
    
    .toast-notification {
        transform: translateY(-100%) scale(0.9);
    }
    
    .toast-notification.show {
        transform: translateY(0) scale(1);
    }
    
    .toast-notification.hide {
        transform: translateY(-100%) scale(0.9);
    }
}