/**
 * BidAgent 客户前台样式
 * 视觉参考灵境网络官网：https://www.lingjingnet.com/
 * 深色渐变背景 + 玻璃拟态卡片 + 蓝紫科技色调
 */

:root {
  --bg-deep: #050810;
  --bg-mid: #0d1526;
  --bg-gradient: radial-gradient(ellipse 120% 80% at 50% -20%, #1e3a5f 0%, #0d1526 45%, #050810 100%);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-hover: rgba(255, 255, 255, 0.09);
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --accent: #a78bfa;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --user-bg: linear-gradient(135deg, #3b82f6, #6366f1);
  --assistant-bg: rgba(255, 255, 255, 0.08);
  --success: #34d399;
  --warning: #fbbf24;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  background: var(--bg-deep);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

/* 顶部品牌栏 */
.layout { display: flex; flex-direction: column; height: 100vh; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(5, 8, 16, 0.6);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

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

.logo {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.header-tag {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}

.header h1 { font-size: 18px; font-weight: 600; }
.header p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* 主工作区：左对话 + 右报价 */
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 16px;
  gap: 16px;
}

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.msg { max-width: 75%; display: flex; flex-direction: column; gap: 6px; }
.msg.user { align-self: flex-end; }
.msg.assistant { align-self: flex-start; }

.msg-label { font-size: 11px; color: var(--text-muted); padding: 0 6px; }
.msg.user .msg-label { text-align: right; }

.msg-bubble {
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.user .msg-bubble {
  background: var(--user-bg);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.msg.assistant .msg-bubble {
  background: var(--assistant-bg);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 4px;
}

/* 对话框内 AI 引导选项 */
.msg-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.msg-option {
  background: rgba(96, 165, 250, 0.1);
  color: var(--text);
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  max-width: 100%;
}

.msg-option:hover:not(:disabled) {
  background: rgba(96, 165, 250, 0.22);
  border-color: rgba(96, 165, 250, 0.45);
  transform: translateY(-1px);
}

.msg-option.is-selected {
  background: rgba(52, 211, 153, 0.18);
  border-color: rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
}

.msg-option.is-disabled:not(.is-selected) {
  opacity: 0.45;
  cursor: not-allowed;
}

.msg-input-hint {
  width: 100%;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* 对话框内思考指示（替代全屏 loading） */
.msg-thinking .msg-bubble {
  min-width: 220px;
}

.thinking-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.thinking-title {
  color: var(--primary);
  font-weight: 500;
}

.thinking-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(96, 165, 250, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

.thinking-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  padding-left: 2px;
}

.thinking-line {
  font-size: 12px;
  line-height: 1.55;
  color: #94a3b8;
  animation: thinkingFadeIn 0.35s ease;
}

.thinking-line::before {
  content: "· ";
  color: rgba(96, 165, 250, 0.55);
}

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

.chat-input-area textarea:disabled,
.send-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* 底部备用芯片（AI 未返回 options 时） */
.follow-up-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 12px;
  align-items: center;
}

.follow-up-hint {
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.chip {
  background: rgba(96, 165, 250, 0.12);
  color: var(--primary);
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  background: rgba(96, 165, 250, 0.22);
  transform: translateY(-1px);
}

/* 输入区 */
.chat-input-area {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
}

.chat-input-area textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  font-family: inherit;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  line-height: 1.5;
}

.chat-input-area textarea::placeholder { color: #64748b; }

.chat-input-area textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

/* 右侧报价面板 */
.quote-panel {
  width: 380px;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.quote-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--glass-border);
}

.quote-panel-header h2 { font-size: 15px; font-weight: 600; }

.badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.badge-muted { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.badge-ready { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.badge-draft { background: rgba(251, 191, 36, 0.15); color: var(--warning); }

.quote-empty {
  padding: 48px 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.8;
}

.quote-empty-icon { font-size: 40px; margin-bottom: 16px; opacity: 0.8; }

.quote-content { padding: 20px; }

.quote-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 8px 10px;
  background: rgba(251, 191, 36, 0.08);
  border-radius: 8px;
  border-left: 3px solid var(--warning);
}

.quote-total {
  font-size: 36px;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 14px;
}

.quote-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.quote-summary {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 1px solid var(--glass-border);
}

.module-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 16px;
}

.module-table th,
.module-table td {
  border: 1px solid var(--glass-border);
  padding: 8px 10px;
  text-align: left;
}

.module-table th {
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-muted);
  font-weight: 500;
}

.module-table td.num { text-align: right; }

.quote-actions { display: flex; flex-direction: column; gap: 10px; }

.contact-done {
  margin-top: 12px;
  padding: 14px;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 10px;
  font-size: 13px;
  color: var(--success);
  line-height: 1.6;
}

/* 按钮 */
.btn {
  padding: 11px 20px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.45);
}

.btn-ghost {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--glass-border);
}

.btn-ghost:hover { background: var(--glass-hover); }

.btn-sm { padding: 7px 14px; font-size: 13px; }

.hidden { display: none !important; }
.required { color: #f87171; }

/* 留资弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 16, 0.75);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: #131b2e;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 32px;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.modal-card h3 { font-size: 18px; margin-bottom: 8px; }

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.modal-card label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.modal-card input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
}

.modal-card input:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-actions { display: flex; gap: 10px; margin-top: 8px; }

/* Toast & Loading */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 2000;
  box-shadow: var(--shadow);
}

.toast.error { background: #7f1d1d; border-color: #ef4444; }

.loading {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  color: var(--text);
  gap: 16px;
  font-size: 14px;
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .workspace { flex-direction: column; padding: 12px; }
  .quote-panel { width: 100%; max-height: 42vh; }
  .msg { max-width: 90%; }
}
