/* ═══════════════════════════════════════════════════════════════════════
   Carbon Footprint · 全站共用設計系統 (Forest Design System)
   觀光署碳足跡平台 · 前端共用元件 CSS

   本檔案僅保留「真正跨頁共用」的設計系統元件（按鈕、輸入框、卡片、
   標籤、表格、版面 Header/Footer/Nav 等）。
   設計變數 Tokens（:root）、全站 body 規則、Typography helper class
   位於 base.css（請確認 base.css 比本檔案先載入）。
   Estimate 流程專屬元件（tc-*／cp-*／cf-step-*／cf-item-card 等）
   位於 estimate.css。
   ---------------------------------------------------------
   目錄：
    1. Buttons (cf-btn)
    2. Inputs (cf-input)
    3. Cards (cf-card)
    4. Chips / Tags (cf-chip / cf-pill)
    5. Table (cf-table)
    6. Dividers / Eyebrow
    7. Module color utilities
    8. Compare bar / Placeholder image
    9. Layout helpers
   10. Page Header / Nav / Footer
   ═══════════════════════════════════════════════════════════════════════ */

/* =========================================================
   1. Buttons (cf-btn)
   ========================================================= */
.cf-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  white-space: nowrap;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}
.cf-btn:focus-visible {
  outline: 2px solid var(--forest-500);
  outline-offset: 2px;
}

.cf-btn--primary {
  background: var(--forest-700);
  color: #fff;
  border-color: var(--forest-700);
}
.cf-btn--primary:hover,
.cf-btn--primary:focus {
  background: var(--forest-800);
  border-color: var(--forest-800);
  color: #fff;
}

.cf-btn--ghost {
  background: transparent;
  color: var(--forest-700);
  border-color: var(--cream-300);
}
.cf-btn--ghost:hover,
.cf-btn--ghost:focus {
  background: var(--cream-100);
  border-color: var(--forest-700);
  color: var(--forest-700);
}

.cf-btn--text {
  background: transparent;
  color: var(--forest-700);
  padding: 0 4px;
  height: auto;
  border: none;
}
.cf-btn--text:hover {
  color: var(--forest-800);
}

/* 可疊加 --primary 或 --ghost 使用 */
.cf-btn--sm {
  height: 32px;
  padding: 0 12px;
  font-size: 14px;
  border-radius: 5px;
}

/* =========================================================
   2. Inputs (cf-input)
   ========================================================= */
.cf-input {
  height: 40px;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  border: 1px solid var(--cream-300);
  border-radius: 6px;
  color: var(--ink-800);
  width: 100%;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
  -webkit-appearance: none;
  appearance: none;
}
.cf-input:focus {
  border-color: var(--forest-500);
  /* 原不透明度僅 0.1，焦點指示器可視性偏弱，提高至 0.4 以更清楚標示鍵盤焦點位置 */
  box-shadow: 0 0 0 3px rgba(31, 67, 50, 0.4);
}
.cf-input::placeholder {
  color: var(--ink-300);
}
.cf-input:disabled {
  background: var(--cream-100);
  color: var(--ink-400);
  cursor: not-allowed;
}

/* 搜尋框：icon 絕對定位在左側 */
.cf-input-search-wrap {
  position: relative;
}
.cf-input-search-wrap .cf-input {
  padding-left: 38px;
}
.cf-input-search-wrap .cf-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
  pointer-events: none;
  font-size: 14px;
  line-height: 1;
}

select.cf-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238a8473' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* =========================================================
   3. Cards (cf-card)
   ========================================================= */
.cf-card {
  background: #fff;
  border: 1px solid var(--cream-200);
  border-radius: 10px;
  overflow: hidden;
}
/* =========================================================
   4. Chips / Tags (cf-chip / cf-pill)
   ========================================================= */
.cf-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--forest-700);
  background: var(--forest-50);
  border: 1px solid var(--forest-100);
  border-radius: 100px;
  white-space: nowrap;
}
/* Filter pills — interactive toggles */
.cf-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 100px;
  border: 1px solid var(--cream-300);
  background: #fff;
  color: var(--ink-700);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  font-family: inherit;
  white-space: nowrap;
}
.cf-pill:hover {
  background: var(--cream-100);
  border-color: var(--forest-400);
}
.cf-pill--active {
  background: var(--forest-700);
  border-color: var(--forest-700);
  color: #fff;
  font-weight: 500;
}

/* =========================================================
   5. Table (cf-table)
   ========================================================= */
.cf-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.cf-table th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-500);
  padding: 10px 12px;
  border-bottom: 1px solid var(--cream-200);
  background: var(--cream-50);
  font-size: 14px;
  letter-spacing: 0.04em;
}
.cf-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--cream-100);
  color: var(--ink-800);
}
.cf-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cf-table tbody tr:last-child td {
  border-bottom: 0;
}

