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

/* 通用图标样式：用于内联 SVG */
.icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: middle;
    stroke: currentColor;
}

/* 将全局暗色主题限定到聊天页，避免影响登录/注册/管理页 */
body.chat-body {
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #121212;
    height: 100vh;
    overflow: hidden;
    color: #E0E0E0;
}

/* 背景动效：柔和渐变与数据流线 */
.app-container::before {
    content: "";
    position: fixed;
    inset: -10% -10% -10% -10%;
    background:
      radial-gradient(1200px 600px at 15% 10%, rgba(255, 111, 60, 0.12) 0%, transparent 60%),
      radial-gradient(900px 600px at 85% 90%, rgba(74, 144, 226, 0.18) 0%, transparent 60%);
    filter: blur(60px);
    opacity: 0.8;
    animation: drift 16s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

.app-container::after {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(120deg, rgba(74, 144, 226, 0.06) 0 2px, transparent 2px 8px);
    transform: translateX(0);
    animation: flow 24s linear infinite;
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

.sidebar, .main-content { position: relative; z-index: 1; }

@keyframes drift {
    0% { transform: translate3d(-10px, -10px, 0) scale(1); }
    50% { transform: translate3d(10px, 8px, 0) scale(1.02); }
    100% { transform: translate3d(-6px, 4px, 0) scale(1.01); }
}

@keyframes flow {
    0% { transform: translateX(0); }
    100% { transform: translateX(-240px); }
}

/* 主应用容器 - 三栏布局 */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* 左侧边栏 - 对话历史 */
.sidebar {
    width: 260px;
    background: #0D0D0D;
    color: #E0E0E0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #4d4d4f;
}

.new-chat-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(74,144,226,0.18), rgba(28,63,149,0.16));
    border: 1px solid rgba(74,144,226,0.28);
    color: #e9f2ff;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    background: linear-gradient(135deg, rgba(74,144,226,0.32), rgba(28,63,149,0.26));
    border-color: rgba(74,144,226,0.38);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(74,144,226,0.18);
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conversation-item {
    padding: 12px 16px;
    margin: 2px 0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #ececf1;
}

.conversation-item:hover {
    background: #40414f;
}

.conversation-item.active {
    background: #40414f;
    color: white;
}

.conversation-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.conversation-item:hover .conversation-actions {
    opacity: 1;
}

.delete-conversation-btn {
    background: none;
    border: none;
    color: #8e8ea0;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.delete-conversation-btn:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
}

/* 头部 */
.header {
    background: rgba(18,18,18,0.55);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    position: relative; /* 形成更高的堆叠上下文 */
    z-index: 3; /* 高于 .main-content (z-index:1)，保证面板与遮罩在其上方 */
}

.header::after {
    content: "";
    position: absolute;
    left: -20%;
    top: 0;
    height: 100%;
    width: 20%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    animation: scan 8s linear infinite;
    pointer-events: none;
}

@keyframes scan {
    0% { transform: translateX(0); }
    100% { transform: translateX(600%); }
}

.header h1 {
    color: #FFFFFF;
    font-family: 'Montserrat', 'Roboto', sans-serif;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header h1 .icon {
    color: #4A90E2;
}

/* 品牌Logo样式 */
.logo-img {
    height: 28px;
    width: 28px;
    object-fit: contain;
}

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

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative; /* 避免换行导致位置变化，并用于定位浮层 */
}

.model-selector label {
    font-size: 14px;
    color: #b9b9c3;
    font-weight: 500;
}

.model-select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 6px 20px rgba(0,0,0,0.35);
    width: 200px; /* 缩小整体占位，避免显得过大 */
    cursor: pointer;
}

.model-selector select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 10px 36px 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-size: 14px;
    width: 100%;
    color: #E0E0E0;
    pointer-events: none; /* 屏蔽原生下拉交互，仅用于程序更新值 */
}

.model-select-wrapper:hover {
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12), 0 8px 24px rgba(0,0,0,0.45);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

.model-select-wrapper:focus-within {
    border-color: rgba(74,144,226,0.6);
    box-shadow: 0 0 0 2px rgba(74,144,226,0.18), inset 0 0 12px rgba(74,144,226,0.08);
}

.model-select-wrapper::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(255,255,255,0.7);
    border-bottom: 2px solid rgba(255,255,255,0.7);
    opacity: 0.9;
    pointer-events: none;
}

.model-select-indicator { display: none; }

.model-meta {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    display: flex;
    align-items: baseline;
    gap: 10px;
    width: 340px; /* 缩小简介条的宽度 */
    pointer-events: none; /* 不影响交互 */
    z-index: 5;
}

