/**
 * AI 助手页面样式 — 主题适配版
 * 火山方舟 Chat API 对话界面
 */

/* ===== 页面容器 ===== */
.ai-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 54px - 80px);
    grid-template-columns: 1fr !important;
    gap: 0 !important;
}

.ai-container .sidebar { display: none !important; }

/* ===== 页面标题 ===== */
.ai-page-header {
    text-align: center;
    margin-bottom: 1.2rem;
    animation: ai-fade-down 0.5s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

.ai-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 50%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 0.35rem;
    letter-spacing: -0.01em;
}

.ai-page-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* ===== 对话区域主卡片 ===== */
.ai-chat-wrapper {
    width: 100%;
    max-width: 960px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
    animation: ai-card-in 0.6s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes ai-card-in {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== 工具栏（嵌入卡片顶部的分组栏） ===== */
.ai-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.25rem;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    flex-wrap: wrap;
}

/* 模型选择器 */
.ai-model-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 0.3rem 2rem 0.3rem 0.75rem;
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.55rem center;
    min-width: 0;
    max-width: 200px;
}

.ai-model-select:hover {
    border-color: var(--primary-color);
}
.ai-model-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* 深度思考开关 */
.ai-thinking-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    background: transparent;
    white-space: nowrap;
    flex-shrink: 0;
}
.ai-thinking-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.ai-thinking-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 28px;
    height: 16px;
    background: var(--border-dark);
    border-radius: 16px;
    position: relative;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}
.ai-thinking-toggle input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.ai-thinking-toggle input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
}
.ai-thinking-toggle input[type="checkbox"]:checked::after {
    transform: translateX(12px);
}

/* 清空按钮 */
.ai-clear-btn {
    padding: 0.28rem 0.65rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}
.ai-clear-btn svg { width: 13px; height: 13px; opacity: 0.65; }

.ai-clear-btn:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}
.ai-clear-btn:hover svg { opacity: 1; }

/* Token 标签 + 数值 */
.ai-token-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.ai-token-count {
    font-size: 0.72rem;
    color: var(--primary-color);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    min-width: 2.5em;
    text-align: right;
    flex-shrink: 0;
}

/* Spacer 推到右边 */
.ai-toolbar-group::after {
    content: '';
    flex: 1;
}

/* ===== 消息列表 ===== */
.ai-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.25rem 1.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background-image:
        radial-gradient(circle at 20% 30%, var(--primary-light) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(168,85,247,0.03) 0%, transparent 50%);
}

/* 细腻滚动条 */
.ai-messages::-webkit-scrollbar { width: 5px; }
.ai-messages::-webkit-scrollbar-track { background: transparent; }
.ai-messages::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 10px;
    transition: background 0.2s;
}
.ai-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== 欢迎页面 ===== */
.ai-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.5rem 1rem 2rem;
    flex: 1;
    position: relative;
}

/* 欢迎页背景装饰光晕 */
.ai-welcome::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
    pointer-events: none;
    animation: ai-glow-pulse 4s ease-in-out infinite;
}

@keyframes ai-glow-pulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50%       { opacity: 1;   transform: translate(-50%, -50%) scale(1.08); }
}

.ai-welcome-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.1rem;
    position: relative;
    z-index: 1;
    overflow: hidden;
    background: none;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.18);
    animation: ai-welcome-float 3s ease-in-out infinite;
}

@keyframes ai-welcome-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

.ai-welcome-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-xl);
}

.ai-welcome-brand {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    opacity: 0.85;
    position: relative;
    z-index: 1;
}

.ai-welcome h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin: 0 0 0.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    position: relative;
    z-index: 1;
}

.ai-welcome p {
    color: var(--text-secondary);
    font-size: 0.87rem;
    margin: 0 0 1.5rem;
    max-width: 380px;
    line-height: 1.65;
    position: relative;
    z-index: 1;
}

/* ===== 快捷提问按钮 ===== */
.ai-quick-prompts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.55rem;
    width: 100%;
    max-width: 520px;
    position: relative;
    z-index: 1;
}

