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

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a1f2e;
  --bg-elevated: #222838;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0b0;
  --text-muted: #6b7280;
  --accent: #ffab40;
  --accent2: #448aff;
  --up: #00e676;
  --down: #ff5252;
  --border: #2a3040;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }

/* === Navigation === */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(10, 14, 23, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s;
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 60px;
}
.nav-logo { font-size: 1.3rem; font-weight: 700; color: #fff; }
.nav-logo span { color: var(--accent); margin-left: 2px; }
.nav-links { display: flex; gap: 28px; }
.nav-links a { color: var(--text-secondary); font-size: 0.92rem; transition: color 0.2s; }
.nav-links a:hover { color: var(--accent); }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav.open .nav-links {
    display: flex; flex-direction: column;
    position: absolute; top: 60px; left: 0; right: 0;
    background: var(--bg-secondary); padding: 16px 24px; gap: 16px;
    border-bottom: 1px solid var(--border);
  }
}

/* === Hero === */
.hero {
  position: relative; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 80px 24px 40px;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 171, 64, 0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(68, 138, 255, 0.05) 0%, transparent 50%);
}
.hero-content { position: relative; z-index: 1; }
.hero-title { font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 800; color: #fff; line-height: 1.2; }
.hero-title span { display: block; color: var(--accent); }
.hero-sub {
  margin-top: 16px; font-size: 1.15rem; color: var(--text-secondary);
  letter-spacing: 0.5px;
}
.hero-metrics {
  display: flex; gap: 20px; margin-top: 48px;
  justify-content: center; flex-wrap: wrap;
}
.metric-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 32px;
  min-width: 160px; backdrop-filter: blur(4px);
}
.metric-value { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.metric-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

.scroll-hint {
  position: absolute; bottom: 30px; color: var(--text-muted);
  font-size: 0.85rem; animation: bounce 2s infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(8px); opacity: 1; }
}

/* === Sections === */
.section { max-width: 1280px; margin: 0 auto; padding: 80px 24px; }
.section-alt { background: var(--bg-secondary); max-width: 100%; }
.section-alt .section-header { max-width: 1280px; margin: 0 auto 40px; }
.section-alt .holdings-grid,
.section-alt .about-content { max-width: 1280px; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 40px; }
.section-header h2 { font-size: 2rem; font-weight: 700; color: #fff; }
.section-header p { color: var(--text-muted); margin-top: 8px; font-size: 0.9rem; }

/* === Performance Stats === */
.perf-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 32px;
}
.stat-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1.15rem; font-weight: 700; color: #fff; }
.stat-value.up { color: var(--up); }
.stat-value.down { color: var(--down); }