.model-name {
    padding: 4px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(74,144,226,0.25), rgba(28,63,149,0.25));
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    border: 1px solid rgba(74,144,226,0.35);
    box-shadow: 0 6px 16px rgba(0,0,0,0.35), inset 0 0 8px rgba(255,255,255,0.08);
}

.model-desc {
    font-size: 12px;
    color: #b9b9c3;
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 简介淡入淡出动画 */
.model-desc.fade-in {
    animation: modelDescFadeIn 0.26s ease both;
}
.model-desc.fade-out {
    animation: modelDescFadeOut 0.16s ease both;
}
@keyframes modelDescFadeIn {
    from { opacity: 0; transform: translateY(2px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes modelDescFadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-2px); }
}

/* 高级模型选择浮层面板样式 */
.model-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: min(420px, 42vw); /* 缩窄面板宽度 */
    background: rgba(16,16,20,0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 18px 40px rgba(0,0,0,0.55);
    border-radius: 14px;
    z-index: 20;
    overflow: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* 面板淡入淡出与可交互性 */
.hidden { opacity: 0; visibility: hidden; transform: translateY(6px); pointer-events: none; }
.model-panel:not(.hidden) { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }

/* 全局遮罩，面板打开时挡住下方内容 */
.panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.48);
    backdrop-filter: blur(6px) brightness(0.88) contrast(0.98) saturate(0.95);
    -webkit-backdrop-filter: blur(6px) brightness(0.88) contrast(0.98) saturate(0.95);
    z-index: 19; /* 位于面板下、其他内容上 */
    transition: opacity 0.22s ease;
}
.panel-backdrop.soft {
    background: rgba(0,0,0,0.42);
    backdrop-filter: blur(5px) brightness(0.9) contrast(0.98);
    -webkit-backdrop-filter: blur(5px) brightness(0.9) contrast(0.98);
}
.panel-backdrop.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.panel-backdrop:not(.hidden) { opacity: 1; visibility: visible; pointer-events: auto; }

/* 面板开启时禁用页面滚动，避免底层视觉与交互干扰 */
body.modal-open { overflow: hidden; }

.panel-header {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-title {
    font-size: 13px;
    color: #b9b9c3;
    letter-spacing: 0.2px;
}

.model-list {
    display: grid;
    grid-template-columns: 1fr;
    max-height: 260px; /* 缩短面板高度 */
    overflow-y: auto;
}

.model-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 12px; /* 缩小卡片内边距 */
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.model-item:last-child { border-bottom: none; }

.model-item:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,0.04);
}

.model-badge {
    flex-shrink: 0;
    width: 22px; /* 缩小徽标尺寸 */
    height: 22px;
    border-radius: 6px;
    background: linear-gradient(135deg, #4A90E2, #1C3F95);
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

.model-info { flex: 1; }
.model-info .name {
    font-size: 13px; /* 缩小文字尺寸 */
    color: #ffffff;
    font-weight: 600;
}
.model-info .desc {
    margin-top: 1px;
    font-size: 11px;
    color: #b9b9c3;
}

.model-check {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    display: inline-block;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}
.model-item.selected .model-check {
    border-color: #10a37f;
    background: #10a37f;
}

.history-count {
    background: rgba(255,255,255,0.06);
    color: #b9b9c3;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.08);
}

.stream-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d9d9e3;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #10a37f;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 14px;
    color: #6e6e80;
    font-weight: 500;
}

.clear-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #ff5252;
}

.clear-btn:disabled {
    background: #d9d9e3;
    color: #8e8ea0;
    cursor: not-allowed;
}

