/* ============================================================
   零售店销售数据分析平台 — 丰富多彩色主题
   多页面布局 · 渐变色调 · 动画效果 · 响应式适配
   ============================================================ */

/* =========== 变量 & 重置 =========== */
:root {
  /* 主色调 */
  --purple: #7c3aed;
  --purple-light: #a78bfa;
  --blue: #3b82f6;
  --cyan: #06b6d4;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --pink: #ec4899;
  --rose: #f43f5e;
  --indigo: #6366f1;
  --teal: #14b8a6;
  --amber: #f59e0b;

  /* 渐变 */
  --grad-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --grad-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --grad-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --grad-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  --grad-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  --grad-6: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
  --grad-hero: linear-gradient(135deg, #1a1a2e 0%, #16213e 40%, #0f3460 100%);
  --grad-dark: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);

  --bg: #0a0a1a;
  --bg-card: rgba(255,255,255,0.05);
  --bg-card-hover: rgba(255,255,255,0.10);
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --border: rgba(255,255,255,0.08);
  --shadow: 0 8px 32px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* =========== 粒子背景 =========== */
#particleCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* 确保除首页外，section.page 在粒子层之上 */
.page {
  position: relative;
  z-index: 1;
}

/* 导航栏保持在最上层 */
.navbar { z-index: 1000; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0a0a1a; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--purple), var(--pink)); border-radius: 3px; }

/* =========== 导航栏 =========== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 0 20px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(10, 10, 26, 0.85);
  border-bottom: 1px solid rgba(124, 58, 237, 0.2);
  transition: all 0.3s;
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--grad-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-text { font-weight: 800; letter-spacing: -0.5px; }

.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.3s;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.nav-active {
  color: #fff;
  background: rgba(124, 58, 237, 0.2);
}

.nav-toggle {
  display: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #fff;
}

/* =========== 页面通用样式 =========== */
.page {
  min-height: 100vh;
  padding: 100px 20px 80px;
}

.page-dark {
  background: linear-gradient(180deg, #0a0a1a 0%, #0f0c29 50%, #1a1a2e 100%);
}

.page-title {
  font-size: 2.2rem;
  text-align: center;
  margin-bottom: 12px;
  background: var(--grad-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  text-align: center;
  color: var(--text-dim);
  max-width: 600px;
  margin: 0 auto 50px;
  font-size: 1.05rem;
}

.title-icon { font-size: 1.8rem; }

/* =========== Hero / 首页 =========== */
.page-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  padding-top: 80px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(124,58,237,0.15), transparent),
    radial-gradient(ellipse 60% 50% at 80% 60%, rgba(236,72,153,0.12), transparent),
    radial-gradient(ellipse 50% 40% at 50% 80%, rgba(59,130,246,0.10), transparent),
    var(--grad-hero);
  z-index: 0;
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.01) 2px, rgba(255,255,255,0.01) 4px);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
  padding: 20px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 20px;
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(124,58,237,0.3);
  color: var(--purple-light);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 24px;
}

.hero-line {
  display: block;
  color: #fff;
}

.hero-line.highlight {
  background: var(--grad-2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-dim);
  line-height: 1.8;
  margin-bottom: 40px;
}

.hero-desc strong {
  color: var(--cyan);
}

/* 首页统计数字 */
.hero-stats-row {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat-num {
  font-size: 2.2rem;
  font-weight: 800;
  background: var(--grad-3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-stat-label {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-glow {
  display: inline-block;
  padding: 14px 36px;
  border-radius: 12px;
  background: var(--grad-1);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
  transition: all 0.3s;
}

.btn-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(124,58,237,0.6);
}

.btn-outline {
  display: inline-block;
  padding: 14px 36px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.2);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  transition: all 0.3s;
}

.btn-outline:hover {
  border-color: rgba(124,58,237,0.5);
  background: rgba(124,58,237,0.1);
}

.scroll-hint {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  animation: float 2s ease-in-out infinite;
  z-index: 1;
}

.scroll-arrow { font-size: 1.5rem; margin-top: 4px; }

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* =========== 统计卡片 =========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto 40px;
  padding: 0 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 16px;
  text-align: center;
  transition: all 0.3s;
  backdrop-filter: blur(10px);
  min-width: 0;
  overflow-wrap: break-word;
}

.stat-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.3);
}

