/* 香港中醫診所及醫師目錄平台 - 全域樣式 */
:root {
  --primary: #2e86de;
  --primary-dark: #1d5f99;
  --accent: #f39c12;
  --lightblue: #00ccff;
  --bg: #f0f6fb;
  --card: #ffffff;
  --text: #2a2a2a;
  --muted: #5b7184;
  --border: #dbe7f1;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 14px 0;
  margin-bottom: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner { display: flex; align-items: center; gap: 24px; }
.logo { font-size: 20px; font-weight: 800; color: #fff; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.logo-icon { width: 48px; height: 48px; border-radius: 6px; display: block; }
.main-nav { display: flex; gap: 18px; margin-left: auto; }
.main-nav a { color: #fff; font-size: 15px; opacity: .9; }
.main-nav a:hover { opacity: 1; text-decoration: none; }

/* Hamburger 按鈕（僅手機顯示） */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background: #fff;
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.nav-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* 滑出式選單（off-canvas drawer，右側滑出）*/
/* 預設隱藏（桌面版），僅手機版顯示 */
.drawer-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s;
  z-index: 200;
}
.drawer-overlay.open { opacity: 1; visibility: visible; }
.drawer {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 280px;
  max-width: 80vw;
  background: #fff;
  z-index: 210;
  transform: translateX(100%);
  transition: transform .3s ease;
  flex-direction: column;
  box-shadow: -2px 0 12px rgba(0,0,0,.15);
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.drawer-logo { width: 40px; height: 40px; border-radius: 6px; }
.drawer-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.drawer-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.drawer-nav a {
  display: block;
  padding: 14px 20px;
  color: var(--text);
  font-size: 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.drawer-nav a:hover { background: var(--bg); text-decoration: none; }
body.drawer-open { overflow: hidden; }

@media (max-width: 768px) {
  .main-nav { display: none; }
  .nav-toggle { display: flex; margin-left: auto; }
  /* 手機版顯示 drawer（右側滑出） */
  .drawer-overlay { display: block; }
  .drawer { display: flex; }
}

main { padding: 24px 0; min-height: 60vh; }

/* Hero */
.home-hero {
  background: linear-gradient(135deg, var(--primary), #3a9be0);
  color: #fff;
  border-radius: var(--radius);
  padding: 40px 32px;
  margin-bottom: 32px;
  text-align: center;
}
.home-hero h1 { font-size: 28px; margin-bottom: 8px; }
.home-hero p { opacity: .9; margin-bottom: 20px; }
.home-search .search-row {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 800px; margin: 0 auto;
}
.home-search select, .home-search input {
  padding: 10px 12px; border: none; border-radius: 6px; font-size: 14px;
}
.home-search input[type="text"] { flex: 1; min-width: 200px; }
.home-search button {
  padding: 10px 24px; border: none; background: var(--lightblue); color: #fff;
  border-radius: 6px; font-weight: 700; cursor: pointer; font-size: 15px;
}

/* Sections */
section { margin-bottom: 36px; }
section h2 { font-size: 20px; margin-bottom: 16px; color: var(--primary-dark); }

/* Region browsing */
.region-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.region-group {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.region-group h3 { font-size: 16px; color: var(--primary-dark); margin-bottom: 12px; border-bottom: 2px solid var(--primary); padding-bottom: 6px; }
.admin-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.admin-item {
  display: flex; justify-content: space-between; padding: 6px 8px; border-radius: 6px;
  font-size: 13px; color: var(--text);
}
.admin-item:hover { background: #e3eef8; text-decoration: none; }
.admin-count { color: var(--muted); font-size: 12px; }

/* News */
.news-list { display: grid; gap: 12px; }
.news-item {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px;
}
.news-title { font-weight: 700; }
.news-clinic { font-size: 13px; color: var(--primary); }
.news-date { font-size: 12px; color: var(--muted); }

/* Search page */
.search-hero { margin-bottom: 20px; }
.sub-district-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 20px;
}
.sd-label { font-size: 13px; color: var(--muted); font-weight: 600; margin-right: 4px; white-space: nowrap; }
.sd-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 16px; font-size: 13px;
  background: #ecf4fb; color: var(--primary-dark); border: 1px solid transparent;
  text-decoration: none; white-space: nowrap;
}
.sd-item:hover { background: #dfebf5; text-decoration: none; }
.sd-item.active { background: var(--primary); color: #fff; }
.sd-count { font-size: 11px; opacity: .7; }
.sd-none { font-size: 13px; color: var(--muted); }
.results-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.result-type-tabs { display: flex; gap: 8px; }
.result-count { font-size: 13px; color: var(--muted); }
.tab { padding: 8px 20px; border-radius: 20px; background: var(--card); border: 1px solid var(--border); color: var(--text); font-size: 14px; text-decoration: none; white-space: nowrap; }
.tab:hover { border-color: var(--primary); text-decoration: none; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* 前台分頁 */
.pagination { margin-top: 24px; display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 7px 13px; border: 1px solid var(--border); border-radius: 8px;
  text-decoration: none; font-size: 13px; color: var(--text); background: var(--card); white-space: nowrap;
}
.pagination a:hover { border-color: var(--primary); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { color: #b9c2bb; background: #f0f2f0; cursor: not-allowed; }
.pagination .ellipsis { border: none; padding: 7px 4px; color: var(--muted); }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; transition: box-shadow .15s, transform .15s; display: block; color: var(--text);
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); transform: translateY(-2px); text-decoration: none; }
.card-name { font-size: 16px; font-weight: 700; color: var(--primary-dark); }
.ename { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 6px; }
.card-meta { margin: 8px 0; }
.badge {
  display: inline-block; background: #e3eef8; color: var(--primary-dark); font-size: 12px;
  padding: 2px 8px; border-radius: 10px; margin-right: 6px;
}
.card-addr { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.card-quals { font-size: 12px; color: var(--muted); }
.card-footer { display: flex; justify-content: space-between; font-size: 13px; margin-top: 8px; }
.doc-count { color: var(--primary); font-weight: 600; }
.phone { color: var(--muted); }

/* Detail pages */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.detail-header { margin-bottom: 20px; }
.detail-header h1 { font-size: 26px; color: var(--primary-dark); }
.name-en { color: var(--muted); margin: 4px 0 8px; }
.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 24px; }
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }

.info-section {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
}
.info-section h2 { font-size: 17px; color: var(--primary-dark); margin-bottom: 12px; }
.info-table { width: 100%; border-collapse: collapse; }
.info-table th { text-align: left; width: 110px; color: var(--muted); font-size: 13px; padding: 6px 0; vertical-align: top; }
.info-table td { font-size: 14px; padding: 6px 0; }

/* 資歷列表：與「資歷/成就」標題左邊對齊 */
.quals-list {
  margin: 0;
  padding-left: 1.15em;      /* 僅留圓點空間，文字與標題對齊 */
  list-style-position: outside;
}
.quals-list li {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
  padding-left: 0.35em;      /* 圓點與文字間距 */
}

/* 所屬診所連結 */
.clinic-links { display: grid; gap: 10px; }
.clinic-link-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px;
  display: block; color: var(--text); text-decoration: none;
}
.clinic-link-item:hover { background: #eaf3fa; text-decoration: none; }
.clinic-link-name { font-weight: 700; color: var(--primary-dark); }
.clinic-link-addr { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Doctor list */
.doctor-list { display: grid; gap: 10px; }
.doctor-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; display: block; color: var(--text);
}
.doctor-item:hover { background: #eaf3fa; text-decoration: none; }
.doctor-name { font-weight: 700; color: var(--primary-dark); }
.doctor-quals { font-size: 12px; color: var(--muted); margin: 4px 0; }
.doctor-schedule { font-size: 11px; color: var(--muted); }
.doctor-schedule span { margin-right: 10px; }

/* Reviews */
.review-item { border-top: 1px solid var(--border); padding: 12px 0; }
.review-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.stars { color: var(--accent); font-size: 14px; }
.review-user { font-size: 13px; font-weight: 600; }
.review-date { font-size: 12px; color: var(--muted); }
.review-content { font-size: 14px; }
.review-form { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.review-form h3 { font-size: 15px; margin-bottom: 8px; }
.rating-select { display: flex; gap: 12px; margin-bottom: 8px; }
.review-form textarea { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit; margin-bottom: 8px; }
.review-form button, .btn {
  padding: 10px 20px; border: none; background: var(--primary); color: #fff; border-radius: 6px; cursor: pointer; font-weight: 600;
}
.review-login-hint {
  border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px;
  font-size: 14px; color: var(--muted); text-align: center;
}

/* AdSense 廣告位 */
.adsense-slot {
  margin: 28px 0;
  text-align: center;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.adsense-slot ins { display: block; }

/* Mini map */
.mini-map { height: 220px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 16px; }
.side-actions { display: flex; flex-direction: column; gap: 8px; }
.side-actions button {
  padding: 10px; border: 1px solid var(--primary); background: #fff; color: var(--primary-dark);
  border-radius: 6px; cursor: pointer; font-size: 14px; white-space: nowrap;
}
.side-actions button:hover { background: var(--primary); color: #fff; }

/* Account */
.account-nav { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.account-section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.account-section h2 { font-size: 17px; color: var(--primary-dark); margin-bottom: 12px; }
.account-list { display: grid; gap: 10px; }
.account-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.ai-head { display: flex; justify-content: space-between; align-items: center; }
.ai-clinic { font-weight: 600; color: var(--primary-dark); }
.ai-date { font-size: 12px; color: var(--muted); }
.ai-notes { font-size: 13px; margin-top: 6px; color: var(--text); }
.ai-sub { font-size: 13px; color: var(--muted); margin: 8px 0 4px; font-weight: 600; }
.muted { color: var(--muted); margin-bottom: 16px; }

/* Auth */
.auth-page { display: flex; justify-content: center; align-items: center; padding: 48px 16px; min-height: 70vh; }
.auth-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 40px 36px; width: 100%; max-width: 420px;
  box-shadow: 0 6px 24px rgba(0,0,0,.06);
}
.auth-logo { font-size: 40px; text-align: center; margin-bottom: 12px; }
.auth-box h1 { font-size: 24px; text-align: center; color: var(--primary-dark); margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.auth-box .form-group { margin-bottom: 16px; }
.auth-box .form-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.input-wrap { position: relative; }
.input-wrap .input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 15px; pointer-events: none;
}
.input-wrap input {
  width: 100%; padding: 11px 12px 11px 38px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: #fafbfa; transition: border-color .15s, box-shadow .15s;
}
.input-wrap input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,125,91,.12); background: #fff; }
.form-row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-size: 13px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; color: var(--text); cursor: pointer; }
.link { color: var(--primary); text-decoration: none; }
.link:hover { text-decoration: underline; }
.auth-divider { display: flex; align-items: center; margin: 22px 0 16px; color: var(--muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-divider span { padding: 0 12px; white-space: nowrap; }
.auth-alt { text-align: center; margin-top: 16px; font-size: 14px; }

/* 按鈕 - 文字不換行 */
.btn { white-space: nowrap; }
.btn-block { width: 100%; padding: 12px; display: block; text-align: center; box-sizing: border-box; }
.btn-outline {
  background: #fff; border: 1.5px solid var(--primary); color: var(--primary);
  border-radius: 8px; padding: 11px; font-weight: 600; cursor: pointer; display: inline-block;
  text-align: center; text-decoration: none; transition: background .15s, color .15s;
}
.btn-outline:hover { background: var(--primary); color: #fff; text-decoration: none; }

/* 用戶中心詳細設定 */
.profile-form .form-group { margin-bottom: 14px; }
.profile-form .form-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.profile-form input, .profile-form select, .profile-form textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit;
}

/* Empty & misc */
.empty { text-align: center; color: var(--muted); padding: 30px; }
.page-404 h1 { font-size: 60px; color: var(--primary); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-box {
  background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 420px;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.modal-box h3 { font-size: 18px; margin-bottom: 6px; color: var(--primary-dark); }
.modal-box .btn-block { margin-top: 10px; }
.near-actions { margin-top: 8px; }
.radius-row { display: flex; align-items: center; gap: 14px; }
.radio-inline { display: flex; align-items: center; gap: 4px; font-size: 14px; cursor: pointer; }
.pick-coord { cursor: pointer; }
.pick-coord:hover { color: var(--primary); }
.modal-actions { margin-top: 14px; text-align: right; }

/* 選點地圖 + 中央準星 */
.pick-map-wrap { position: relative; }
.pick-map-wrap .crosshair {
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 500;
}
.pick-map-wrap .crosshair::before,
.pick-map-wrap .crosshair::after {
  content: '';
  position: absolute;
  background: #e74c3c;
  opacity: .85;
}
.pick-map-wrap .crosshair::before { width: 2px; height: 26px; top: -13px; left: -1px; }
.pick-map-wrap .crosshair::after { width: 26px; height: 2px; top: -1px; left: -13px; }
.pick-map-wrap .crosshair-center {
  position: absolute;
  top: 50%; left: 50%;
  width: 8px; height: 8px;
  transform: translate(-50%, -50%);
  background: #e74c3c;
  border-radius: 50%;
  border: 1px solid #fff;
  pointer-events: none;
  z-index: 500;
}
#pickMap.leaflet-container { cursor: crosshair !important; }

/* 距離顯示 */
.distance { font-weight: 700; color: var(--primary); }

/* 附近診所頁 */
.near-header { margin-bottom: 8px; }
.near-header h1 { font-size: 22px; color: var(--primary-dark); margin-bottom: 6px; }
.near-header .muted { margin-bottom: 14px; }
.near-radius-select {
  display: flex; gap: 8px;
  margin-top: 4px; margin-bottom: 28px;
}
.near-page .cards { margin-top: 0; }

/* Footer */
.site-footer { background: var(--primary-dark); color: #fff; padding: 20px 0; margin-top: 40px; font-size: 13px; opacity: .9; }
.site-footer > div {
	text-align: center;
}