/* ============================================
   DataSpell Chat — 与官网风格一致
   蓝 #2563eb · 圆角 · 微影 · 呼吸感
   ============================================ */

body {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37,99,235,0.06);
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-hover: #f1f5f9;
  --user-bubble: #2563eb;
  --ai-bubble: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --font: 'IBM Plex Sans','Noto Sans SC',-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

/* === 登录弹窗 === */
#authModal h2 { font-weight: 600; font-size: 24px; letter-spacing: -0.3px; }
#authModal input {
  background: #f8fafc; border-radius: 10px;
  border: 1.5px solid #e2e8f0; padding: 13px 16px; font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#authModal input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
#authModal .rounded-2xl { border-radius: 16px; }
#loginSubmitBtn, #registerSubmitBtn, #resetSubmitBtn {
  border-radius: 10px; height: 48px; font-size: 15px; font-weight: 500;
}
#switchToRegister, #switchToLoginFromReg, #switchToLoginFromReset, #switchToReset { color: #2563eb; }

/* === 侧栏 === */
#sidebar { background: #f8fafc; border-right: 1px solid #e2e8f0; }

/* === 新建会话按钮 === */
#newSessionBtn {
  background: #2563eb; border-radius: 10px; height: 44px;
  font-size: 14px; font-weight: 500; border: none;
  box-shadow: 0 2px 8px rgba(37,99,235,0.15);
  transition: all 0.2s;
}
#newSessionBtn:hover {
  background: #1d4ed8; box-shadow: 0 6px 20px rgba(37,99,235,0.25);
  transform: translateY(-1px);
}

