/* SVTR Explore 探索页 — 交互式可视化分析 */

:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #3b82f6;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

body {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ---- 顶部导航（与 database 一致） ---- */
.top-nav {
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
}

/* 覆盖 header-enhancements.css 的 position:fixed，让图标留在 flex 布局中 */
.top-nav .header-actions {
  position: static;
  z-index: auto;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary-light);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary-color);
}

/* ---- 主容器 ---- */
.explore-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* ---- Hero 区 ---- */
.explore-hero {
  text-align: center;
  padding: 3rem 1rem 1.5rem;
}

.explore-hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--primary-light), #a78bfa, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.explore-hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

/* ---- 进度条 ---- */
.explore-progress {
  max-width: 500px;
  margin: 0 auto 2rem;
  display: none;
}

.explore-progress.visible {
  display: block;
}

.progress-bar-outer {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  height: 8px;
  overflow: hidden;
}

.progress-bar-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-color), #a78bfa, #f472b6);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5rem;
}

/* ---- 图表卡片 ---- */
.chart-cards {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 3rem;
}

.chart-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: border-color 0.3s;
}

.chart-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.chart-title {
  font-size: 1.125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chart-title-icon {
  font-size: 1.25rem;
}

.chart-toggle {
  display: flex;
  gap: 0.25rem;
  background: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius-md);
  padding: 0.25rem;
}

.chart-toggle-btn {
  padding: 0.375rem 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.chart-toggle-btn.active {
  background: var(--primary-color);
  color: white;
}

.chart-toggle-btn:hover:not(.active) {
  color: var(--text-primary);
}

.chart-body {
  padding: 1rem 1rem 1.5rem;
  position: relative;
  min-height: 400px;
}

.chart-body-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem 1rem 1.5rem;
  min-height: 400px;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.chart-loading .loading-spinner {
  width: 32px;
  height: 32px;
  margin-bottom: 0.75rem;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ---- 底部 ---- */
.explore-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.explore-footer p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.explore-footer a {
  color: var(--primary-light);
  text-decoration: none;
}

.explore-footer a:hover {
  text-decoration: underline;
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
  .explore-container {
    padding: 1rem;
  }

  .nav-container {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: space-around;
  }

  .explore-hero-title {
    font-size: 1.75rem;
  }

  .chart-body {
    min-height: 300px;
  }

  .chart-body-dual {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .chart-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
}

/* ---- Loading spinner ---- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