.stat-card:nth-child(1):hover { border-color: rgba(124, 58, 237, 0.4); box-shadow: 0 12px 40px rgba(124, 58, 237, 0.2); }
.stat-card:nth-child(2):hover { border-color: rgba(59, 130, 246, 0.4); box-shadow: 0 12px 40px rgba(59, 130, 246, 0.2); }
.stat-card:nth-child(3):hover { border-color: rgba(16, 185, 129, 0.4); box-shadow: 0 12px 40px rgba(16, 185, 129, 0.2); }
.stat-card:nth-child(4):hover { border-color: rgba(245, 158, 11, 0.4); box-shadow: 0 12px 40px rgba(245, 158, 11, 0.2); }
.stat-card:nth-child(5):hover { border-color: rgba(236, 72, 153, 0.4); box-shadow: 0 12px 40px rgba(236, 72, 153, 0.2); }
.stat-card:nth-child(6):hover { border-color: rgba(239, 68, 68, 0.4); box-shadow: 0 12px 40px rgba(239, 68, 68, 0.2); }

.stat-icon { font-size: 2rem; margin-bottom: 8px; }
.stat-value { font-size: 1.4rem; font-weight: 700; color: #fff; overflow-wrap: break-word; word-break: keep-all; }
.stat-label { font-size: 0.85rem; color: var(--text-dim); margin-top: 4px; }

/* =========== KPI 卡片 =========== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto 40px;
  padding: 0 20px;
}

.kpi-card {
  padding: 20px 16px;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.3s;
  min-width: 0;
  overflow-wrap: break-word;
}

.kpi-card:hover { transform: translateY(-2px); }

.kpi-accent1 { border-left: 4px solid var(--purple); }
.kpi-accent2 { border-left: 4px solid var(--cyan); }
.kpi-accent3 { border-left: 4px solid var(--red); }
.kpi-accent4 { border-left: 4px solid var(--orange); }

.kpi-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.kpi-icon { font-size: 1.3rem; }
.kpi-title { font-size: 0.9rem; color: var(--text-dim); }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: #fff; overflow-wrap: break-word; word-break: keep-all; }
.kpi-trend { font-size: 0.85rem; color: var(--text-dim); margin-top: 4px; }
.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }

/* =========== 概览图表 =========== */
.overview-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.overview-chart-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.overview-chart-box h3 {
  font-size: 1.05rem;
  margin-bottom: 12px;
  color: #fff;
}

.overview-chart-box canvas {
  max-height: 280px;
}

/* =========== 图表标签切换 =========== */
.chart-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1000px;
  margin: 0 auto 24px;
  padding: 0 20px;
}

.chart-tab {
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.chart-tab:hover {
  border-color: rgba(124, 58, 237, 0.3);
  background: rgba(124, 58, 237, 0.1);
  color: #fff;
}

.chart-tab.active {
  background: var(--grad-1);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

/* =========== 主图表容器 =========== */
.chart-main-container {
  max-width: 1000px;
  margin: 0 auto 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  height: 420px;
}

.chart-insight {
  max-width: 1000px;
  margin: 0 auto 30px;
  padding: 12px 20px;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 10px;
  color: var(--purple-light);
  font-size: 0.9rem;
  text-align: center;
}

/* =========== 附加图表行 =========== */
.chart-extra-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.chart-extra-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.chart-extra-box h3 {
  font-size: 1rem;
  color: #fff;
  margin-bottom: 12px;
  text-align: center;
}

.chart-extra-box canvas {
  max-height: 300px;
}

/* =========== 多维关系网格 =========== */
.relation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.relation-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s;
}

.relation-card:hover {
  border-color: rgba(124, 58, 237, 0.2);
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.relation-card h3 {
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 12px;
  text-align: center;
}

.relation-card canvas {
  max-height: 280px;
}

.relation-note {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(124, 58, 237, 0.08);
  border-radius: 8px;
}

/* =========== 工具栏 =========== */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto 16px;
  padding: 0 20px;
}

.tb-left, .tb-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 0.9rem;
  width: 260px;
  outline: none;
  transition: all 0.3s;
}

.search-box:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.search-box::placeholder { color: var(--text-dim); }

.filter-select {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: all 0.3s;
}

