/* ═══════════════════════════════════════════
   Wongjai News v2 — Style
   風格：簡潔橫線分隔，類似 newsdigest.ai
   ═══════════════════════════════════════════ */

:root {
  --bg: #ffffff; --bg2: #f8f9fa;
  --text: #1a1a2e; --text2: #64748b; --muted: #94a3b8;
  --border: #e2e8f0;
  --accent: #2563eb; --accent-hover: #1d4ed8;
  --green: #16a34a; --red: #dc2626; --orange: #ea580c;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
}

[data-theme="dark"] {
  --bg: #0f172a; --bg2: #1e293b;
  --text: #f1f5f9; --text2: #94a3b8; --muted: #64748b;
  --border: #334155;
  --accent: #60a5fa; --accent-hover: #93bbfd;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Noto Sans JP", sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.7; transition: background .3s, color .3s;
}

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

/* ── Header ─────────────────────────────── */
header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}

.header-inner {
  max-width: 900px; margin: 0 auto;
  padding: 14px 20px;
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap;
}

.logo {
  font-size: 22px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  text-decoration: none; white-space: nowrap;
}

.email-link {
  display: flex; align-items: center;
  color: var(--text2); text-decoration: none;
  opacity: 0.6; transition: opacity .2s, color .2s;
  margin-left: auto;
}
.email-link:hover { opacity: 1; color: var(--accent); }

/* ── 語言切換器 ──────────────────────────── */
.lang-switcher {
  display: flex; gap: 2px;
  background: var(--bg2); border-radius: 8px; padding: 2px;
}

.lang-btn {
  padding: 5px 12px; border: none; border-radius: 6px;
  background: transparent; color: var(--text2);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .2s;
}

.lang-btn:hover { color: var(--text); background: var(--border); }
.lang-btn.active {
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

/* ── 主題切換 ────────────────────────────── */
#theme-toggle {
  background: none; border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px;
  font-size: 16px; cursor: pointer;
  transition: all .2s;
}
#theme-toggle:hover { background: var(--bg2); }

/* ── 分類列 ──────────────────────────────── */
.category-bar {
  max-width: 900px; margin: 0 auto;
  padding: 8px 20px 10px;
  display: flex; gap: 6px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.cat-btn {
  padding: 4px 14px; border: 1px solid var(--border);
  border-radius: 20px; background: transparent;
  color: var(--text2); font-size: 13px;
  cursor: pointer; transition: all .2s;
}

.cat-btn:hover { border-color: var(--accent); color: var(--accent); }
.cat-btn.active {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
}

/* ── 新聞列表 ────────────────────────────── */
.news-feed {
  max-width: 900px; margin: 0 auto;
  padding: 0 20px;
}

.news-item {
  padding: 18px 0;
}

.news-meta {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px; flex-wrap: wrap;
}

.category-badge {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* 分類顏色 */
.cat-AI { background: #dbeafe; color: #1d4ed8; }
.cat-半導體 { background: #fce7f3; color: #be185d; }
.cat-電動車 { background: #d1fae5; color: #065f46; }
.cat-太空 { background: #ede9fe; color: #6d28d9; }
.cat-經濟 { background: #fef3c7; color: #92400e; }
.cat-科技 { background: #e0e7ff; color: #3730a3; }
.cat-地緣政治 { background: #fee2e2; color: #991b1b; }

[data-theme="dark"] .cat-AI { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .cat-半導體 { background: #4a1942; color: #f9a8d4; }
[data-theme="dark"] .cat-電動車 { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .cat-太空 { background: #2e1065; color: #c4b5fd; }
[data-theme="dark"] .cat-經濟 { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .cat-科技 { background: #1e1b4b; color: #a5b4fc; }
[data-theme="dark"] .cat-地緣政治 { background: #450a0a; color: #fca5a5; }

.source {
  font-size: 12px; color: var(--muted);
  font-weight: 500;
}

time {
  font-size: 12px; color: var(--muted);
}

/* ── 標題 ────────────────────────────────── */
.news-item h2 {
  font-size: 18px; font-weight: 700;
  line-height: 1.4; margin-bottom: 6px;
}

.news-item h2 a {
  color: var(--text); text-decoration: none;
}

.news-item h2 a:hover {
  color: var(--accent); text-decoration: none;
}

.news-title { display: inline; }

/* ── 摘要 ────────────────────────────────── */
.summary {
  font-size: 14px; color: var(--text2);
  line-height: 1.6;
}

/* ── 橫線分隔 ────────────────────────────── */
.news-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin-top: 18px;
}

/* ── Footer ──────────────────────────────── */
footer {
  max-width: 900px; margin: 0 auto;
  padding: 24px 20px;
  text-align: center;
  font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--border);
}

/* ── RWD ─────────────────────────────────── */
@media (max-width: 600px) {
  .header-inner { padding: 10px 14px; gap: 10px; }
  .logo { font-size: 18px; }
  .lang-switcher { margin-left: 0; }
  .lang-btn { padding: 4px 8px; font-size: 12px; }
  .category-bar { padding: 6px 14px 8px; gap: 4px; }
  .cat-btn { padding: 3px 10px; font-size: 12px; }
  .news-feed { padding: 0 14px; }
  .news-item h2 { font-size: 16px; }
  .summary { font-size: 13px; }
}