.ai-quick-prompt-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.22s ease;
    white-space: nowrap;
    min-width: 0;
}

.ai-quick-prompt-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-quick-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: var(--primary-color);
    transition: stroke 0.2s ease, transform 0.2s ease;
}

.ai-quick-prompt-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.ai-quick-prompt-btn:hover .ai-quick-icon {
    stroke: var(--primary-hover);
    transform: scale(1.1);
}
.ai-quick-prompt-btn:active {
    transform: translateY(0) scale(0.98);
}

/* ===== 消息气泡 ===== */
.ai-message {
    display: flex;
    gap: 0.6rem;
    max-width: 82%;
    animation: ai-msg-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes ai-msg-in {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* 头像 */
.ai-message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color) 0%, #a78bfa 100%);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.ai-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

/* 用户头像 */
.ai-message-user .ai-message-avatar {
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-sm);
}
.ai-message-user .ai-message-avatar svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

/* 消息内容气泡 */
.ai-message-content {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    font-size: 0.92rem;
    line-height: 1.7;
    word-break: break-word;
    position: relative;
}

.ai-message-assistant .ai-message-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top-left-radius: 4px;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.ai-message-user .ai-message-content {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: #fff;
    border-top-right-radius: 4px;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.25);
}

/* ===== Markdown 渲染样式 ===== */
.ai-message-content p {
    margin: 0 0 0.45rem;
}
.ai-message-content p:last-child,
.ai-message-content > p:only-child {
    margin-bottom: 0;
}

/* 标题 */
.ai-message-content h1,
.ai-message-content h2,
.ai-message-content h3 {
    font-weight: 600;
    color: inherit;
    margin: 0.7rem 0 0.35rem;
}
.ai-message-content h1:first-child,
.ai-message-content h2:first-child,
.ai-message-content h3:first-child {
    margin-top: 0;
}
.ai-message-content h1 { font-size: 1.2rem; }
.ai-message-content h2 { font-size: 1.05rem; }
.ai-message-content h3 { font-size: 0.95rem; }

/* 代码块（带顶部语言标签栏） */
.ai-message-content pre {
    background: #1e1e2e;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    margin: 0.6rem 0;
    font-size: 0.83rem;
    line-height: 1.6;
    border: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
}

/* 代码块顶部栏 */
.ai-message-content pre::before {
    content: '代码';
    display: block;
    padding: 0.35rem 0.85rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.35);
    font-family: inherit;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    letter-spacing: 0.02em;
}

.ai-message-content pre code {
    display: block;
    padding: 0.7rem 1rem;
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.84rem;
    color: #cdd6f4;
    white-space: pre;
    overflow-x: auto;
}

/* 行内代码 */
.ai-message-content code:not(pre code) {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82em;
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 0.14em 0.38em;
    border-radius: 5px;
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.ai-message-user .ai-message-content code:not(pre code) {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
}

/* 用户消息中的代码块 */
.ai-message-user .ai-message-content pre {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.ai-message-user .ai-message-content pre::before {
    background: rgba(255, 255, 255, 0.05);
    border-bottom-color: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.3);
}
.ai-message-user .ai-message-content pre code {
    color: rgba(255, 255, 255, 0.9);
}

/* 列表 */
.ai-message-content ul,
.ai-message-content ol {
    padding-left: 1.4rem;
    margin: 0.45rem 0;
}
.ai-message-content ul { list-style-type: disc; }
.ai-message-content ol { list-style-type: decimal; }
.ai-message-content li {
    margin-bottom: 0.2rem;
    line-height: 1.6;
}
.ai-message-content li:last-child {
    margin-bottom: 0;
}

/* 引用 */
.ai-message-content blockquote {
    border-left: 3px solid var(--primary-color);
    padding: 0.4rem 0.75rem;
    margin: 0.5rem 0;
    background: var(--primary-light);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-secondary);
    font-style: italic;
}
.ai-message-user .ai-message-content blockquote {
    border-left-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
}

