/* ══════════════════════════════════════════════════
   Daily Stock Analysis — 全局样式
   深色金融科技风格 + Glassmorphism
   ══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS 变量 ── */
:root {
  --bg-primary: #0a0a14;
  --bg-secondary: #10101e;
  --bg-card: #14142a;
  --bg-card-hover: #1a1a36;
  --bg-elevated: #1e1e3a;
  --bg-glass: rgba(20, 20, 42, 0.7);

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;

  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-glow: rgba(99, 102, 241, 0.3);

  --green: #00c853;
  --green-bg: rgba(0, 200, 83, 0.1);
  --red: #ff5252;
  --red-bg: rgba(255, 82, 82, 0.1);
  --gold: #ffd700;
  --gold-bg: rgba(255, 215, 0, 0.1);
  --blue: #2196f3;
  --blue-bg: rgba(33, 150, 243, 0.1);

  --border: #1e1e36;
  --border-hover: #2a2a4a;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
}

/* ── ☀️ 明亮主题 (Light Theme) ── */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-elevated: #e2e8f0;
  --bg-glass: rgba(255, 255, 255, 0.88);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --accent-primary: #4f46e5;
  --accent-secondary: #7c3aed;
  --accent-glow: rgba(79, 70, 229, 0.15);

  --green: #16a34a;
  --green-bg: rgba(22, 163, 74, 0.1);
  --red: #dc2626;
  --red-bg: rgba(220, 38, 38, 0.1);
  --gold: #d97706;
  --gold-bg: rgba(217, 119, 6, 0.1);
  --blue: #2563eb;
  --blue-bg: rgba(37, 99, 235, 0.1);

  --border: #e2e8f0;
  --border-hover: #cbd5e1;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 16px rgba(79, 70, 229, 0.12);
}

/* ── Chrome 自动填充输入框样式修复 ── */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-secondary) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  caret-color: var(--text-primary) !important;
  border-color: var(--border) !important;
  transition: background-color 5000s ease-in-out 0s;
}

[data-theme="light"] body::before,
[data-theme="light"] body::after {
  opacity: 0.3;
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 背景装饰 */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -30%;
  left: -30%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle at center, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent-secondary); }

/* ══════════════════════════════════════════════════
   布局
   ══════════════════════════════════════════════════ */

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── 顶部导航 ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.navbar-brand .logo-icon {
  font-size: 24px;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.navbar-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.navbar-nav a.active {
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
}

/* ── 市场概览条 ── */
.market-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  overflow: hidden;
}

.market-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 32px;
  animation: marquee 30s linear infinite;
}

.market-item {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 13px;
}

.market-item .name {
  color: var(--text-muted);
  font-weight: 500;
}

.market-item .value {
  color: var(--text-primary);
  font-weight: 600;
}

.market-item .change {
  font-weight: 600;
  font-size: 12px;
}

.market-item .change.up { color: var(--green); }
.market-item .change.down { color: var(--red); }

/* ── 主内容 ── */
.main-content {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  width: 100%;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 6px;
}

/* ══════════════════════════════════════════════════
   卡片组件
   ══════════════════════════════════════════════════ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ── 推荐卡片 ── */
.rec-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  cursor: pointer;
}