/* =========================================================
   6. Dividers / Eyebrow
   ========================================================= */
.cf-divider {
  height: 1px;
  background: var(--cream-200);
  border: none;
  margin: 0;
}
.cf-divider--dashed {
  height: 1px;
  border: none;
  border-top: 1px dashed var(--cream-200);
}

.cf-eyebrow {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  text-transform: uppercase;
  line-height: 1.3;
}

/* =========================================================
   7. Module color utilities
   ========================================================= */
.cf-module-transport { color: var(--m-transport); }

.cf-module-bg-transport { background-color: var(--m-transport); }
.cf-module-bg-stay      { background-color: var(--m-stay); }
.cf-module-bg-dining    { background-color: var(--m-dining); }
.cf-module-bg-activity  { background-color: var(--m-activity); }

/* =========================================================
   8. Compare bar / Placeholder image
   ========================================================= */

.cf-compare-bar {
  background: var(--forest-800);
  color: #fff;
  border-radius: 12px;
  padding: 14px 20px;
  box-shadow: 0 10px 28px rgba(20, 40, 30, 0.18);
}

/* 卡片圖片預設佔位圖 */
.cf-placeholder {
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(
      135deg,
      var(--cream-200) 0 1px,
      transparent 1px 12px
    ),
    var(--cream-100);
  display: grid;
  place-items: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  color: var(--ink-400);
  letter-spacing: 0.05em;
}

/* =========================================================
   9. Layout helpers
   ========================================================= */
/* 避免內容過短時 footer 上貼 */
main {
  min-height: calc(100vh - 160px);
}

/* =========================================================
   10. Page Header / Nav / Footer
   ========================================================= */
.cf-layout-header {
  background: #fff;
  border-bottom: 1px solid var(--cream-200);
}
.cf-layout-header__inner {
  display: flex;
  align-items: center;
  height: 72px;
  padding: 0 48px;
  gap: 4px;
}
@media (max-width: 1279px) {
  .cf-layout-header__inner { padding: 0 24px; }
}
@media (max-width: 767px) {
  .cf-layout-header__inner { padding: 0 16px; }
}

.cf-header__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  text-decoration: none;
}
.cf-header__brand:hover { text-decoration: none; }

.cf-header__brand img {
  height: 36px;
  width: auto;
}

.cf-header__divider {
  width: 1px;
  height: 32px;
  background: var(--cream-300);
  flex-shrink: 0;
}

.cf-header__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--forest-700);
  letter-spacing: 0.08em;
  line-height: 1.3;
  white-space: nowrap;
}
.cf-header__subtitle {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-500);
  letter-spacing: 0.05em;
  margin-top: 2px;
  white-space: nowrap;
}

.cf-header__nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.cf-nav-item {
  display: inline-block;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-700);
  border-radius: 6px;
  position: relative;
  transition: background .12s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.cf-nav-item:hover {
  background: var(--cream-100);
  color: var(--ink-700);
  text-decoration: none;
}
.cf-nav-item--active {
  color: var(--forest-700);
  font-weight: 600;
}
.cf-nav-item--active::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -2px;
  height: 2px;
  background: var(--forest-700);
  border-radius: 2px;
}
.cf-nav-item--logout {
  color: var(--ink-500);
}
.cf-nav-item--logout:hover {
  color: var(--clay-600);
  background: #fdf4f1;
}

.cf-header__user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 18px;
  padding-left: 18px;
  border-left: 1px solid var(--cream-200);
  flex-shrink: 0;
}

.cf-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--forest-100);
  color: var(--forest-700);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

/* 使用者名稱 / 角色標籤 */
.cf-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-800);
  line-height: 1.3;
  white-space: nowrap;
}

.cf-user-role {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-500);
  line-height: 1.3;
}

/* 手機漢堡按鈕 */
.cf-nav-toggle {
  border: 1px solid var(--cream-300);
  border-radius: 6px;
  color: var(--ink-700);
  background: transparent;
}

.cf-nav-toggle__icon {
  font-size: 1.25rem;
}

/* Footer */
.cf-footer {
  background: var(--forest-900);
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: 20px 48px;
  font-size: 14px;
}

/* Mobile nav panel */
.cf-mobile-nav {
  background: #fff;
  border-top: 1px solid var(--cream-200);
  padding: 12px 16px 16px;
}
.cf-mobile-nav .cf-nav-item {
  display: block;
  padding: 10px 12px;
}
.cf-mobile-nav .cf-nav-item--active::after {
  display: none; /* no underline on mobile, use bg instead */
}
.cf-mobile-nav .cf-nav-item--active {
  background: var(--forest-50);
}
