/* ── 色彩變數（延續 NQ_Dashboard 暗色風格）── */
:root {
  --bg-primary: #0f1117;
  --bg-card: #1a1d2e;
  --bg-card2: #151929;
  --border: #2a2d3e;
  --text-primary: #e2e8f0;
  --text-muted: #718096;
  --text-dim: #4a5568;
  --accent-blue: #4299e1;
  --accent-blue-glow: rgba(66, 153, 225, 0.15);
  --accent-gold: #f6c90e;
  --accent-gold-glow: rgba(246, 201, 14, 0.15);
  --bull: #e53e3e;       /* 台灣習慣：紅=漲 */
  --bear: #48bb78;       /* 綠=跌 */
  --neutral: #a0aec0;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang TC', 'Noto Sans TC', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}
a { color: var(--accent-blue); text-decoration: none; }
a:hover { color: #63b3ed; }
img { max-width: 100%; display: block; }

/* ── 導覽列 ── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.nav-brand {
  font-size: 1.1rem; font-weight: 700;
  color: var(--accent-gold);
  display: flex; align-items: center; gap: 8px;
}
.nav-brand span { font-size: 1.3rem; }
.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-links a {
  padding: 6px 14px; border-radius: 8px;
  color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
  transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--bg-card); color: var(--text-primary);
}
.nav-cta {
  background: var(--accent-gold) !important;
  color: #1a1a1a !important; font-weight: 700 !important;
  padding: 6px 18px !important; border-radius: 20px !important;
}
.nav-cta:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── 主內容區 ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
main { padding: 2.5rem 0 4rem; }

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 5rem 1.5rem 3.5rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(66,153,225,0.08) 0%, transparent 70%);
}
.hero-badge {
  display: inline-block;
  padding: 4px 16px; border-radius: 20px;
  background: var(--accent-gold-glow); border: 1px solid rgba(246,201,14,0.3);
  color: var(--accent-gold); font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.05em; margin-bottom: 1.5rem;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800; letter-spacing: -0.02em;
  line-height: 1.2; margin-bottom: 1rem;
}
.hero h1 .highlight { color: var(--accent-gold); }
.hero p {
  font-size: 1.1rem; color: var(--text-muted);
  max-width: 560px; margin: 0 auto 2rem;
}
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 28px; border-radius: 10px; font-weight: 600; font-size: 0.95rem;
  cursor: pointer; transition: all 0.2s; border: none;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent-blue); color: #fff;
}
.btn-primary:hover { background: #3182ce; color: #fff; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(66,153,225,0.3); }
.btn-secondary {
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent-blue); color: var(--accent-blue); transform: translateY(-2px); }
.btn-gold {
  background: var(--accent-gold); color: #1a1a1a;
}
.btn-gold:hover { opacity: 0.9; transform: translateY(-2px); }

/* ── 卡片 ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

/* ── 區塊標題 ── */
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.section-title {
  font-size: 1.3rem; font-weight: 700;
}
.section-title .icon { margin-right: 8px; }
.section-link { font-size: 0.85rem; color: var(--text-muted); }
.section-link:hover { color: var(--accent-blue); }

/* ── 文章/教學列表卡片 ── */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.article-card { cursor: pointer; }
.article-card:hover { text-decoration: none; }
.article-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem;
}
.tag {
  display: inline-block; padding: 2px 10px;
  background: var(--accent-blue-glow); color: var(--accent-blue);
  border: 1px solid rgba(66,153,225,0.3); border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}
.tag.gold {
  background: var(--accent-gold-glow); color: var(--accent-gold);
  border-color: rgba(246,201,14,0.3);
}
.article-card h3 {
  font-size: 1.05rem; font-weight: 700; margin-bottom: 0.5rem;
  color: var(--text-primary);
}
.article-card p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.6; }

/* ── 文章內頁 ── */
.article-body { max-width: 720px; margin: 0 auto; }
.article-header { margin-bottom: 2.5rem; }
.article-header h1 { font-size: 2rem; font-weight: 800; line-height: 1.3; margin-bottom: 0.75rem; }
.prose h2 { font-size: 1.4rem; font-weight: 700; margin: 2rem 0 1rem; color: var(--text-primary); }
.prose h3 { font-size: 1.15rem; font-weight: 600; margin: 1.5rem 0 0.75rem; color: var(--accent-blue); }
.prose p { margin-bottom: 1.2rem; color: var(--text-primary); }
.prose ul, .prose ol { margin: 1rem 0 1.2rem 1.5rem; }
.prose li { margin-bottom: 0.4rem; }
.prose code {
  background: var(--bg-card2); color: var(--accent-gold);
  padding: 2px 8px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 0.88em;
}
.prose pre {
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: 8px; padding: 1.25rem; overflow-x: auto; margin: 1.5rem 0;
}
.prose pre code { background: none; padding: 0; }
.prose blockquote {
  border-left: 3px solid var(--accent-gold);
  padding: 0.75rem 1.25rem; margin: 1.5rem 0;
  background: var(--bg-card2); border-radius: 0 8px 8px 0;
  color: var(--text-muted);
}
.prose table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.6rem 1rem; text-align: left; }
.prose th { background: var(--bg-card2); font-weight: 600; }