.rec-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.rec-card .rank {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.rec-card .rank.top { 
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #000;
}

.rec-card .stock-info {
  min-width: 0;
}

.rec-card .stock-symbol {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.rec-card .stock-name {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.rec-card .stock-market {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  margin-top: 4px;
}

.rec-card .stock-reason {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.5;
}

.rec-card .score-section {
  text-align: center;
}

/* ── 评分环 ── */
.score-ring {
  position: relative;
  width: 64px;
  height: 64px;
}

.score-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-ring .ring-bg {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 4;
}

.score-ring .ring-fill {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 175.93;
  stroke-dashoffset: 175.93;
  transition: stroke-dashoffset 1s ease;
}

.score-ring .score-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
}

.score-gold { --score-color: var(--gold); }
.score-green { --score-color: var(--green); }
.score-blue { --score-color: var(--blue); }
.score-gray { --score-color: var(--text-muted); }

.score-ring .ring-fill { stroke: var(--score-color); }
.score-ring .score-value { color: var(--score-color); }

/* ══════════════════════════════════════════════════
   数据网格
   ══════════════════════════════════════════════════ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

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

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.stat-card .stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 4px;
}

.stat-card .stat-change {
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}

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

/* ══════════════════════════════════════════════════
   新闻列表
   ══════════════════════════════════════════════════ */

.news-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-item {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.news-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.news-item .sentiment-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.news-item .sentiment-dot.positive { background: var(--green); box-shadow: 0 0 8px var(--green); }
.news-item .sentiment-dot.negative { background: var(--red); box-shadow: 0 0 8px var(--red); }
.news-item .sentiment-dot.neutral { background: var(--text-muted); }

.news-item .news-content { flex: 1; min-width: 0; }

.news-item .news-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
}

.news-item .news-meta {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.news-item .news-source {
  padding: 1px 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* ══════════════════════════════════════════════════
   表格
   ══════════════════════════════════════════════════ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}

.data-table tr:hover td {
  background: var(--bg-card-hover);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* ══════════════════════════════════════════════════
   表单控件
   ══════════════════════════════════════════════════ */

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
  color: var(--text-dim);
}

/* 复选框组 */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-chip:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.checkbox-chip.active,
.checkbox-chip:has(input:checked) {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.checkbox-chip input[type="checkbox"] {
  display: none;
}

/* 单选按钮组 */
.radio-group {
  display: flex;
  gap: 8px;
}

.radio-pill {
  padding: 8px 20px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 14px;
  color: var(--text-secondary);
  user-select: none;
}

.radio-pill:hover {
  border-color: var(--accent-primary);
}

.radio-pill.active,
.radio-pill:has(input:checked) {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  font-weight: 600;
}

.radio-pill input[type="radio"] {
  display: none;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════
   标签页
   ══════════════════════════════════════════════════ */

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: none;
  background: transparent;
  font-family: inherit;
}

.tab:hover { color: var(--text-primary); }
.tab.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════
   空状态 & 加载
   ══════════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state .title { font-size: 18px; font-weight: 600; color: var(--text-secondary); }
.empty-state .desc { font-size: 14px; margin-top: 8px; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════════
   Toast 通知
   ══════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast.success { background: var(--green); color: #000; }
.toast.error { background: var(--red); color: #fff; }
.toast.info { background: var(--accent-primary); color: #fff; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ══════════════════════════════════════════════════
   滚动条
   ══════════════════════════════════════════════════ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ══════════════════════════════════════════════════
   动画
   ══════════════════════════════════════════════════ */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.4s ease forwards;
}

.animate-delay-1 { animation-delay: 0.05s; }
.animate-delay-2 { animation-delay: 0.1s; }
.animate-delay-3 { animation-delay: 0.15s; }
.animate-delay-4 { animation-delay: 0.2s; }
.animate-delay-5 { animation-delay: 0.25s; }

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.count-up { animation: countUp 0.6s ease forwards; }

/* ══════════════════════════════════════════════════
   响应式
   ══════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .navbar-inner { padding: 0 12px; }
  .navbar-nav { gap: 0; }
  .navbar-nav a { padding: 6px 10px; font-size: 13px; }
  .navbar-nav a span.nav-text { display: none; }

  .main-content { padding: 20px 16px; }
  .page-header h1 { font-size: 22px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .rec-card {
    grid-template-columns: auto 1fr;
    gap: 12px;
  }
  .rec-card .score-section {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .market-bar-inner { gap: 20px; }

  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .radio-group { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .navbar-brand .brand-text { display: none; }
}

/* ── 辅助类 ── */
.text-green { color: var(--green) !important; }
.text-red { color: var(--red) !important; }
.text-gold { color: var(--gold) !important; }
.text-blue { color: var(--blue) !important; }
.text-muted { color: var(--text-muted) !important; }
.fw-bold { font-weight: 700 !important; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hidden { display: none !important; }
