/* =========================================================
   A股板块看盘 · 科技简约深色主题
   设计语言：玻璃拟态卡片、青蓝渐变点缀、克制留白、tabular-nums
   ========================================================= */

:root {
  --bg: #07090d;
  --panel: rgba(15, 20, 28, 0.70);
  --panel-2: rgba(11, 15, 21, 0.90);
  --border: rgba(148, 163, 184, 0.10);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #e6edf3;
  --text-dim: #7d8590;
  --red: #f6465d;      /* A股：涨/红 */
  --green: #0ecb81;    /* A股：跌/绿 */
  --accent: #22d3ee;
  --accent-2: #6366f1;
  --grad: linear-gradient(135deg, #22d3ee, #6366f1);
  --radius: 14px;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.40);
  --font: "Microsoft YaHei", "PingFang SC", "Segoe UI", -apple-system, Arial, sans-serif;
}

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

html, body { height: 100%; }

body {
  background:
    radial-gradient(1100px 560px at 12% -12%, rgba(34, 211, 238, 0.07), transparent 60%),
    radial-gradient(900px 480px at 88% -12%, rgba(99, 102, 241, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ===== 顶栏（玻璃） ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(8, 11, 16, 0.62);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
}

.topbar-left { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  white-space: nowrap;
}
.logo::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.85);
}

.index-strip { display: flex; gap: 22px; flex-wrap: wrap; }
.index-item { display: flex; align-items: baseline; gap: 8px; }
.index-item .idx-name { color: var(--text-dim); font-size: 12px; }
.index-item .idx-value { font-weight: 650; font-variant-numeric: tabular-nums; }
.index-item .idx-chg { font-size: 12px; font-variant-numeric: tabular-nums; }
.up { color: var(--red); }
.down { color: var(--green); }
.flat { color: var(--text-dim); }

.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.refresh-note { color: var(--text-dim); font-size: 12px; }
.auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 13px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.07);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.auto-refresh:hover { border-color: rgba(34, 211, 238, 0.5); color: var(--text); }
.auto-refresh input { accent-color: var(--accent); }

.global-error {
  background: rgba(246, 70, 93, 0.12);
  border-bottom: 1px solid rgba(246, 70, 93, 0.35);
  color: var(--red);
  padding: 9px 20px;
  font-size: 13px;
}

/* ===== 个股搜索（顶栏） ===== */
.stock-search { position: relative; width: 230px; }
.stock-search input {
  width: 100%;
  padding: 7px 13px;
  background: rgba(7, 9, 13, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  font-size: 13px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.stock-search input::placeholder { color: var(--text-dim); }
.stock-search input:focus {
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.14);
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--panel-2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  max-height: 320px;
  overflow: auto;
  z-index: 50;
}
.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.search-item + .search-item { border-top: 1px solid rgba(148, 163, 184, 0.06); }
.search-item:hover { background: rgba(34, 211, 238, 0.08); }
.si-name { color: var(--text); font-weight: 550; }
.si-code { color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.si-type { margin-left: auto; color: var(--text-dim); font-size: 11px; white-space: nowrap; }

/* ===== 主布局 ===== */
.layout {
  display: flex;
  gap: 14px;
  padding: 14px;
  align-items: flex-start;
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.board-panel, .chart-panel {
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.board-panel {
  width: 760px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 84px);
}

.chart-panel {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}
.chart-panel.no-board .table-area { display: none; }

/* ===== 板块榜 ===== */
.board-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.tab:hover { color: var(--text); background: rgba(148, 163, 184, 0.06); }
.tab.active {
  background: rgba(34, 211, 238, 0.10);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.28);
}

.board-search { padding: 10px 12px; }
.board-search input {
  width: 100%;
  padding: 7px 12px;
  background: rgba(7, 9, 13, 0.55);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.board-search input::placeholder { color: var(--text-dim); }
.board-search input:focus {
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.14);
}

.board-table-wrap { overflow: auto; flex: 1; min-height: 200px; }
.board-table { min-width: 760px; }
.board-table thead th { padding: 8px 6px; font-size: 11px; }
.board-table tbody td { padding: 6px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(13, 17, 23, 0.85);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.4px;
  white-space: nowrap;
  padding: 9px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border-strong);
}
thead th:first-child, tbody td:first-child { padding-left: 14px; }

th.sortable { cursor: pointer; user-select: none; transition: color 0.15s ease; }
th.sortable:hover { color: var(--text); }
th.sortable.active { color: var(--accent); }

tbody td {
  padding: 7px 10px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid rgba(148, 163, 184, 0.05);
  transition: background 0.12s ease;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: rgba(34, 211, 238, 0.05); }
tbody tr.selected td {
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.13), rgba(34, 211, 238, 0.02));
  box-shadow: inset 2px 0 0 var(--accent);
}

