/* =====================================================
   bike-fixtures / css/style.css
   腳踏車測試制具查詢網站 — 共用樣式
   調色板：
     --navy   #1A2332  深藍（頁首/背景）
     --white  #F5F7FA  冷白（主內容區）
     --orange #E8500A  強調橘（品牌色）
     --steel  #6B7A90  鋼鐵灰（輔助文字）
     --line   #D1D9E0  分隔線
     --paper  #EEF1F5  卡片底色
   ===================================================== */

/* ── 全域重置 ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  background: #F5F7FA;
  color: #1A2332;
  line-height: 1.7;
  min-height: 100vh;
}

/* ── 頁首 ── */
.site-header {
  background: #1A2332;
  color: #F5F7FA;
  padding: 0 1.5rem;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
}

/* 齒輪圖示（純 CSS 裝飾，不用圖片） */
.header-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  fill: #E8500A;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.3;
}

.site-subtitle {
  font-size: 0.75rem;
  color: #6B7A90;
  margin-top: 2px;
  letter-spacing: 0.05em;
}

/* ── 麵包屑（詳細頁用） ── */
.breadcrumb {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  font-size: 0.8rem;
  color: #6B7A90;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: #E8500A;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: #D1D9E0;
}

/* ── 主內容容器 ── */
.main-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

/* ── 首頁：搜尋區 ── */
.search-section {
  margin-bottom: 1.5rem;
}