/* 表格 */
.ai-message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.6rem 0;
    font-size: 0.84rem;
    border-radius: 8px;
    overflow: hidden;
}
.ai-message-content th,
.ai-message-content td {
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.7rem;
    text-align: left;
}
.ai-message-content th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}
.ai-message-content tr:nth-child(even) td {
    background: var(--bg-secondary);
}

/* 链接 */
.ai-message-content a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid rgba(99, 102, 241, 0.3);
    transition: border-color 0.15s;
}
.ai-message-content a:hover {
    border-bottom-color: var(--primary-color);
}
.ai-message-user .ai-message-content a {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

/* 分隔线 */
.ai-message-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
    margin: 0.7rem 0;
}
.ai-message-user .ai-message-content hr {
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.3), transparent);
}

.ai-message-content strong { font-weight: 600; }
.ai-message-content em { font-style: italic; }

/* ===== 加载动画（三点跳动） ===== */
.ai-typing-indicator {
    display: flex;
    gap: 0.3rem;
    padding: 0.25rem 0;
    align-items: center;
}

.ai-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: ai-dot-bounce 1.3s ease-in-out infinite;
}
.ai-typing-dot:nth-child(1) { animation-delay: 0s;     }
.ai-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.3s;   }

@keyframes ai-dot-bounce {
    0%, 60%, 100% { transform: translateY(0);    opacity: 0.35; }
    30%          { transform: translateY(-7px); opacity: 1;    }
}

/* ===== 输入区域 ===== */
.ai-input-area {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem 1rem;
    background: var(--bg-primary);
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
}

.ai-input-wrapper {
    flex: 1;
    position: relative;
    background: var(--bg-secondary);
    border-radius: 18px;
    border: 1.5px solid transparent;
    transition: all 0.25s ease;
    overflow: hidden;
}

.ai-input-wrapper:focus-within {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.ai-input {
    width: 100%;
    min-height: 44px;
    max-height: 180px;
    border: none;
    background: transparent;
    padding: 0.7rem 1.1rem;
    resize: none;
    font-size: 0.93rem;
    color: var(--text-primary);
    line-height: 1.6;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}

.ai-input::placeholder {
    color: var(--text-muted);
}

/* 发送按钮 */
.ai-send-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 3px 12px rgba(99, 102, 241, 0.3);
    margin-bottom: 1px;
}

.ai-send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #6d28d9 100%);
    transform: scale(1.06);
    box-shadow: 0 5px 18px rgba(99, 102, 241, 0.42);
}
.ai-send-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.ai-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ai-send-btn svg {
    width: 19px;
    height: 19px;
}

/* 停止按钮 */
.ai-stop-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #f87171;
    border-radius: var(--radius-lg);
    background: transparent;
    color: #f87171;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    margin-bottom: 1px;
}

.ai-stop-btn.visible {
    display: flex;
}

.ai-stop-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    box-shadow: 0 3px 12px rgba(239, 68, 68, 0.3);
}
.ai-stop-btn svg { width: 15px; height: 15px; }