.refresh-btn {
    background: linear-gradient(135deg, #4A90E2, #1C3F95);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.refresh-btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.refresh-btn:disabled {
    background: #d9d9e3;
    color: #8e8ea0;
    cursor: not-allowed;
}

/* 聊天容器 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: linear-gradient(180deg, rgba(20,20,24,0.95), rgba(18,18,22,1));
}

.welcome-message {
    text-align: center;
    color: #b0b0be;
    padding: 60px 20px;
}

.welcome-message .icon {
    width: 48px;
    height: 48px;
    color: #4A90E2;
    margin-bottom: 16px;
}

.welcome-message h3 {
    margin-bottom: 8px;
    color: #FFFFFF;
    font-size: 20px;
    font-family: 'Montserrat', 'Roboto', sans-serif;
}

.welcome-message p {
    font-size: 16px;
}

.message {
    margin-bottom: 24px;
    display: flex;
    gap: 16px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.message.user {
    flex-direction: row-reverse;
}

/* 让用户消息的气泡与助手消息的左边界对齐（头像宽32 + 间距16 = 48） */
.message.user .message-content {
    margin-left: 48px;
}

/* 让助手消息的气泡在右侧也留出与头像对称的空间，保证双方气泡宽度一致 */
.message.assistant .message-content {
    margin-right: 48px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #4A90E2, #1C3F95);
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #ff9ef5, #ab68ff);
}

.message-content {
    flex: 1;
    padding: 16px;
    border-radius: 12px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap; /* 保留换行与空白，避免文本“连在一起” */
    font-size: 15px;
}

/* 基础的段落与列表间距，提升可读性 */
.message-content p,
.message-content ul,
.message-content ol,
.message-content pre,
.message-content blockquote {
    margin: 0.5em 0;
}

.message.assistant .message-content ul {
    list-style: none; /* 隐藏圆点 */
    padding-left: 0; /* 取消默认缩进 */
    margin-left: 0;
}

.message.assistant .message-content ul li::marker {
    content: ""; /* 移除浏览器默认列表标记 */
}

.message.assistant .message-content ul li {
    padding-left: 0; /* 行内不再显示项目符号 */
}

/* 有序列表：隐藏数字标记与缩进，保持段落式排版 */
.message.assistant .message-content ol {
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}
.message.assistant .message-content ol li::marker {
    content: "";
}
.message.assistant .message-content ol li {
    padding-left: 0;
}

.message-content pre {
    overflow: auto;
}

/* 流式内容闪光与流动感 */
.message.assistant .message-content.streaming {
    position: relative;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
    overflow: hidden;
}

.message.assistant .message-content.streaming::after {
    content: "";
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    animation: shine 2.4s linear infinite;
}

@keyframes shine {
    0% { left: -40%; }
    100% { left: 140%; }
}

/* 消息淡入出现效果 */
.message.fade-in { animation: messageEnter 0.22s ease-out both; }
@keyframes messageEnter {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user .message-content {
    background: rgba(255,255,255,0.03);
    color: #E0E0E0;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}

.message.assistant .message-content {
    background: rgba(255,255,255,0.03);
    color: #E0E0E0;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}

/* 消息内操作按钮区域 */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.message-actions .action-btn {
    padding: 6px 10px;
    font-size: 12px;
    color: #E0E0E0;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    cursor: pointer;
}

.message-actions .action-btn:hover {
    background: rgba(255,255,255,0.12);
}

/* 输入区域 */
.input-container {
    background: rgba(18,18,18,0.6);
    backdrop-filter: blur(6px);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 24px;
}

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

.input-wrapper textarea {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    resize: none;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    background: #0D0D0D;
    color: #E0E0E0;
    max-height: 120px;
    min-height: 52px;
}

.input-wrapper textarea:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.15);
}

/* 输入框聚焦动画边框 */
.input-wrapper:focus-within {
    position: relative;
}
.input-wrapper:focus-within::after {
    content: "";
    position: absolute;
    left: -8px;
    right: -8px;
    bottom: -8px;
    height: 2px;
    background: linear-gradient(90deg, rgba(74,144,226,0), rgba(74,144,226,0.5), rgba(74,144,226,0));
    animation: scan 6s linear infinite;
}

.send-btn {
    background: linear-gradient(135deg, #4A90E2, #1C3F95);
    color: white;
    border: none;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

.send-btn:hover:not(:disabled) {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

/* 状态指示动画 */
.status-indicator.status-loading {
    border: 1px solid rgba(74,144,226,0.3);
    box-shadow: inset 0 0 12px rgba(74,144,226,0.2);
}
.status-indicator.status-loading .status-text {
    background-image: linear-gradient(90deg, rgba(255,255,255,0.35) 0, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0.35) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.send-btn:disabled {
    background: #d9d9e3;
    color: #8e8ea0;
    cursor: not-allowed;
}

.input-footer {
    max-width: 800px;
    margin: 8px auto 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #8e8ea0;
}

.char-count {
    font-weight: 500;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-text {
    font-weight: 500;
}

/* 打字指示器 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8e8ea0;
    font-style: italic;
    font-size: 14px;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #8e8ea0;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

/* 滚动条样式 */
.conversations-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.conversations-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.conversations-list::-webkit-scrollbar-thumb {
    background: #4d4d4f;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #d9d9e3;
    border-radius: 3px;
}

.conversations-list::-webkit-scrollbar-thumb:hover {
    background: #6e6e80;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #c1c1c1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }
    
    .header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .controls {
        flex-direction: column;
        gap: 12px;
    }
    
    .input-container {
        padding: 16px;
    }
    
    .chat-messages {
        padding: 16px;
    }
}

@media (max-width: 640px) {
    .sidebar {
        position: fixed;
        left: -260px;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        width: 100%;
    }
}
.code-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 0 0 6px 0;
}

.copy-code-btn {
    padding: 4px 8px;
    font-size: 12px;
    color: #E0E0E0;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    cursor: pointer;
}

.copy-code-btn:hover {
    background: rgba(255,255,255,0.12);
}
/* ========================
   UI Revamp Overrides · Blue-Purple Tech Style
   These overrides adjust visuals without changing functionality.
   ======================== */

/* 品牌文字蓝紫渐变 */
.brand-gradient {
    background: linear-gradient(90deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* 背景光晕与放射线条（蓝紫配色） */
.app-container::before {
    content: "";
    position: fixed;
    inset: -10% -10% -10% -10%;
    background:
      radial-gradient(1200px 600px at 18% 12%, rgba(99, 102, 241, 0.26) 0%, transparent 60%),
      radial-gradient(1000px 700px at 82% 88%, rgba(168, 85, 247, 0.22) 0%, transparent 60%);
    filter: blur(40px);
    opacity: 0.85;
    animation: drift 16s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

.app-container::after {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-conic-gradient(
      from 0deg at 50% 50%,
      rgba(99,102,241,0.08) 0deg 6deg,
      transparent 6deg 14deg
    );
    transform: translateX(0);
    animation: flow 28s linear infinite;
    opacity: 0.22;
    pointer-events: none;
    z-index: 0;
}

/* 模型选择器：圆角与边框交互 */
.model-select-wrapper {
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 12px; /* rounded-lg */
}
.model-select-wrapper:hover {
    border-color: rgba(99,102,241,0.5);
}
.model-select-wrapper:focus-within {
    border-color: rgba(99,102,241,0.6);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.18), inset 0 0 12px rgba(99,102,241,0.08);
}
/* 模型简介条位置微调：略微上移，保持在分隔线之上（仍在选择器下方） */
.model-meta {
    top: calc(100% + 1px);
}

/* 流式输出：自定义滑块样式 */
.slider {
    background-color: #2b2b38; /* 深灰轨道 */
}
.slider:before {
    background: linear-gradient(135deg, #6366f1, #a855f7); /* 蓝紫滑块 */
}
input:checked + .slider {
    background-color: #3b3b47; /* 开启时轨道略提亮 */
}
input:checked + .slider:before {
    background: linear-gradient(135deg, #4f46e5, #7c3aed); /* 开启后的蓝紫更深 */
}

/* 清除对话：文字按钮 */
.clear-btn {
    background: transparent;
    color: #d1d5db; /* text-gray-300 */
    border: none;
    padding: 8px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.2s ease;
}
.clear-btn:hover { color: #ffffff; }
.clear-btn:disabled { color: #8e8ea0; cursor: not-allowed; }

/* 新对话按钮：蓝紫渐变与放大 */
.new-chat-btn {
    background: linear-gradient(135deg, rgba(99,102,241,0.28), rgba(168,85,247,0.26));
    border: 1px solid rgba(99,102,241,0.38);
    color: #eef2ff;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.new-chat-btn:hover {
    filter: brightness(1.05);
    transform: scale(1.05);
    box-shadow: 0 10px 24px rgba(99,102,241,0.22);
}

/* 对话项：选中左侧蓝紫栏，未选中深灰背景 */
.conversation-item { background: rgba(255,255,255,0.02); }
.conversation-item:hover { background: rgba(38,38,46,0.6); }
.conversation-item.active {
    background: rgba(38,38,46,0.8);
    border-left: 4px solid #6366f1;
}

/* 输入区与按钮：圆角与渐变 */
.input-wrapper textarea {
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 16px; /* rounded-xl */
}
.input-wrapper textarea:focus {
    border-color: rgba(99,102,241,0.6);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.18);
}
.send-btn {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-radius: 9999px; /* 圆形按钮 */
    box-shadow: 0 10px 24px rgba(99,102,241,0.25);
}
.send-btn:hover:not(:disabled) {
    filter: brightness(1.04);
}

/* 气泡：用户蓝紫、AI深灰，均白字 */
.message.user .message-content {
    background: #4f46e5; /* indigo-600 */
    color: #ffffff;
    border: none;
    box-shadow: 0 10px 28px rgba(79,70,229,0.35);
}
.message.assistant .message-content {
    background: #1f2937; /* gray-800 */
    color: #e5e7eb;
}

/* 附件条目样式 */
.attachments-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attachment-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid rgba(229,231,235,0.18); border-radius: 8px; background: rgba(255,255,255,0.06); }
.attachment-icon .icon { color: #9ca3af; }
.attachment-name { font-size: 12px; color: #e5e7eb; }
.attachment-delete { background: transparent; border: none; cursor: pointer; color: #9ca3af; }
.attachment-delete:hover { color: #ef4444; }