/* 確保 HTML hidden 屬性不被 display 規則覆蓋 */
[hidden] { display: none !important; }

/* ── 色彩系統 ── */
:root {
  --white:     #FFFFFF;
  --alabaster: #E5E5E5;
  --prussian:  #14213D;
  --orange:    #FCA311;
  --fern:      #4F7942;

  /* 衍生色 */
  --fern-light:   #EAF0E9;
  --orange-light: #FEF6E4;
  --red:          #C0392B;
  --red-light:    #FDECEA;
  --gray-text:    #9E9E9E;
}

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

body {
  /* Verdana 負責英數字，中文 fallback 系統字體 */
  font-family: Verdana, 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  background: var(--white);
  color: var(--prussian);
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--prussian);
  padding: 20px 24px;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
}

header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.3px;
}

header h1 span {
  color: var(--orange);
}

header p {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
}

/* ── Layout ── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 16px 60px;
}

/* ── Search form ── */
.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.search-form input[type="text"] {
  width: 220px;
  padding: 10px 14px;
  border: 2px solid var(--alabaster);
  border-radius: 6px;
  font-family: Verdana, sans-serif;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--prussian);
  outline: none;
  background: var(--white);
  transition: border-color 0.15s;
}

.search-form input[type="text"]:focus {
  border-color: var(--orange);
}

.search-form input[type="text"]::placeholder {
  text-transform: none;
  letter-spacing: 0;
  color: #bbb;
  font-size: 13px;
}

/* 限直飛 checkbox */
.nonstop-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--prussian);
  cursor: pointer;
  user-select: none;
}

.nonstop-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--orange);
  cursor: pointer;
}

.search-form button {
  padding: 10px 24px;
  background: var(--orange);
  color: var(--white);
  border: none;
  border-radius: 6px;
  font-family: Verdana, sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.search-form button:hover {
  opacity: 0.88;
}

/* ── Quick city chips ── */
.quick-cities {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  font-size: 13px;
  color: var(--gray-text);
}

.city-chip {
  padding: 4px 12px;
  border: 1.5px solid var(--alabaster);
  border-radius: 20px;
  background: var(--white);
  color: var(--prussian);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.city-chip:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* ── Loading ── */
.status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--prussian);
  padding: 20px 0;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--alabaster);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Result header ── */
.result-header {
  margin-bottom: 16px;
}

#result-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--prussian);
}

/* ── Month tabs ── */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 7px 20px;
  border: 2px solid var(--alabaster);
  background: var(--white);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--prussian);
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn.active {
  background: var(--prussian);
  border-color: var(--prussian);
  color: var(--white);
}

.tab-btn:hover:not(.active) {
  border-color: var(--orange);
  color: var(--orange);
}

/* ── Price grid ── */
.price-grid {
  border-collapse: collapse;
  font-family: Verdana, 'PingFang TC', sans-serif;
  font-size: 13px;
  width: 100%;
  background: var(--white);
  /* 外框深色 2px，呈現矩陣感 */
  border: 2px solid var(--prussian);
}

.price-grid th,
.price-grid td {
  padding: 10px 8px;
  text-align: center;
  border: 1px solid #D0D0D0;
  white-space: nowrap;
}

.price-grid thead th {
  background: #F2F2F2;   /* #E5E5E5 淡 50%，與白底形成區隔 */
  color: #000000;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.5;
}

.price-grid tbody th {
  background: #F2F2F2;
  color: #000000;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.5;
  min-width: 52px;
}

.price-grid thead th small,
.price-grid tbody th small {
  font-weight: 400;
  color: #000000;   /* 全黑，不再用灰 */
  font-size: 11px;
}

.corner-cell {
  color: #555555 !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  background: #F2F2F2 !important;
}

/* 票價格子 */
.price-normal {
  background: var(--white);
  color: var(--prussian);
}

/* 最低價：Fern Green */
.price-min {
  background: var(--fern-light);
  color: var(--fern);
  font-weight: 700;
}

/* 最高價：Red */
.price-max {
  background: var(--red-light);
  color: var(--red);
  font-weight: 600;
}

/* 查詢中心格：Alabaster + Orange 框 */
.price-center {
  background: var(--orange-light) !important;
  box-shadow: inset 0 0 0 2px var(--orange);
  color: var(--orange) !important;
  font-weight: 700;
}

.price-null {
  background: var(--alabaster);
  color: var(--gray-text);
  font-size: 12px;
}

.price-normal:hover,
.price-min:hover,
.price-max:hover,
.price-center:hover {
  filter: brightness(0.96);
}

/* ── Legend ── */
.legend {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}

.legend-item {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

/* legend 項目套用對應格子的樣式 */
.legend-item.price-min  { background: var(--fern-light);   color: var(--fern); }
.legend-item.price-max  { background: var(--red-light);    color: var(--red); }
.legend-item.price-center {
  background: var(--orange-light);
  color: var(--orange);
  border: 2px solid var(--orange);
}
.legend-item.price-null { background: var(--alabaster);    color: var(--gray-text); }

/* ── 底部提示 ── */
.page-hint {
  margin-top: 20px;
  font-size: 12px;
  color: var(--gray-text);
  text-align: left;
}

/* ── Error ── */
.error-msg {
  color: var(--red);
  font-size: 14px;
  padding: 12px 0;
}
