/* 法牛全球 — DeepSeek 风格镜像页
   仿 DeepSeek 官方界面（蓝白色调 / 左侧栏 + 主聊天区）*/

* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #4D6BFE;
  --primary-dark: #3B5BDB;
  --primary-light: #EEF1FF;
  --bg: #ffffff;
  --sidebar-bg: #F7F8FA;
  --text: #1A1A1A;
  --text-secondary: #666666;
  --text-tertiary: #999999;
  --border: #E5E7EB;
  --hover-bg: #F0F1F5;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

body {
  display: flex;
  min-height: 100vh;
}

/* ============ 侧边栏 ============ */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: margin-left 0.2s;
}
.sidebar.collapsed { margin-left: -260px; }

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
}
.new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.new-chat-btn:hover { background: var(--primary-dark); }

.sidebar-section {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}
.sidebar-section-title {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  font-weight: 600;
}
.history-list { display: flex; flex-direction: column; gap: 2px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  transition: background 0.1s;
  overflow: hidden;
}
.history-item:hover { background: var(--hover-bg); color: var(--text); }
.history-item span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item svg { flex-shrink: 0; opacity: 0.6; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.user-info:hover { background: var(--hover-bg); }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}
.user-name { font-size: 14px; color: var(--text); font-weight: 500; }

/* ============ 主区 ============ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}
.model-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}
.model-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.model-badge {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 10px;
  font-weight: 600;
}
.topbar-right { display: flex; gap: 16px; }
.topbar-link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.1s;
}
.topbar-link:hover { color: var(--primary); }

/* ============ 聊天区 ============ */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  scroll-behavior: smooth;
}