.search-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6B7A90;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.search-bar {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid #D1D9E0;
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.search-bar:focus-within {
  border-color: #E8500A;
  box-shadow: 0 0 0 3px rgba(232, 80, 10, 0.12);
}

.search-icon {
  padding: 0 0.75rem;
  color: #6B7A90;
  font-size: 1rem;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.7rem 0.5rem 0.7rem 0;
  font-size: 0.95rem;
  font-family: inherit;
  color: #1A2332;
  background: transparent;
}

.search-input::placeholder {
  color: #A0AFBE;
}

.search-clear {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0.75rem;
  color: #A0AFBE;
  font-size: 1.1rem;
  display: none; /* 有字時才顯示 */
  line-height: 1;
}

.search-clear:hover {
  color: #E8500A;
}

.search-hint {
  margin-top: 0.45rem;
  font-size: 0.75rem;
  color: #A0AFBE;
}

/* ── 首頁：結果計數 ── */
.result-count {
  font-size: 0.8rem;
  color: #6B7A90;
  margin-bottom: 0.75rem;
  min-height: 1.2em;
}

.result-count strong {
  color: #1A2332;
}

/* ── 首頁：測試項目清單 ── */
.test-list {
  display: grid;
  gap: 0.75rem;
}

.test-card {
  background: #fff;
  border: 1.5px solid #D1D9E0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  /* 工程圖紙風格：細格線底紋 */
  background-image:
    linear-gradient(rgba(209, 217, 224, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(209, 217, 224, 0.25) 1px, transparent 1px);
  background-size: 20px 20px;
}

.test-card:hover {
  border-color: #E8500A;
  box-shadow: 0 2px 12px rgba(232, 80, 10, 0.1);
  transform: translateY(-1px);
}

.test-card:focus-visible {
  outline: 3px solid #E8500A;
  outline-offset: 2px;
}

/* 左側類別標籤柱 */
.card-accent {
  width: 4px;
  min-height: 48px;
  background: #E8500A;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
}

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

.card-category {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6B7A90;
  margin-bottom: 0.25rem;
}

.card-name {
  font-size: 1rem;
  font-weight: 700;
  color: #1A2332;
  margin-bottom: 0.3rem;
  line-height: 1.4;
}

.card-desc {
  font-size: 0.82rem;
  color: #6B7A90;
  /* 超過兩行省略 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.card-badge {
  font-size: 0.72rem;
  color: #6B7A90;
  background: #EEF1F5;
  border-radius: 3px;
  padding: 1px 7px;
  white-space: nowrap;
}

.card-arrow {
  flex-shrink: 0;
  color: #D1D9E0;
  font-size: 1.2rem;
  align-self: center;
  transition: color 0.15s, transform 0.15s;
}

.test-card:hover .card-arrow {
  color: #E8500A;
  transform: translateX(3px);
}

/* ── 無搜尋結果提示 ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #6B7A90;
  display: none;
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.9rem;
}

/* ── 詳細頁：標題區 ── */
.detail-header {
  margin-bottom: 1.75rem;
}

.detail-category {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #E8500A;
  margin-bottom: 0.4rem;
}

.detail-title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.detail-desc {
  font-size: 0.9rem;
  color: #6B7A90;
  background: #EEF1F5;
  border-left: 3px solid #E8500A;
  padding: 0.75rem 1rem;
  border-radius: 0 4px 4px 0;
}

/* ── 詳細頁：區塊標題 ── */
.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6B7A90;
  border-bottom: 1.5px solid #D1D9E0;
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.section-title-icon {
  color: #E8500A;
  font-size: 1rem;
}

/* ── 詳細頁：制具清單 ── */
.fixture-section {
  margin-bottom: 2rem;
}

.fixture-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: #fff;
  border: 1.5px solid #D1D9E0;
  border-radius: 6px;
  overflow: hidden;
}

.fixture-table thead {
  background: #1A2332;
  color: #F5F7FA;
}

.fixture-table th {
  padding: 0.6rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.fixture-table td {
  padding: 0.6rem 1rem;
  border-top: 1px solid #D1D9E0;
  vertical-align: top;
}

.fixture-table tbody tr:nth-child(even) {
  background: #EEF1F5;
}

.fixture-table tbody tr:hover {
  background: rgba(232, 80, 10, 0.05);
}

.fixture-qty {
  font-weight: 700;
  color: #E8500A;
  text-align: center;
  white-space: nowrap;
}

.fixture-note {
  color: #6B7A90;
  font-size: 0.8rem;
}

/* ── 詳細頁：安裝步驟 ── */
.steps-section {
  margin-bottom: 2rem;
}

.steps-list {
  display: grid;
  gap: 0.75rem;
}

.step-item {
  display: flex;
  gap: 1rem;
  background: #fff;
  border: 1.5px solid #D1D9E0;
  border-radius: 6px;
  padding: 1rem;
  /* 格線底紋，與首頁卡片呼應 */
  background-image:
    linear-gradient(rgba(209, 217, 224, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(209, 217, 224, 0.2) 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: #fff;
}

.step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: #E8500A;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-text {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #1A2332;
}

.step-image {
  margin-top: 0.75rem;
  max-width: 100%;
  border-radius: 4px;
  border: 1px solid #D1D9E0;
}

/* ── 詳細頁：注意事項 ── */
.notes-section {
  margin-bottom: 2rem;
}

.notes-box {
  background: #fff8f5;
  border: 1.5px solid #f0c4a8;
  border-radius: 6px;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: #1A2332;
  line-height: 1.7;
  display: flex;
  gap: 0.75rem;
}

.notes-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  margin-top: 0.1rem;
}

/* ── 返回按鈕 ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #E8500A;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 1.25rem;
  padding: 0.35rem 0;
  border-bottom: 1.5px solid transparent;
  transition: border-color 0.15s;
}

.back-btn:hover {
  border-bottom-color: #E8500A;
}

/* ── 頁尾 ── */
.site-footer {
  background: #1A2332;
  color: #6B7A90;
  text-align: center;
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  margin-top: 2rem;
}

/* ── 載入中 ── */
.loading {
  text-align: center;
  padding: 3rem;
  color: #6B7A90;
  font-size: 0.9rem;
}

/* ── 錯誤提示 ── */
.error-box {
  background: #fff0f0;
  border: 1.5px solid #f5c6c6;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  color: #c0392b;
  font-size: 0.875rem;
  display: none;
}

/* ────────────────────────────────────
   RWD：手機版（< 640px）
   ──────────────────────────────────── */
@media (max-width: 640px) {
  .site-title { font-size: 0.95rem; }
  .main-container { padding: 1rem 1rem 2.5rem; }
  .detail-title { font-size: 1.25rem; }

  /* 表格手機版改堆疊 */
  .fixture-table thead { display: none; }
  .fixture-table, .fixture-table tbody,
  .fixture-table tr, .fixture-table td {
    display: block;
    width: 100%;
  }
  .fixture-table tr {
    border: 1px solid #D1D9E0;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #fff;
  }
  .fixture-table td {
    border: none;
    padding: 0.2rem 0;
    font-size: 0.82rem;
  }
  .fixture-table td::before {
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: #6B7A90;
    display: block;
    margin-bottom: 0.1rem;
  }
  .fixture-table td:nth-child(1)::before { content: "制具名稱"; }
  .fixture-table td:nth-child(2)::before { content: "數量"; }
  .fixture-table td:nth-child(3)::before { content: "備註"; }

  .fixture-qty { text-align: left; }
}

/* ────────────────────────────────────
   列印樣式
   ──────────────────────────────────── */
@media print {
  .site-header { background: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .back-btn, .search-section { display: none; }
  body { font-size: 11pt; }
  .main-container { padding: 0; max-width: 100%; }
  .test-card, .step-item, .fixture-table { break-inside: avoid; }
  .step-item { background: none !important; border: 1px solid #ccc !important; }
  .step-num { background: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .fixture-table thead { background: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; }
  .detail-desc { border-left-color: #333 !important; }
}