/* ── 戰情室 ── */
.warroom-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 2rem;
}
.warroom-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; border-radius: 8px; font-weight: 700; font-size: 0.85rem;
}
.badge-live {
  background: rgba(229,62,62,0.15); color: var(--bull);
  border: 1px solid rgba(229,62,62,0.3);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.6} }

.post-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden;
}
.post-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card2); border-bottom: 1px solid var(--border);
}
.post-type-badge {
  padding: 3px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 700;
}
.type-pre { background: rgba(66,153,225,0.15); color: var(--accent-blue); }
.type-intra { background: rgba(246,201,14,0.15); color: var(--accent-gold); }
.type-post { background: rgba(72,187,120,0.15); color: var(--bear); }
.post-card-body { padding: 1.25rem; white-space: pre-wrap; font-size: 0.93rem; line-height: 1.8; }
.post-time { font-size: 0.8rem; color: var(--text-dim); }

/* ── 指標銷售頁 ── */
.indicator-hero {
  text-align: center;
  padding: 4rem 1.5rem 2.5rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(246,201,14,0.06) 0%, transparent 65%);
}
.price-card {
  background: var(--bg-card); border: 1px solid var(--accent-gold);
  border-radius: var(--radius); padding: 2rem;
  text-align: center; max-width: 360px; margin: 0 auto;
  box-shadow: 0 0 40px rgba(246,201,14,0.1);
}
.price-tag { font-size: 2.5rem; font-weight: 800; color: var(--accent-gold); }
.feature-list { list-style: none; text-align: left; margin: 1.5rem 0; }
.feature-list li {
  padding: 8px 0; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; font-size: 0.93rem;
}
.feature-list li::before { content: "✓"; color: var(--bear); font-weight: 700; }

/* ── 標籤篩選 ── */
.tag-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1.5rem; }
.tag-btn {
  padding: 5px 16px; border-radius: 20px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); font-size: 0.83rem; cursor: pointer;
  transition: all 0.2s;
}
.tag-btn:hover, .tag-btn.active {
  border-color: var(--accent-blue); color: var(--accent-blue);
  background: var(--accent-blue-glow);
}

/* ── Admin ── */
.admin-form { max-width: 760px; margin: 0 auto; }
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg-card2); border: 1px solid var(--border);
  color: var(--text-primary); border-radius: 8px; font-size: 0.93rem;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--accent-blue); }
select.form-control option { background: var(--bg-card2); }
textarea.form-control { min-height: 220px; resize: vertical; line-height: 1.7; }
.alert-success {
  background: rgba(72,187,120,0.1); border: 1px solid rgba(72,187,120,0.3);
  color: var(--bear); padding: 12px 18px; border-radius: 8px; margin-bottom: 1.5rem;
}
.alert-error {
  background: rgba(229,62,62,0.1); border: 1px solid rgba(229,62,62,0.3);
  color: var(--bull); padding: 12px 18px; border-radius: 8px; margin-bottom: 1.5rem;
}

/* ── 頁尾 ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem; text-align: center;
  color: var(--text-dim); font-size: 0.85rem;
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--accent-blue); }

/* ── 分隔線 ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ── 漢堡選單 ── */
.hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 36px; height: 36px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text-primary); border-radius: 2px;
  transition: all 0.25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none;
  position: fixed; top: 60px; right: 0; bottom: 0; width: 240px;
  background: var(--bg-card); border-left: 1px solid var(--border);
  padding: 1.5rem 1rem; z-index: 200;
  transform: translateX(100%); transition: transform 0.25s ease;
  flex-direction: column; gap: 4px;
}
.mobile-menu.open { transform: translateX(0); }
.mobile-menu a {
  display: block; padding: 10px 14px; border-radius: 8px;
  color: var(--text-primary); font-size: 0.95rem; font-weight: 500;
}
.mobile-menu a:hover { background: var(--bg-card2); }

.mobile-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 199;
}
.mobile-overlay.open { display: block; }

/* ── RWD ── */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .mobile-menu { display: flex; }
  .hero { padding: 3rem 1rem 2rem; }
  .hero h1 { font-size: 1.7rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