/* 欢迎页 */
.welcome {
  max-width: 720px;
  margin: 40px auto;
  padding: 0 20px;
  text-align: center;
}
.welcome-title {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), #6B8AFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.welcome-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}
.welcome-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.welcome-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg);
}
.welcome-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.card-icon { font-size: 24px; margin-bottom: 8px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card-desc { font-size: 12px; color: var(--text-tertiary); }
.welcome-tip {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 12px;
  background: var(--sidebar-bg);
  border-radius: var(--radius-sm);
}

/* 消息 */
.messages {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.msg { display: flex; gap: 12px; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.msg.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  color: white;
  flex-shrink: 0;
}
.msg.user .msg-avatar { background: var(--primary); }
.msg.assistant .msg-avatar { background: linear-gradient(135deg, #4D6BFE, #6B8AFF); }

.msg-content { flex: 1; max-width: 80%; }
.msg.user .msg-content { display: flex; flex-direction: column; align-items: flex-end; }
.msg-body {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.7;
  word-break: break-word;
  white-space: pre-wrap;
}
.msg.user .msg-body {
  background: var(--primary);
  color: white;
}
.msg.assistant .msg-body {
  background: var(--sidebar-bg);
  color: var(--text);
}
.msg-time {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  padding: 0 4px;
}

/* 律师卡片（DeepSeek 风格） */
.lawyer-card-ds {
  margin-top: 12px;
  background: linear-gradient(135deg, #FFF8E1 0%, #FFFCF0 100%);
  border: 1.5px solid #F0C14B;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.lawyer-card-ds .badge {
  display: inline-block;
  background: #F0C14B;
  color: #5D4206;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
  margin-bottom: 8px;
}
.lawyer-card-ds .lname {
  font-size: 18px;
  font-weight: 700;
  color: #5D4206;
  margin-bottom: 4px;
}
.lawyer-card-ds .lcat {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.lawyer-card-ds .lactions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.lawyer-card-ds .lbtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: 18px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.1s, opacity 0.15s;
}
.lawyer-card-ds .lbtn:active { transform: scale(0.97); }
.lawyer-card-ds .lbtn.call { background: var(--primary); color: white; }
.lawyer-card-ds .lbtn.mail { background: white; color: var(--primary); border: 1px solid var(--primary); }
.lawyer-card-ds .lbtn.lead { background: #FF6B35; color: white; flex-basis: 100%; }
/* 明码标价套餐入口：最高意向时刻的收钱出口，做成醒目的金色次要主按钮 */
.lawyer-card-ds .lbtn.services { background: #FFF6E3; color: #8A5A00; border: 1px solid #F0C14B; flex-basis: 100%; }
.lawyer-card-ds .lnote { font-size: 12px; color: var(--text-secondary); margin-top: 8px; padding-top: 8px; border-top: 1px dashed #F0C14B; }
.lawyer-card-ds .lnote.default { color: #5D4206; font-weight: 500; }

/* 思考中 */
.thinking {
  display: inline-flex;
  gap: 4px;
  padding: 16px 20px;
  background: var(--sidebar-bg);
  border-radius: var(--radius);
  align-items: center;
}
.thinking span {
  width: 6px; height: 6px;
  background: var(--text-tertiary);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}
.thinking span:nth-child(1) { animation-delay: -0.32s; }
.thinking span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

/* ============ 输入区 ============ */
.input-area {
  border-top: 1px solid var(--border);
  padding: 16px 20px 20px;
  background: var(--bg);
  flex-shrink: 0;
}
.input-wrapper {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 8px 8px 14px;
  transition: border-color 0.15s;
}
.input-wrapper:focus-within { border-color: var(--primary); }
.input-wrapper textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  max-height: 140px;
  line-height: 1.5;
  padding: 6px 0;
}
.send-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.send-btn:disabled { background: var(--text-tertiary); cursor: not-allowed; }
.send-btn:not(:disabled):hover { background: var(--primary-dark); }
.send-btn:not(:disabled):active { transform: scale(0.92); }
.input-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 8px;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* ============ 模态框 ============ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s;
}
.modal {
  background: white;
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-header h3 { font-size: 17px; }
.modal-close { background: none; border: none; font-size: 24px; line-height: 1; color: var(--text-secondary); cursor: pointer; padding: 0 4px; }
.modal-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.lead-form label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; }
.lead-form label span em { color: #d33; font-style: normal; margin-left: 2px; }
.lead-form input, .lead-form select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: white;
  outline: none;
  transition: border-color 0.15s;
}
.lead-form input:focus, .lead-form select:focus { border-color: var(--primary); }
.form-msg { font-size: 13px; margin: 8px 0; min-height: 18px; }
.form-msg.ok { color: #34a853; }
.form-msg.err { color: #d33; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn { padding: 11px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: white; color: var(--text); flex: 1; transition: opacity 0.15s; }
.btn:active { opacity: 0.7; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; box-shadow: var(--shadow-lg); }
  .sidebar.collapsed { margin-left: -260px; }
  .menu-btn { display: block; }
  .topbar-right { display: none; }
  .welcome-title { font-size: 24px; }
  .welcome-grid { grid-template-columns: 1fr; }
  .messages { padding: 0 14px; }
  .msg-content { max-width: 88%; }
}

/* ============ 港澳 / 海外客户专属醒目推荐条 ============ */
.hk-macau-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 760px;
  margin: 16px auto 0;
  padding: 14px 18px;
  background: linear-gradient(135deg, #4D6BFE 0%, #6B8AFF 100%);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(77,107,254,0.25);
}
.hk-macau-banner-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hk-macau-flag { font-size: 28px; }
.hk-macau-title { font-size: 15px; font-weight: 700; line-height: 1.4; }
.hk-macau-sub { font-size: 11px; opacity: 0.9; line-height: 1.4; }
.hk-macau-banner-right { display: flex; gap: 8px; flex-shrink: 0; }
.hk-macau-btn-primary,
.hk-macau-btn-secondary {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.15s;
}
.hk-macau-btn-primary { background: #fff; color: var(--primary); }
.hk-macau-btn-secondary { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.35); }
.hk-macau-btn-primary:hover,
.hk-macau-btn-secondary:hover { opacity: 0.9; transform: translateY(-1px); }

@media (max-width: 768px) {
  .hk-macau-banner { flex-direction: column; align-items: stretch; padding: 12px; margin-top: 12px; }
  .hk-macau-banner-left { justify-content: center; text-align: center; }
  .hk-macau-banner-right { justify-content: center; flex-wrap: wrap; }
  .hk-macau-btn-primary, .hk-macau-btn-secondary { font-size: 12px; padding: 8px 10px; }
}

/* ============ 浮动律师推荐条（移动端友好） ============ */
.fniu-sticky-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 50;
}
.fniu-sticky-bar strong { color: var(--primary); }
.fniu-sticky-bar a { color: var(--primary); text-decoration: none; font-weight: 600; }
.fniu-sticky-bar a:hover { text-decoration: underline; }
