:root {
  --primary: #006994;       /* 海洋深藍 */
  --accent: #F4A261;        /* 溫暖橘 (強調色) */
  --bg-body: #F3F6F9;       /* 淺灰背景 */
  --bg-card: #FFFFFF;
  --text-main: #2C3E50;
  --text-sub: #64748B;
  --radius: 16px;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
}

/* 共用容器 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Header ===== */
.main-header {
  background: white;
  padding: 40px 0 30px;
  border-bottom: 1px solid #E2E8F0;
  text-align: center;
  margin-bottom: 40px;
}

.header-badges {
  margin-bottom: 12px;
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 50px;
  background: #E0F2FE;
  color: var(--primary);
  margin: 0 4px;
}

.badge.highlight {
  background: var(--primary);
  color: white;
}

.main-header h1 {
  font-size: 2.2rem;
  margin: 8px 0;
  color: var(--text-main);
}

.subtitle {
  color: var(--text-sub);
  margin-top: 0;
}

.source-info {
  font-size: 0.85rem;
  color: #94A3B8;
  margin-top: 16px;
}

/* ===== Dashboard Layout ===== */
.section-block {
  margin-bottom: 60px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.title-box h2 {
  font-size: 1.5rem;
  margin: 0 0 4px;
  border-left: 5px solid var(--primary);
  padding-left: 12px;
}

.title-box p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-sub);
  padding-left: 17px;
}

/* 按鈕群組 */
.controls {
  display: flex;
  gap: 8px;
}

.year-btn {
  background: white;
  border: 1px solid #CBD5E1;
  padding: 8px 20px;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-sub);
  transition: all 0.2s;
}

.year-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.year-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(0, 105, 148, 0.3);
}

/* ===== Grid System (核心排版) ===== */
.grid-layout {
  display: grid;
  gap: 24px;
}

/* 預設: 左圖右文 */
.trend-grid, .scenic-grid {
  grid-template-columns: 2fr 1fr; /* 2:1 比例 */
}

.donut-grid {
  grid-template-columns: 1fr 1fr; /* 1:1 比例 */
  align-items: start;
}

/* 卡片樣式 */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  height: 100%; /* 讓高度填滿 Grid */
}

.chart-card {
  min-height: 400px;
  position: relative;
}

/* 列表樣式優化 */
.styled-list {
  padding-left: 20px;
  margin: 0;
}

.styled-list li {
  margin-bottom: 12px;
  color: var(--text-main);
}

.styled-list strong {
  color: var(--primary);
}

/* 甜甜圈圖表區 */
.donut-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 350px;
}

/* 表格樣式 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.data-table th {
  text-align: left;
  color: var(--text-sub);
  font-size: 0.85rem;
  border-bottom: 2px solid #F1F5F9;
  padding: 8px;
}

.data-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #F1F5F9;
  font-weight: 500;
}

.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

.chart-note {
  font-size: 0.8rem;
  color: #94A3B8;
  margin-top: 16px;
  text-align: right;
}

/* Footer */
.main-footer {
  text-align: center;
  padding: 40px 0;
  color: var(--text-sub);
  font-size: 0.9rem;
  border-top: 1px solid #E2E8F0;
}

/* ===== RWD (手機版優化) ===== */
@media (max-width: 900px) {
  .trend-grid, .scenic-grid, .donut-grid {
    grid-template-columns: 1fr; /* 強制變為單欄 */
  }

  .chart-card {
    min-height: 300px; /* 手機上圖表高度稍微縮小 */
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .controls {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto; /* 若按鈕太多可滑動 */
    padding-bottom: 8px;
  }

  .year-btn {
    flex-shrink: 0;
  }
}

/* 淡季標籤 */
.low-season-tag {
  font-size: 10px;
  background: #0369a1;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 5px;
  vertical-align: middle;
}

/* 淡季按鈕樣式 */
.season-btn {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  margin-left: 10px;
}

.season-btn.active {
  background: #006994;
  color: white;
  border-color: #006994;
}

/* 修正表格背景過渡 */
#donutLegendTable tr {
  transition: background-color 0.3s ease, color 0.3s ease;
}

.data-table tr {
  border-bottom: 1px solid #F1F5F9; /* 保持精細的分割線 */
}

/* 確保淡季模式時表格文字顏色夠深 */
#donutLegendTable tr[style*="background-color"] td {
  color: #0369A1 !important; 
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.table-header-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

/* 修正背景溢出後，圖表容器需保持相對定位 */
.chart-card {
  position: relative;
  overflow: hidden; /* 二次防護 */
}

/* 淡季標籤樣式 */
.low-season-tag {
  font-size: 10px;
  background: #0369a1;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

/* 圖表類型切換器容器 */
.chart-type-switch {
    display: inline-flex;
    background: #e0e0e0;
    border-radius: 8px;
    padding: 4px;
    margin: 0 10px;
    vertical-align: middle;
}

/* 切換按鈕樣式 */
.type-btn {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* 滑鼠懸停 */
.type-btn:hover {
    color: #333;
}

/* 選中狀態 (Active) */
.type-btn.active {
    background: #fff;
    color: #00609c; /* 配合原本的主題藍色 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-weight: 700;
}

/* 調整一下原本的 controls-group 讓排版更順眼 */
.controls-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}