td.left { text-align: left; }
td.name-cell { text-align: left; font-weight: 550; color: #fff; }

.up-bg { color: var(--red); }
.down-bg { color: var(--green); }
.dim { color: var(--text-dim); }

.leader { max-width: 128px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

/* ===== 跨池搜索徽标 ===== */
.bdg {
  display: inline-block;
  font-size: 10px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  margin-right: 5px;
  vertical-align: 1px;
}
.bdg.industry { color: var(--accent); background: rgba(34, 211, 238, 0.12); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.25); }
.bdg.concept { color: #a78bfa; background: rgba(167, 139, 250, 0.14); box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.3); }

/* ===== 图表区 ===== */
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.chart-title { font-size: 15px; font-weight: 650; color: #fff; letter-spacing: 0.3px; }
.chart-title .badge {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 9px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: 1px;
}
.badge.board { background: rgba(34, 211, 238, 0.12); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.25); }
.badge.stock { background: rgba(240, 185, 11, 0.12); color: #f0b90b; box-shadow: inset 0 0 0 1px rgba(240, 185, 11, 0.25); }
.badge.etf { background: rgba(14, 203, 129, 0.12); color: var(--green); box-shadow: inset 0 0 0 1px rgba(14, 203, 129, 0.25); }

.chart-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.period-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: rgba(7, 9, 13, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ptab {
  padding: 4px 14px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.ptab:hover { color: var(--text); }
.ptab.active {
  background: var(--grad);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 12px rgba(34, 211, 238, 0.35);
}

.ma-toggles { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ma-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}
.ma-toggles label:hover { color: var(--text); }
.ma-toggles input { accent-color: var(--accent); }

.chart { width: 100%; height: 580px; }
.chart-loading { opacity: 0.4; pointer-events: none; }

.status {
  display: flex;
  align-items: center;
  padding: 6px 4px 2px;
  color: var(--text-dim);
  font-size: 12px;
  min-height: 20px;
}
.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
  margin-right: 7px;
}
.status.error { color: var(--red); }
.status.error::before { background: var(--red); }

/* ===== 成分股 / 相关ETF ===== */
.table-area { display: flex; flex-direction: column; }

.table-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  width: max-content;
  margin-top: 10px;
  background: rgba(7, 9, 13, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ttab {
  padding: 4px 18px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.ttab:hover { color: var(--text); }
.ttab.active {
  background: var(--grad);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 12px rgba(34, 211, 238, 0.35);
}

.cons-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0 6px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.4px;
}
.cons-count { color: var(--text-dim); font-weight: 400; font-size: 12px; }

.cons-table-wrap {
  overflow: auto;
  max-height: 300px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(7, 9, 13, 0.25);
}
.cons-table { min-width: 940px; }
.cons-table thead th { top: 0; font-size: 11px; padding: 8px 6px; }
.cons-table tbody td { font-size: 12px; padding: 6px; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.22); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.4); }
::-webkit-scrollbar-track { background: transparent; }

/* ===== 响应式 ===== */
@media (max-width: 960px) {
  .layout { flex-direction: column; }
  .board-panel { width: 100%; max-height: 420px; }
  .chart { height: 420px; }
  .refresh-note { display: none; }
  .stock-search { width: 100%; }
  .topbar-right { width: 100%; }
}
