/* ============================================
   Wongjai AI Earning Calls — 主題樣式 v2
   風格：機構級深色金融儀表板
   改進：表格、清單、排版、配色層次
   ============================================ */

:root {
  /* 核心色 */
  --bg-primary: #0b1120;
  --bg-secondary: #111a2e;
  --bg-card: #151e33;
  --bg-card-hover: #1a2640;

  /* 語意色 */
  --accent-green: #00e6b0;
  --accent-green-dim: rgba(0, 230, 176, 0.08);
  --accent-green-glow: rgba(0, 230, 176, 0.15);
  --accent-red: #ff5c6c;
  --accent-red-dim: rgba(255, 92, 108, 0.10);
  --accent-blue: #4d9fff;
  --accent-blue-dim: rgba(77, 159, 255, 0.10);
  --accent-gold: #ffc145;
  --accent-gold-dim: rgba(255, 193, 69, 0.10);
  --accent-purple: #a78bfa;

  /* 文字 */
  --text-primary: #e8edf5;
  --text-secondary: #9aa8c0;
  --text-muted: #5e6f8a;

  /* 邊框 & 陰影 */
  --border-color: #1c2a44;
  --border-light: #243354;
  --shadow-glow: 0 0 30px rgba(0, 230, 176, 0.08);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3);

  /* 表格 */
  --table-header-bg: #131c30;
  --table-row-alt: #111a2e;
  --table-row-hover: #1a2640;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== 導航列 ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 17, 32, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
}

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

.navbar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-green);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-brand span {
  color: var(--text-primary);
}

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

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

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

/* ===== Hero 區塊 ===== */
.hero {
  text-align: center;
  padding: 3rem 2rem 2rem;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 230, 176, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ===== 統計卡片 ===== */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 2rem;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  text-align: center;
  min-width: 160px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-green);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

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

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, var(--accent-green), var(--accent-blue));
  border-radius: 2px;
}

/* ===== 財報卡片 ===== */
.earnings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

.earning-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.earning-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
  border-color: var(--accent-green);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.ticker-badge {
  background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
  color: #000;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
}

.card-date {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.card-excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: var(--accent-green-dim);
  color: var(--accent-green);
  border: 1px solid rgba(0, 230, 176, 0.2);
}

.tag.positive {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.tag.negative {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border-color: rgba(255, 92, 108, 0.2);
}

.tag.neutral {
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  border-color: rgba(255, 193, 69, 0.2);
}

/* ===== 文章頁面 ===== */
.article-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

.article-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.article-header h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.article-meta {
  display: flex;
  gap: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

/* ==========================================
   文章內容 — 核心排版改進
   ========================================== */
.article-content {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text-secondary);
}

/* --- 標題：更大間距、更好層次感 --- */
.article-content h2 {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 3rem 0 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--border-color);
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.article-content h2:first-child {
  margin-top: 0;
}

.article-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 2.25rem 0 1rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--accent-green);
  line-height: 1.4;
}

.article-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.75rem 0 0.75rem;
}

/* --- 段落 --- */
.article-content p {
  margin-bottom: 1.15rem;
}

/* --- 強調文字 --- */
.article-content strong {
  color: var(--text-primary);
  font-weight: 700;
}

.article-content em {
  color: var(--accent-gold);
  font-style: italic;
}

/* --- 清單（ul/ol）：漂亮的項目符號 --- */
.article-content ul,
.article-content ol {
  margin: 1rem 0 1.5rem 1.5rem;
  padding: 0;
}

.article-content ul li,
.article-content ol li {
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
  line-height: 1.75;
}

.article-content ul {
  list-style: none;
}

.article-content ul li {
  position: relative;
  padding-left: 1.25rem;
}

.article-content ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(0, 230, 176, 0.4);
}

/* 巢狀清單 */
.article-content ul ul {
  margin: 0.25rem 0 0.5rem 1rem;
}

.article-content ul ul li::before {
  background: var(--accent-blue);
  box-shadow: 0 0 6px rgba(77, 159, 255, 0.3);
  width: 5px;
  height: 5px;
}

.article-content ol {
  list-style: none;
  counter-reset: list-counter;
}

.article-content ol li {
  counter-increment: list-counter;
  padding-left: 1.5rem;
  position: relative;
}

.article-content ol li::before {
  content: counter(list-counter) '.';
  position: absolute;
  left: 0;
  color: var(--accent-green);
  font-weight: 700;
  font-size: 0.9em;
}