/* === Chart Containers === */
.chart-container {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.chart-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.chart-header h3 { font-size: 1rem; font-weight: 600; color: #fff; }
.chart-legend { display: flex; gap: 16px; }
.legend-item { font-size: 0.82rem; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.legend-item i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; }
.chart-box { width: 100%; height: 420px; }

.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 768px) { .grid-2col { grid-template-columns: 1fr; } }

/* === Holdings === */
.holdings-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px;
}
.holding-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; justify-content: space-between; align-items: center;
  transition: border-color 0.2s;
}
.holding-card:hover { border-color: var(--accent2); }
.holding-info { display: flex; flex-direction: column; gap: 4px; }
.holding-code { font-size: 0.78rem; color: var(--accent2); font-weight: 600; letter-spacing: 0.5px; }
.holding-name { font-size: 1.05rem; font-weight: 600; color: #fff; }
.holding-entry { font-size: 0.78rem; color: var(--text-muted); }
.holding-pnl { text-align: right; display: flex; flex-direction: column; gap: 4px; }
.holding-price { font-size: 1.1rem; font-weight: 700; color: #fff; }
.holding-ret { font-size: 1rem; font-weight: 700; }
.holding-ret.up { color: var(--up); }
.holding-ret.down { color: var(--down); }
.holding-shares { font-size: 0.75rem; color: var(--text-muted); }

/* === Trading Controls === */
.trading-controls {
  display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center;
}
.trading-controls input,
.trading-controls select {
  padding: 8px 14px; background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.9rem;
}
.trading-controls input:focus,
.trading-controls select:focus { outline: none; border-color: var(--accent2); }
.trading-controls input { min-width: 180px; }
.trading-controls button {
  padding: 8px 16px; background: var(--bg-elevated); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
  font-size: 0.85rem; transition: all 0.2s;
}
.trading-controls button:hover { background: #2a3550; color: #fff; }

/* === Trade Summary Bar === */
.trade-summary {
  display: flex; gap: 20px; padding: 12px 18px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 16px; flex-wrap: wrap;
  font-size: 0.9rem;
}
.trade-summary span { color: var(--text-secondary); }
.trade-summary b { color: #fff; }
.trade-summary .up { color: var(--up); }
.trade-summary .down { color: var(--down); }

/* === Trade Day Items === */
.trade-list { display: flex; flex-direction: column; gap: 10px; }

.day-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color 0.2s;
}
.day-card:hover { border-color: #3a4560; }

.day-card-header {
  display: flex; align-items: center; gap: 16px; padding: 14px 18px;
  cursor: pointer; user-select: none;
  transition: background 0.15s;
}
.day-card-header:hover { background: rgba(255,255,255,0.02); }

.day-date {
  font-weight: 700; font-size: 1rem; color: var(--accent); min-width: 95px;
  font-variant-numeric: tabular-nums;
}

.day-hs { font-size: 0.82rem; color: var(--text-muted); min-width: 140px; }

.day-stats {
  margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 0.85rem;
}
.day-stats .badge {
  padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 600;
}
.badge-open { background: rgba(0,230,118,0.12); color: var(--up); }
.badge-close { background: rgba(255,82,82,0.12); color: var(--down); }
.badge-hold { background: rgba(68,138,255,0.12); color: var(--accent2); }

.day-ret { font-weight: 700; font-size: 0.9rem; }
.day-ret.up { color: var(--up); }
.day-ret.down { color: var(--down); }

.day-expand { color: var(--text-muted); font-size: 0.8rem; transition: transform 0.2s; }
.day-card.open .day-expand { transform: rotate(180deg); }

.day-card-body { display: none; padding: 0 18px 16px; border-top: 1px solid var(--border); }
.day-card.open .day-card-body { display: block; }

.trade-group { margin-top: 12px; }
.trade-group-title { font-size: 0.8rem; font-weight: 700; margin-bottom: 6px; letter-spacing: 0.5px; }
.trade-group-title.hold { color: var(--accent2); }
.trade-group-title.open { color: var(--up); }
.trade-group-title.close { color: var(--down); }

.trade-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.trade-table th {
  text-align: left; padding: 6px 10px; color: var(--text-muted);
  font-weight: 500; font-size: 0.78rem; border-bottom: 1px solid var(--border);
}
.trade-table td { padding: 7px 10px; border-bottom: 1px solid rgba(42,48,64,0.5); }
.trade-table .code { color: var(--accent2); font-weight: 600; cursor: pointer; }
.trade-table .code:hover { text-decoration: underline; }
.trade-table .pnl.up { color: var(--up); }
.trade-table .pnl.down { color: var(--down); }

/* === Pagination === */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 20px 0; align-items: center; flex-wrap: wrap; }
.pagination button {
  padding: 6px 14px; background: var(--bg-card); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
  font-size: 0.85rem; transition: all 0.15s;
}
.pagination button:hover:not(:disabled) { background: #2a3550; color: #fff; }
.pagination button.active { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination .page-info { color: var(--text-muted); font-size: 0.82rem; margin-left: 8px; }

/* === About === */
.about-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.about-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.about-card h3 { font-size: 1.1rem; color: var(--accent); margin-bottom: 12px; }
.about-card p { color: var(--text-secondary); font-size: 0.92rem; line-height: 1.8; }

/* === Footer === */
.footer { background: var(--bg-secondary); border-top: 1px solid var(--border); padding: 40px 24px 20px; }
.footer-content {
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 2fr; gap: 40px;
}
.footer-brand h3 { font-size: 1.2rem; color: #fff; }
.footer-brand p { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }
.footer-disclaimer p { color: var(--text-muted); font-size: 0.8rem; line-height: 1.7; margin-bottom: 8px; }
.footer-bottom { max-width: 1280px; margin: 20px auto 0; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; }
.footer-bottom p { color: var(--text-muted); font-size: 0.78rem; }

@media (max-width: 768px) {
  .footer-content { grid-template-columns: 1fr; gap: 20px; }
}

/* === Modal === */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; align-items: center; justify-content: center; }
.modal-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); width: 90vw; max-width: 1100px; max-height: 85vh;
  overflow: hidden; display: flex; flex-direction: column;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  font-size: 0.95rem; color: #fff;
}
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.6rem; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: #fff; }
.modal-body { padding: 16px; flex: 1; overflow: auto; }
.modal-footer { padding: 10px 20px; border-top: 1px solid var(--border); text-align: center; }
.modal-hint { font-size: 0.78rem; color: var(--text-muted); }

/* === Responsive utilities === */
@media (max-width: 768px) {
  .hero-metrics { gap: 10px; }
  .metric-card { min-width: 130px; padding: 14px 18px; }
  .metric-value { font-size: 1.4rem; }
  .chart-box { height: 300px; }
  .day-card-header { flex-wrap: wrap; gap: 8px; }
  .day-stats { margin-left: 0; }
}

/* === Monthly return table === */
.monthly-table-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; margin-top: 12px; margin-bottom: 16px;
}
.monthly-table-wrap h4 { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 8px; }
.monthly-table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.monthly-table-wrap td { padding: 4px 10px; }
.monthly-table-wrap td:first-child { color: var(--text-muted); }
.monthly-table-wrap td:last-child { text-align: right; font-weight: 600; }
.monthly-table-wrap .up { color: var(--up); }
.monthly-table-wrap .down { color: var(--down); }