/* ===== 错误提示 ===== */
.ai-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    margin: 0.4rem 0;
    animation: ai-error-in 0.3s ease both;
}
@keyframes ai-error-in {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ===== API 未配置提示 ===== */
.ai-setup-tip {
    text-align: center;
    padding: 2.5rem 2rem;
    background: var(--primary-light);
    border: 2px dashed rgba(99, 102, 241, 0.35);
    border-radius: var(--radius-xl);
    margin-bottom: 1.5rem;
    animation: ai-tip-in 0.4s ease both;
}
@keyframes ai-tip-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ai-setup-tip h3 {
    font-size: 1.15rem;
    color: var(--primary-color);
    margin: 0 0 0.6rem;
}

.ai-setup-tip p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 0.35rem;
    line-height: 1.65;
}
.ai-setup-tip strong { color: var(--primary-hover); }
.ai-setup-tip a {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.ai-setup-tip a:hover { color: var(--primary-hover); }

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .ai-container {
        min-height: calc(100vh - 50px - 60px);
        padding: 1rem 0.5rem 1.5rem;
    }

    .ai-chat-wrapper {
        border-radius: var(--radius-lg);
    }

    .ai-toolbar-group {
        padding: 0.5rem 0.85rem;
        gap: 0.4rem;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .ai-toolbar-group::-webkit-scrollbar { display: none; }

    .ai-model-select {
        font-size: 0.73rem;
        padding: 0.28rem 1.7rem 0.28rem 0.6rem;
        max-width: 160px;
    }

    .ai-thinking-toggle { font-size: 0.72rem; padding: 0.2rem 0.5rem; }
    .ai-clear-btn     { font-size: 0.72rem; padding: 0.25rem 0.55rem; }
    .ai-token-label   { display: none; }
    .ai-token-count   { font-size: 0.7rem; }

    .ai-messages { padding: 1rem 0.85rem 0.6rem; gap: 1rem; }

    .ai-message { max-width: 88%; }

    .ai-message-content {
        font-size: 0.88rem;
        padding: 0.65rem 0.85rem;
        border-radius: var(--radius-lg);
    }

    .ai-input-area { padding: 0.65rem 0.85rem 0.9rem; gap: 0.5rem; }
    .ai-input { font-size: 0.89rem; padding: 0.6rem 0.9rem; }

    .ai-send-btn { width: 38px; height: 38px; border-radius: var(--radius-lg); }
    .ai-send-btn svg { width: 17px; height: 17px; }

    .ai-stop-btn { width: 36px; height: 36px; }

    .ai-welcome { padding: 2rem 0.8rem 1.5rem; }
    .ai-welcome-icon { width: 58px; height: 58px; border-radius: 18px; }
    .ai-welcome h3 { font-size: 1.08rem; }
    .ai-welcome p  { font-size: 0.82rem; }

    .ai-quick-prompts {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.45rem;
        max-width: 100%;
    }

    .ai-quick-prompt-btn {
        font-size: 0.78rem;
        padding: 0.55rem 0.5rem;
        border-radius: var(--radius);
    }
    .ai-quick-icon { width: 16px; height: 16px; }
}

@media (max-width: 480px) {
    .ai-quick-prompts {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }
    .ai-quick-prompt-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.4rem;
    }
    .ai-quick-icon { width: 14px; height: 14px; }

    .ai-page-header { margin-bottom: 0.8rem; }
    .ai-page-title { font-size: 1.15rem; }
}

/* 隐藏侧边栏 */
.ai-container ~ .sidebar,
.ai-container + .sidebar { display: none !important; }

/* ===== 暗色模式适配 ===== */
[data-theme="dark"] .ai-chat-wrapper {
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

[data-theme="dark"] .ai-toolbar-group {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .ai-model-select {
    background-color: var(--bg-secondary);
}

[data-theme="dark"] .ai-thinking-toggle:hover {
    background: var(--bg-secondary);
}

[data-theme="dark"] .ai-clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

[data-theme="dark"] .ai-message-assistant .ai-message-content {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .ai-message-user .ai-message-avatar {
    background: var(--bg-tertiary);
}

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

[data-theme="dark"] .ai-input-wrapper:focus-within {
    background: var(--bg-secondary);
}

[data-theme="dark"] .ai-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

[data-theme="dark"] .ai-setup-tip {
    background: rgba(99, 102, 241, 0.08);
    border: 2px dashed rgba(99, 102, 241, 0.25);
}

[data-theme="dark"] .ai-quick-prompt-btn {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .ai-quick-prompt-btn:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--primary-color);
}

[data-theme="dark"] .ai-welcome-brand {
    color: var(--primary-color);
}

[data-theme="dark"] .ai-message-content th {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .ai-message-content tr:nth-child(even) td {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .ai-message-content blockquote {
    background: rgba(99, 102, 241, 0.08);
    border-left-color: var(--primary-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .ai-stop-btn {
    border-color: #f87171;
    color: #f87171;
}

[data-theme="dark"] .ai-stop-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

[data-theme="dark"] .ai-welcome::before {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
}