/* --- 表格：Bloomberg Terminal 風格 --- */
.article-content .table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-card);
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.article-content th {
  background: var(--table-header-bg);
  color: var(--accent-green);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--accent-green);
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.article-content td {
  padding: 0.7rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

/* 斑馬紋 */
.article-content tbody tr:nth-child(even) {
  background: var(--table-row-alt);
}

.article-content tbody tr:nth-child(odd) {
  background: transparent;
}

/* Hover 效果 */
.article-content tbody tr {
  transition: background 0.15s ease;
}

.article-content tbody tr:hover {
  background: var(--table-row-hover);
}

/* 表格內文字對齊 */
.article-content td:first-child {
  font-weight: 600;
  color: var(--text-primary);
}

/* --- 表格狀態色（td.good / td.warn / td.bad）--- */
.article-content td.good {
  background: var(--accent-green-dim);
  color: var(--accent-green);
  font-weight: 600;
}

.article-content td.warn {
  background: var(--accent-gold-dim);
  color: var(--accent-gold);
  font-weight: 600;
}

.article-content td.bad {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  font-weight: 600;
}

/* Emoji 狀態標記在表格中更醒目 */
.article-content td .emoji-status,
.article-content td span.emoji-status {
  font-size: 1.15em;
  display: inline-block;
  margin-right: 0.2em;
  vertical-align: middle;
}

/* 選擇器：讓含 emoji 的 td 更有呼吸感 */
.article-content td:has(> *:first-child),
.article-content td {
  line-height: 1.65;
}

/* --- 引用區塊：更精緻的金融感 --- */
.article-content blockquote {
  border-left: 3px solid var(--accent-green);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  background: linear-gradient(135deg, var(--accent-green-dim) 0%, rgba(11, 17, 32, 0.6) 100%);
  border-radius: 0 10px 10px 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.75;
}

.article-content blockquote strong {
  color: var(--accent-green);
}

.article-content blockquote p {
  margin-bottom: 0.5rem;
}

.article-content blockquote p:last-child {
  margin-bottom: 0;
}

/* --- 行內程式碼 --- */
.article-content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.88em;
  background: var(--bg-card);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  color: var(--accent-purple);
}

/* --- 程式碼區塊 --- */
.article-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-card);
}

.article-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* --- 水平線 --- */
.article-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-light), transparent);
  margin: 2.5rem 0;
}

/* --- 連結 --- */
.article-content a {
  color: var(--accent-blue);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.article-content a:hover {
  border-bottom-color: var(--accent-blue);
}

/* --- 圖片 --- */
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
}

/* ===== 關於頁面 ===== */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.team-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
}

.team-emoji {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.team-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.team-role {
  color: var(--accent-green);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.team-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ===== 頁尾 ===== */
.footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

/* ==========================================
   響應式設計
   ========================================== */
@media (max-width: 768px) {
  .hero {
    padding: 2rem 1.5rem 1.5rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .nav-links {
    gap: 0.5rem;
    font-size: 0.8rem;
  }

  .nav-links a {
    padding: 4px 8px;
    white-space: nowrap;
  }

  .navbar-inner {
    padding: 0 0.5rem;
  }

  .stats-bar {
    gap: 1rem;
  }

  .stat-card {
    padding: 1rem 1.5rem;
    min-width: 120px;
  }

  .earnings-grid {
    grid-template-columns: 1fr;
  }

  .article-container {
    padding: 2rem 1rem 3rem;
  }

  .article-header h1 {
    font-size: 1.5rem;
  }

  /* 表格行動裝置優化 — 水平捲動，不截斷文字 */
  .article-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 12px;
    min-width: 600px;
  }

  .article-content th,
  .article-content td {
    padding: 6px 8px;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    max-width: none;
  }

  .article-content h2 {
    font-size: 1.35rem;
    margin: 2.5rem 0 1rem;
  }

  .article-content h3 {
    font-size: 1.15rem;
    margin: 2rem 0 0.75rem;
  }

  .article-content ul,
  .article-content ol {
    margin-left: 1rem;
  }

  .article-content blockquote {
    padding: 0.85rem 1rem;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.65rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .article-header h1 {
    font-size: 1.3rem;
  }

  .article-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .article-content {
    font-size: 0.92rem;
  }

  .article-content h2 {
    font-size: 1.25rem;
  }

  .article-content h3 {
    font-size: 1.08rem;
  }
}

/* ===== 卡片 Logo + 一句話摘要 ===== */
.card-body {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.card-logo {
  display: none;
}

.card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-summary {
  color: var(--accent-gold);
  font-size: 0.88rem;
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== 文章頁 Logo + 摘要 ===== */
.article-logo {
  margin-bottom: 1.5rem;
}

.article-logo img {
  height: 48px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
}

.article-summary {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--accent-gold-dim);
  border-left: 3px solid var(--accent-gold);
  border-radius: 0 8px 8px 0;
  color: var(--accent-gold);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ===== 分享按鈕 ===== */
.share-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.share-section h3,
.comments-section h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.share-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  color: #fff;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
}

.share-btn-fb {
  background: #1877f2;
}

.share-btn-fb:hover {
  border-bottom-color: transparent;
  color: #fff;
}

/* ===== 搜尋欄 ===== */
.search-bar {
  margin-bottom: 2rem;
}
.search-bar input {
  width: 100%;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar input:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1);
}
.search-bar input::placeholder {
  color: var(--text-muted);
}

/* ===== 頁尾聯絡資訊 ===== */
.footer-contact {
  margin-top: 0.75rem;
}

.footer-contact a {
  color: var(--accent-green);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.footer-contact a:hover {
  border-bottom-color: var(--accent-green);
}

/* ===== 滾動條美化 ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== 選取文字高亮 ===== */
::selection {
  background: rgba(0, 230, 176, 0.25);
  color: var(--text-primary);
}
