/*
 * 路徑：carpool/carpool.css
 * 日期：2026-08-12
 * 版次：CAREZGO-HIERARCHY-UI-V1D
 * 用途：媒合車隊分層目錄（階層頁隱藏地圖縮圖、國中一列兩間）
 */
:root {
  --bg: #ffffff;
  --panel: #eef5ff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #c7dbf5;
  --brand: #0b63ce;
  --brand-dark: #084ea3;
  --brand-soft: #e8f1ff;
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  --radius: 14px;
  --radius-btn: 12px;
  --max: 1100px;
  --north: #0b63ce;
  --central: #16a34a;
  --south: #ea580c;
  --east: #7c3aed;
  --guide: #0d9488;
  --member: #f97316;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC",
    "PingFang TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px 12px 28px;
}

/* —— Header：LINE + @carezgo + breadcrumb + map —— */
.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0 8px;
  margin-bottom: 0;
  border-bottom: none;
}
.brand-bar .logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #111827;
  text-decoration: none;
}
.brand-bar .logo .line-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #06c755;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.brand-bar .tag { display: none; }

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.top-row .breadcrumb {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.top-row .map-slot,
.map-slot {
  display: none !important;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px;
  row-gap: 2px;
}
.breadcrumb a { color: var(--muted); font-weight: 700; text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { color: #94a3b8; }
.breadcrumb .current { color: var(--muted); font-weight: 800; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.page-head .titles { min-width: 0; flex: 1; }
.page-head .heading-block {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.page-head .heading-block::before {
  content: "";
  width: 5px;
  border-radius: 999px;
  background: var(--brand);
  flex: 0 0 auto;
}
.page-head h1 {
  margin: 0 0 4px;
  font-size: clamp(24px, 5.5vw, 30px);
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: -0.01em;
  word-break: break-word;
  color: var(--brand);
}
.page-head .sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.page-head .meta-line,
.page-head .status-line {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
}
.page-head .map-slot { display: none; }

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (min-width: 720px) {
  .home-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}

.region-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-height: 130px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.region-card:hover { border-color: #bfdbfe; text-decoration: none; }
.region-card .region-title {
  font-size: 20px;
  font-weight: 900;
  margin: 0;
  line-height: 1.2;
}
.region-card .region-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.region-card .map-wrap {
  margin-top: auto;
  height: 56px;
  display: flex;
  justify-content: flex-end;
}
.region-card .map-wrap .tw-map { height: 100%; width: auto; }
.region-card.is-soon { opacity: 0.78; }
.region-card .pill {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}
.region-card.is-ready .pill {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: #bfdbfe;
}
.region-card[data-tone="guide"] .region-title { color: var(--guide); }
.region-card[data-tone="member"] .region-title { color: var(--member); }
.region-card[data-tone="central"] .region-title { color: var(--central); }
.region-card[data-tone="south"] .region-title { color: var(--south); }
.region-card[data-tone="east"] .region-title { color: var(--east); }

/* —— 圖1：台北市類型（置中插圖 + 標題 + ›） —— */
.type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 640px) {
  .type-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
.type-grid.type-grid-simple .type-card:last-child:nth-child(5) {
  grid-column: auto;
}
@media (min-width: 640px) {
  .type-grid.type-grid-simple {
    grid-template-columns: repeat(3, 1fr);
  }
  .type-grid.type-grid-simple .type-card:nth-child(4) {
    grid-column: 1;
  }
}

.type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 12px 14px;
  box-shadow: none;
  text-decoration: none;
  color: inherit;
  min-height: 128px;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.type-card:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow);
  text-decoration: none;
}
.type-card .entry-top {
  display: flex;
  align-items: center;
  justify-content: center;
}
.type-card .type-ico {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: transparent;
  border: none;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: none;
}
.type-card .type-ico svg { display: block; width: 52px; height: 52px; }
.type-card .title {
  font-size: 20px;
  font-weight: 900;
  margin: 0;
  line-height: 1.2;
  color: var(--brand);
  text-align: center;
}
.type-card .desc,
.type-card .badge { display: none; }
.type-card .chev {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.85;
}

/* —— 圖2：北部／雙 CTA 類型卡（一頁更多資訊） —— */
.action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 560px) {
  .action-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .action-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
.action-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 0;
}
.action-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}
.action-card .type-ico {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fff;
  border: none;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.action-card .type-ico svg { width: 40px; height: 40px; display: block; }
.action-card .title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: var(--brand);
  line-height: 1.2;
}
.action-card .btn {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 10px;
  justify-content: flex-start;
}
.action-card .btn.primary {
  background: #fff;
  color: var(--brand);
  border: 1.5px solid #9fc2f0;
  box-shadow: none;
  font-weight: 800;
}
.action-card .btn.primary:hover { background: var(--brand-soft); }
.action-card .btn.btn-fb {
  background: #fff;
  border: 1.5px solid #9fc2f0;
  color: var(--brand);
  font-size: 12px;
}
.action-card .btn .chev-mini {
  margin-left: auto;
  color: var(--brand);
  font-weight: 700;
  opacity: 0.7;
}
.action-card .btn .people-ico,
.action-card .btn .fb-mark {
  flex: 0 0 auto;
}
.action-card .btn .people-ico {
  width: 18px;
  height: 18px;
  display: inline-block;
}
.action-card .btn.is-disabled {
  opacity: 0.5;
}

/* —— 縣市卡（北部）：密排，仿圖1資訊密度 —— */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 720px) {
  .grid.grid-3 { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
.city-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 12px 12px;
  box-shadow: none;
  text-decoration: none;
  color: inherit;
  min-height: 118px;
  -webkit-tap-highlight-color: transparent;
}
.city-card:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow);
  text-decoration: none;
}
.city-card .entry-top {
  display: flex;
  justify-content: center;
}
.city-card .entry-ico {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: transparent;
  border: none;
  display: grid;
  place-items: center;
  box-shadow: none;
}
.city-card .entry-ico svg { width: 44px; height: 44px; display: block; }
.city-card .title {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  color: var(--brand);
  text-align: center;
}
.city-card .desc,
.city-card .badge { display: none; }
.city-card .chev {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand);
  font-size: 20px;
  font-weight: 700;
  opacity: 0.8;
}
.city-card.is-ready { border-color: #9fc2f0; }

/* —— 圖3：行政區列 + 學校卡（一列多校） —— */
.district-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: none;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .district-block {
    grid-template-columns: 140px 1fr;
    align-items: stretch;
  }
}
.district-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  background: #f3f8ff;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 720px) {
  .district-head {
    border-bottom: none;
    border-right: 1px solid var(--line);
    padding: 12px 10px;
  }
}
.district-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.district-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.district-ico svg { display: block; width: 22px; height: 22px; }
.district-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  color: var(--brand);
}
.district-head .count {
  font-size: 11px;
  font-weight: 800;
  color: var(--brand);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.district-landmark {
  width: 100%;
  height: 44px;
  margin-top: 2px;
  border-radius: 8px;
  background: linear-gradient(180deg, #dbeafe 0%, #eff6ff 100%);
  border: 1px solid #dbeafe;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.district-landmark svg { width: 72px; height: 36px; display: block; }

.school-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 8px;
  background: #fff;
}
@media (min-width: 960px) {
  .school-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px; }
}

.school-card {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
  min-width: 0;
}
.school-card.is-inactive { opacity: 0.72; }
.school-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.school-ico {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--brand-soft);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--brand);
}
.school-ico svg { width: 16px; height: 16px; }
.school-name {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
  word-break: break-word;
  color: var(--text);
}
.school-note {
  margin: 0 0 6px;
  font-size: 10px;
  color: var(--muted);
}
.school-count-badge {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: var(--brand-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}
.page-high-school .district-landmark { display: none; }
/* CAREZGO-HS-CARD-UI-FIX-V1: high-school cards never show student-count badge/space */
.page-high-school .school-count-badge { display: none !important; }
.page-high-school .school-name {
  flex: 1 1 auto;
  min-width: 0;
}
.page-high-school .school-card-head {
  gap: 8px;
}

/* 國中頁：再壓縮行政區列，優先露出學校 */
.page-junior-high .page-head { margin-bottom: 8px; }
.page-junior-high .district-landmark { display: none; }
.page-junior-high .district-block { margin-bottom: 8px; }
.page-junior-high .district-head { padding: 8px 10px; }
.page-junior-high .btn {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 11px;
}
.page-junior-high .btn.btn-fb { font-size: 10px; }
.page-junior-high .btn .fb-mark { width: 14px; height: 14px; font-size: 10px; }

.btn-row { display: flex; gap: 6px; }
.btn-row-stack { flex-direction: column; gap: 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  width: 100%;
  line-height: 1.25;
}
.btn:hover { text-decoration: none; }
.btn.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: none;
}
.btn.primary:hover { background: var(--brand-dark); }
.btn.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}
.btn.btn-fb {
  color: var(--brand);
  border-color: #9fc2f0;
  background: #fff;
  font-size: 12px;
}
.btn .fb-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: #1877f2;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  flex: 0 0 auto;
}
.btn.is-disabled,
.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
  box-shadow: none;
}