.filter-select:focus {
  border-color: var(--purple);
}

/* 下拉选项深色样式，避免白底遮挡 */
.filter-select option,
.filter-select optgroup {
  background: #1a1a2e;
  color: #fff;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.page-info {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.pg-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-btn:hover:not(:disabled) {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--purple);
}

.pg-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.result-count {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* =========== 表格 =========== */
.table-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

#dataTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 1000px;
}

#dataTable thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

#dataTable th {
  padding: 14px 10px;
  text-align: left;
  background: rgba(124, 58, 237, 0.15);
  color: var(--purple-light);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid rgba(124, 58, 237, 0.2);
  transition: background 0.2s;
  font-size: 0.82rem;
}

#dataTable th:hover {
  background: rgba(124, 58, 237, 0.25);
}

#dataTable td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#dataTable tbody tr {
  transition: background 0.2s;
}

#dataTable tbody tr:hover {
  background: rgba(124, 58, 237, 0.08);
}

#dataTable tbody tr.high-return {
  border-left: 3px solid var(--red);
  background: rgba(239, 68, 68, 0.06);
}

#dataTable tbody tr.high-return:hover {
  background: rgba(239, 68, 68, 0.12);
}

/* =========== 关于页面 =========== */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto 40px;
  padding: 0 20px;
}

.about-card {
  padding: 28px 24px;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.about-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.about-card-icon { font-size: 2rem; margin-bottom: 12px; }

.about-card h3 {
  font-size: 1.15rem;
  margin-bottom: 12px;
}

.about-card.accent-purple h3 { color: var(--purple-light); }
.about-card.accent-purple:hover { border-color: rgba(124,58,237,0.4); }
.about-card.accent-blue h3 { color: #60a5fa; }
.about-card.accent-blue:hover { border-color: rgba(59,130,246,0.4); }
.about-card.accent-green h3 { color: #34d399; }
.about-card.accent-green:hover { border-color: rgba(16,185,129,0.4); }
.about-card.accent-orange h3 { color: #fbbf24; }
.about-card.accent-orange:hover { border-color: rgba(245,158,11,0.4); }

.about-card p, .about-card li {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.7;
}

.about-card ul { padding-left: 16px; }
.about-card li { margin-bottom: 4px; }

.teacher-info {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px;
}

.teacher-info h3 {
  text-align: center;
  margin-bottom: 16px;
  font-size: 1.2rem;
  color: #fff;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
}

.info-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.info-table td:first-child {
  color: var(--text-dim);
  width: 120px;
  font-weight: 600;
}

.info-table td:last-child {
  color: #fff;
}

/* =========== 页脚 =========== */
.footer {
  background: #060612;
  border-top: 1px solid rgba(124, 58, 237, 0.15);
  padding: 50px 20px 24px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
  max-width: 1100px;
  margin: 0 auto 30px;
}

.footer-col h3 {
  color: #fff;
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.footer-col p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.8;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* =========== 动画 =========== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.page { animation: fadeInUp 0.6s ease-out; }

/* 数字跳动动画 */
@keyframes numberGrow {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* =========== 响应式 =========== */
@media (max-width: 1024px) {
  .hero-title { font-size: 2.5rem; }
  .hero-stats-row { gap: 24px; }
  .hero-stat-num { font-size: 1.6rem; }
  .overview-charts { grid-template-columns: 1fr; }
  .chart-extra-row { grid-template-columns: 1fr; }
  .relation-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(10, 10, 26, 0.98);
    padding: 16px;
    border-bottom: 1px solid var(--border);
  }
  .nav-toggle { display: block; }
  .hero-title { font-size: 2rem; }
  .hero-stats-row { gap: 16px; flex-direction: column; align-items: center; }
  .hero-desc { font-size: 0.95rem; }
  .table-toolbar { flex-direction: column; align-items: flex-start; }
  .tb-left, .tb-right { width: 100%; }
  .search-box { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-row { grid-template-columns: 1fr; }
  .chart-main-container { height: 320px; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 1.7rem; }
  .btn-glow, .btn-outline { width: 100%; text-align: center; }
  .stats-grid { grid-template-columns: 1fr; }
  .chart-tabs { flex-direction: column; }
  .chart-tab { width: 100%; text-align: center; }
}
