/* ===================================================
   AI 投研助手 - 线稿公共样式
   风格：简约清新 · 白底深栏 · 数据感
   =================================================== */

:root {
  /* 品牌色 */
  --brand: #2563EB;
  --brand-light: #EFF6FF;
  --brand-dark: #1D4ED8;
  --accent: #0EA5E9;

  /* 功能色 */
  --up: #EF4444;
  --down: #22C55E;
  --bull: #EF4444;
  --bear: #3B82F6;
  --warn: #F59E0B;
  --danger: #F43F5E;

  /* 中性色 */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;
  --border: #E2E8F0;
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-sidebar: #0F172A;
  --bg-hover: #F1F5F9;
  --bg-active: #EFF6FF;

  /* 尺寸 */
  --sidebar-width: 220px;
  --header-height: 56px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* 阴影 */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-modal: 0 20px 60px rgba(0,0,0,0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- 整体布局 ---- */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- 侧边栏 ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-logo {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo .logo-icon {
  width: 28px; height: 28px;
  background: var(--brand);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 14px; font-weight: 700;
  margin-right: 10px; flex-shrink: 0;
}

.sidebar-logo .logo-text {
  color: white;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }

.nav-group-title {
  color: rgba(255,255,255,0.35);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9); }

.nav-item.active {
  background: rgba(37,99,235,0.25);
  color: white;
  position: relative;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--brand);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}

/* ---- 主内容区 ---- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ---- 顶部栏 ---- */
.topbar {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  flex-shrink: 0;
  gap: 12px;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.topbar-breadcrumb {
  font-size: 13px;
  color: var(--text-tertiary);
  flex: 1;
}

.topbar-breadcrumb span { color: var(--text-secondary); }
.topbar-breadcrumb .sep { margin: 0 6px; }

/* ---- 内容滚动区 ---- */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ---- 卡片 ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}

.card-title .icon { font-size: 16px; }
.card-body { padding: 20px; }

/* ---- 数据指标卡 ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
}

.stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 5px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-change {
  font-size: 12px;
  margin-top: 4px;
  display: flex; align-items: center; gap: 3px;
}

.stat-change.up { color: var(--up); }
.stat-change.down { color: var(--down); }

/* ---- 涨跌 Badge ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.badge.up { background: #FEF2F2; color: var(--up); }
.badge.down { background: #F0FDF4; color: var(--down); }
.badge.neutral { background: #F1F5F9; color: var(--text-secondary); }
.badge.bull { background: #FFF1F2; color: var(--danger); }
.badge.bear { background: var(--brand-light); color: var(--brand); }
.badge.warn { background: #FFFBEB; color: var(--warn); }
.badge.primary { background: var(--brand-light); color: var(--brand); }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: white; color: var(--brand); border: 1px solid var(--brand); }
.btn-secondary:hover { background: var(--brand-light); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-danger { background: #FEF2F2; color: var(--danger); border: 1px solid #FECDD3; }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
  background: #F8FAFC;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid #F1F5F9;
  font-variant-numeric: tabular-nums;
}

tbody tr:hover td { background: #FAFBFF; }
tbody tr:last-child td { border-bottom: none; }

.td-num { text-align: right; font-family: 'Courier New', monospace; }
.td-code { font-family: 'Courier New', monospace; font-size: 12px; color: var(--text-secondary); }

/* ---- 搜索/工具栏 ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px 0 34px;
  font-size: 13px;
  color: var(--text-primary);
  background: white;
  outline: none;
  min-width: 200px;
  transition: border-color 0.15s;
  position: relative;
}

.search-wrap {
  position: relative;
  display: inline-flex; align-items: center;
}

.search-wrap .search-icon {
  position: absolute; left: 10px;
  color: var(--text-tertiary); font-size: 14px; pointer-events: none;
}

.search-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }

.select-filter {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--text-secondary);
  background: white;
  outline: none;
}

/* ---- 分页 ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.page-btn {
  min-width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  background: white;
}

.page-btn.active { background: var(--brand); color: white; border-color: var(--brand); }
.page-total { font-size: 12px; color: var(--text-tertiary); margin-right: 8px; }

/* ---- 标签页 Tab ---- */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
}

.tab-item {
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 6px;
}

.tab-item:hover { color: var(--brand); }
.tab-item.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }

/* ---- 时间段快捷选择 ---- */
.timerange {
  display: flex;
  gap: 4px;
  background: var(--bg-page);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.tr-btn {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  transition: all 0.12s;
}

.tr-btn.active { background: white; color: var(--brand); font-weight: 500; box-shadow: var(--shadow-card); }

/* ---- 标签列表 ---- */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 4px; font-size: 12px; background: var(--brand-light); color: var(--brand); }
.tag.green { background: #F0FDF4; color: #16A34A; }
.tag.red { background: #FEF2F2; color: #DC2626; }
.tag.amber { background: #FFFBEB; color: #D97706; }
.tag.gray { background: #F1F5F9; color: var(--text-secondary); }

/* ---- 空状态 ---- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-text { font-size: 14px; }

/* ---- 图表容器占位 ---- */
.chart-placeholder {
  background: var(--bg-page);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  font-size: 13px;
  flex-direction: column; gap: 8px;
}

.chart-placeholder .chart-icon { font-size: 28px; opacity: 0.4; }

/* ---- AI 流式输出气泡 ---- */
.ai-bubble {
  background: var(--brand-light);
  border: 1px solid #BFDBFE;
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  position: relative;
}

.ai-bubble .model-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--brand); font-weight: 600;
  margin-bottom: 8px;
}

.cursor-blink {
  display: inline-block; width: 2px; height: 14px;
  background: var(--brand); animation: blink 1s infinite; vertical-align: text-bottom;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ---- Bull/Bear 仪表盘 ---- */
.sentiment-gauge {
  display: flex; flex-direction: column; align-items: center; padding: 20px;
}
.gauge-value { font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gauge-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ---- 价格变动标注 ---- */
.price-up { color: var(--up); font-weight: 600; }
.price-down { color: var(--down); font-weight: 600; }
.price-flat { color: var(--text-tertiary); }

/* ---- 新闻卡片 ---- */
.news-item {
  padding: 14px 0;
  border-bottom: 1px solid #F1F5F9;
  display: flex; flex-direction: column; gap: 6px;
}
.news-item:last-child { border-bottom: none; }
.news-title { font-size: 14px; color: var(--text-primary); font-weight: 500; line-height: 1.5; }
.news-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-tertiary); }
.news-source { color: var(--brand); font-weight: 500; }

/* ---- 早报卡片 ---- */
.brief-section { margin-bottom: 20px; }
.brief-section-title {
  font-size: 13px; font-weight: 600; color: var(--brand);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--brand-light);
}
.brief-item { padding: 6px 0; font-size: 13px; color: var(--text-secondary); display: flex; gap: 8px; }
.brief-item::before { content: '·'; color: var(--brand); font-weight: 700; }

/* ---- 页面尺寸（375×812 线稿用） ---- */
.wireframe-phone {
  width: 375px; min-height: 812px;
  background: white;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
}

/* ---- 滚动条美化 ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