.empty-state {
  background: var(--panel);
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
}
.empty-state h2 { margin: 0 0 6px; font-size: 15px; font-weight: 900; }
.empty-state p { margin: 0; font-size: 13px; color: var(--muted); }

/* Destination-first reminder: one per fleet-selection page, under .page-head */
.destination-fleet-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 11px 12px;
  background: var(--brand-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
  color: #0f172a;
  line-height: 1.4;
}
.destination-fleet-hint .dfh-ico {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
  margin-top: 1px;
}
.destination-fleet-hint .dfh-body {
  min-width: 0;
  flex: 1;
}
.destination-fleet-hint .dfh-title {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--brand-dark);
  word-break: break-word;
}
.destination-fleet-hint .dfh-sub {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  word-break: break-word;
}
@media (max-width: 480px) {
  .destination-fleet-hint {
    padding: 10px 11px;
    margin-bottom: 12px;
  }
  .destination-fleet-hint .dfh-title {
    font-size: 13px;
  }
}

.hint-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
  color: #1e3a8a;
  font-weight: 600;
  line-height: 1.45;
}
.hint-box .hint-ico {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  margin-top: 1px;
}
.hint-box p { margin: 0; }

.back-link {
  display: inline-flex;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 800;
}
.status-line { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.error-box {
  margin: 10px 0;
  padding: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #991b1b;
  font-size: 13px;
}

@media (max-width: 380px) {
  .type-card .title,
  .city-card .title { font-size: 16px; }
  .action-card .title { font-size: 18px; }
  .btn.btn-fb { font-size: 11px; }
}