/* === 会话列表 === */
.session-item { border-radius: 10px; margin-bottom: 1px; transition: all 0.15s; }
.session-item.active { background: #eff6ff; }
.session-item.active .text-sm.font-medium { color: #2563eb; font-weight: 500; }
.session-item:not(.active):hover { background: #e2e8f0; }

/* === 欢迎区 === */
#welcomeArea .w-16.h-16 {
  background: #2563eb; border-radius: 16px;
  box-shadow: 0 8px 24px rgba(37,99,235,0.15);
}
#welcomeTitle { font-weight: 600; letter-spacing: -0.5px; }
#welcomeMessage { color: #475569; }

.prompt-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 17px; margin: 3px;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  background: #ffffff; color: #334155;
  font-size: 14px; font-weight: 400; cursor: pointer;
  transition: all 0.2s;
}
.prompt-chip:hover {
  border-color: #2563eb; background: #eff6ff;
  color: #2563eb; transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37,99,235,0.1);
}

/* === 用户消息气泡 === */
.user-message .message-content {
  background: #2563eb; color: #ffffff;
  border-radius: 16px 16px 4px 16px; padding: 12px 18px;
  font-size: 15px; line-height: 1.6;
  box-shadow: 0 2px 8px rgba(37,99,235,0.2);
  border: none;
}
.user-message .message-content::after { display: none; }

/* === AI 消息气泡 === */
.ai-message .message-content {
  background: #ffffff; color: #0f172a;
  border: 1px solid #e2e8f0; border-radius: 4px 16px 16px 16px;
  padding: 14px 20px; font-size: 15px; line-height: 1.75;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.ai-message .message-content::before, .ai-message .message-content::after { display: none; }

/* === 输入区 === */
.chat-input-area { background: #ffffff; border-top: 1px solid #e2e8f0; padding: 12px 16px; }
.input-wrapper {
  border: 1.5px solid #e2e8f0; border-radius: 12px;
  background: #f8fafc; padding: 2px 4px;
  display: flex; align-items: flex-end; gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-wrapper:focus-within {
  border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
#messageInput {
  font-family: var(--font); color: #0f172a; font-size: 15px;
  background: transparent; border: none; outline: none;
  resize: none; flex: 1; padding: 8px 4px;
  line-height: 1.5; min-height: 24px; max-height: 120px;
}
#sendBtn {
  background: #2563eb; color: #ffffff; border-radius: 8px;
  width: 30px; height: 30px; border: none; cursor: pointer;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
#sendBtn:hover:not(:disabled) {
  background: #1d4ed8; box-shadow: 0 4px 14px rgba(37,99,235,0.25);
  transform: scale(1.05);
}
#sendBtn:disabled { opacity: 0.3; background: #94a3b8; cursor: default; }
.input-footer { color: #94a3b8; font-size: 12px; text-align: center; padding-top: 8px; }

/* === 头栏 === */
#headerBar {
  background: #ffffff; border-bottom: 1px solid #e2e8f0;
  font-weight: 500; font-size: 15px; color: #0f172a;
}

/* === 底部工具栏 === */
#exportLogBtn, #quotaBar { color: #64748b; }
#exportLogBtn:hover { color: #334155; background: #f1f5f9; border-radius: 8px; }
#quotaBar .bg-gray-200 { background: #e2e8f0; }
#sidebar a[href*="dataspell.cn"] { border-radius: 8px; transition: all 0.2s; }
#sidebar a[href*="dataspell.cn"]:hover { background: #eff6ff; color: #2563eb; }

/* === 打字指示器 === */
#typingIndicator .bg-white {
  background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 14px; padding: 10px 16px;
}

/* === 确认对话框 === */
#confirmModal > div { border-radius: 16px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.12); }
#confirmOk { background: #2563eb; border-radius: 10px; height: 40px; padding: 0 20px; font-weight: 500; border: none; }
#confirmOk:hover { background: #1d4ed8; }
#confirmCancel { border-radius: 10px; padding: 0 16px; }

/* === 思考折叠 === */
.think-block.collapsed .think-content { display: none; }
.think-block .think-summary { padding: 8px 12px; font-size: 12px; color: #94a3b8; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.think-block .think-arrow { font-size: 10px; transition: transform 0.2s; display: inline-block; }
.think-block.collapsed .think-arrow { transform: rotate(0deg); }
.think-block:not(.collapsed) .think-arrow { transform: rotate(90deg); }
.think-block .think-content { padding: 0 12px 12px; font-size: 13px; color: #64748b; white-space: pre-wrap; }

/* === 滚动条 & 选中 === */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.10); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.18); }
::selection { background: rgba(37,99,235,0.15); color: #0f172a; }



/* === 常驻引导条 === */
.prompt-bar { 
  padding: 4px 8px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.prompt-bar.collapsed .prompt-bar-body { max-height: 0; overflow: hidden; }
.prompt-bar:not(.collapsed) .prompt-bar-body { max-height: 1200px; overflow: hidden; transition: max-height 0.3s ease; padding-bottom: 8px; }
.prompt-bar-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px; cursor: pointer; user-select: none;
  font-size: 13px; color: #94a3b8;
  background: transparent; border-radius: 8px;
  border: 1px dashed #e2e8f0;
  transition: all 0.15s;
}
.prompt-bar-hd:hover { color: #2563eb; border-color: #2563eb; border-style: solid; background: #eff6ff; }
.prompt-bar.collapsed .prompt-bar-hd { color: #2563eb; border-color: #2563eb; border-style: solid; background: #eff6ff; font-weight: 500; }
.prompt-bar:not(.collapsed) .prompt-bar-hd { color: #2563eb; font-weight: 500; margin-bottom: 8px; border-style: solid; border-color: #2563eb; }
.prompt-bar-arr { width: 14px; height: 14px; flex-shrink: 0; transition: transform 0.25s ease; margin-left: auto; }
.prompt-bar:not(.collapsed) .prompt-bar-arr { transform: rotate(180deg); }
.prompt-bar-body { overflow: hidden; }
.prompt-bar .prompt-groups { display: flex; flex-direction: column; gap: 3px; }
.prompt-bar .prompt-group { border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; background: #ffffff; }
.prompt-bar .prompt-group.open { border-color: #2563eb; }
.prompt-bar .prompt-group-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 500; color: #475569;
}
.prompt-bar .prompt-group-hd:hover { color: #2563eb; background: #f8fafc; }
.prompt-bar .prompt-group.open .prompt-group-hd { color: #2563eb; }
.prompt-bar .prompt-group-arr { width: 14px; height: 14px; flex-shrink: 0; color: #94a3b8; transition: transform 0.25s ease; }
.prompt-bar .prompt-group.open .prompt-group-arr { transform: rotate(180deg); color: #2563eb; }
.prompt-bar .prompt-group-body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; padding: 0 10px; }
.prompt-bar .prompt-group.open .prompt-group-body { max-height: 200px; padding-bottom: 6px; }
.prompt-bar .prompt-group-body .prompt-chip {
  display: block; width: 100%; text-align: left;
  margin: 0; padding: 8px 14px; border: none;
  border-radius: 8px; background: transparent;
  font-size: 13px; color: #334155;
  transition: all 0.15s;
}
.prompt-bar .prompt-group-body .prompt-chip:hover {
  background: #eff6ff; color: #2563eb;
  transform: none; box-shadow: none;
}

/* 有消息时欢迎区隐藏（chat.js 控制），引导条仍可见 */
/* === 移动端 === */
@media (max-width: 1024px), (pointer: coarse) {
  .h-screen { height: 100vh; height: -webkit-fill-available; height: 100dvh; }
  #headerBar { padding-top: env(safe-area-inset-top); height: calc(44px + env(safe-area-inset-top)); z-index: 36; }
  #sidebarToggle { top: calc(50% + env(safe-area-inset-top) / 2); }
  #sidebar { position: fixed; top: 0; left: 0; width: 80vw; max-width: 300px; height: 100vh; height: -webkit-fill-available; height: 100dvh; z-index: 40; transform: translateX(-100%); transition: transform 0.3s ease; }
  #sidebar.open { transform: translateX(0); }
  #sidebarOverlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 35; }
  #sidebarOverlay.show { display: block; }
  .message-body { max-width: calc(100% - 48px); }
  #chatArea { padding: 12px 12px; }
  #sendBtn { width: 40px; height: 40px; }
  .chat-input-area { padding: 4px 12px max(env(safe-area-inset-bottom, 0px), 4px); flex-shrink: 0; }
  #messageInput { min-height: 20px; padding: 2px 4px; }
  #welcomeArea .prompt-chip { width: 100%; text-align: center; }
  #welcomeArea .w-16 { width: 3.5rem; height: 3.5rem; }
  #welcomeArea h1 { font-size: 1.25rem; }
  .copy-btn { opacity: 1; width: 28px; height: 28px; }
  .mobile-only { display: flex; }
  body { height: -webkit-fill-available; height: 100dvh; user-select: text; }
  .input-footer { padding-bottom: max(env(safe-area-inset-bottom, 0px), 4px); margin-top: 4px; font-size: 10px; }
}
/* === 用户中心面板 === */
.user-center-panel {
    display: none;
}
.user-center-panel.open {
    display: block;
}
.uc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 200;
}
.uc-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.1);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}
.user-center-panel.open .uc-drawer {
    transform: translateX(0);
}
.uc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
}
.uc-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}
.uc-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s;
}
.uc-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.uc-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.uc-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}
.uc-info-grid {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 6px 12px;
    font-size: 14px;
}
.uc-label {
    color: #94a3b8;
    font-size: 13px;
}
.uc-value {
    color: #0f172a;
}
.uc-quota {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.uc-quota-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}
.uc-quota-fill {
    height: 100%;
    background: #2563eb;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.uc-quota-text {
    text-align: right;
    font-size: 13px;
    color: #64748b;
}
.uc-password-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.uc-form-row {
}
.uc-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: #f8fafc;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.uc-input:focus {
    border-color: #2563eb;
}
.uc-error {
    font-size: 13px;
    color: #ef4444;
    min-height: 18px;
}
.uc-btn-primary {
    padding: 10px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.uc-btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
}
.uc-btn-primary:disabled {
    opacity: 0.5;
    cursor: default;
}
.uc-btn-danger {
    width: 100%;
    padding: 10px;
    background: #ffffff;
    color: #ef4444;
    border: 1.5px solid #fca5a5;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.uc-btn-danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

/* === 注册引导卡片 === */
.guide-card {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
}
.guide-card.visible {
    display: block;
}
.guide-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}
.guide-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 20px;
    padding: 36px 32px;
    width: 360px;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,0.2);
}
.guide-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}
.guide-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}
.guide-icon {
    width: 60px;
    height: 60px;
    background: #eff6ff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}
.guide-title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 10px;
}
.guide-desc {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 24px;
}
.guide-desc strong {
    color: #2563eb;
    font-weight: 700;
}
.guide-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.guide-btn-primary {
    width: 100%;
    padding: 13px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(37,99,235,0.3);
}
.guide-btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.35);
}
.guide-btn-secondary {
    width: 100%;
    padding: 13px;
    background: #ffffff;
    color: #2563eb;
    border: 1.5px solid #2563eb;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.guide-btn-secondary:hover {
    background: #eff6ff;
}

/* === 注册表单（在 auth-ui.js 弹窗中） === */
#registerForm {
    display: none;
}
#registerForm.active {
    display: block;
}
