/* ── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #e0312e;
  --red-dark: #c0201d;
  --red-light: #fef2f2;
  --gold: #d4a017;
  --bg: #f8f7f5;
  --card-bg: #fff;
  --text: #1a1a1a;
  --text-sub: #666;
  --border: #e5e5e5;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.14);
}

body {
  font-family: -apple-system, "Hiragino Sans", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────── */
.header {
  background: var(--red);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 28px; }
.logo-text { font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }
.logo-sub {
  font-size: 11px;
  opacity: 0.8;
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── Nav bar ──────────────────────────────────────────── */
.nav-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 54px;
  z-index: 99;
  box-shadow: var(--shadow);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
}
.nav-selectors {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.select-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.select-group label {
  font-size: 10px;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.select-group select {
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.2s;
  min-width: 130px;
}
.select-group select:not(:disabled):hover { border-color: var(--red); }
.select-group select:disabled { background: #f5f5f5; color: #aaa; cursor: default; }
.nav-arrow { color: #bbb; font-size: 20px; margin-top: 14px; }

/* ── Filter bar ───────────────────────────────────────── */
.filter-bar {
  background: #fafafa;
  border-bottom: 1px solid var(--border);
}
.filter-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.filter-cats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.cat-chip {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  background: #fff;
  color: var(--text-sub);
  transition: all 0.15s;
  white-space: nowrap;
}
.cat-chip:hover { border-color: var(--red); color: var(--red); }
.cat-chip.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 600;
}
.filter-sort {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-sub);
  white-space: nowrap;
}
.filter-sort select {
  padding: 5px 24px 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  background: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

/* ── Main / Splash ────────────────────────────────────── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.splash {
  text-align: center;
  padding: 80px 20px;
}
.splash-icon { font-size: 64px; margin-bottom: 20px; }
.splash h2 { font-size: 28px; margin-bottom: 10px; }
.splash p { color: var(--text-sub); font-size: 16px; margin-bottom: 30px; }
.splash-tags {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.splash-tags span {
  padding: 8px 24px;
  background: var(--red-light);
  color: var(--red);
  border-radius: 20px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid #fecaca;
  transition: all 0.15s;
}
.splash-tags span:hover { background: var(--red); color: #fff; }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px;
}
.results-info { font-size: 14px; color: var(--text-sub); }
.results-info strong { color: var(--text); }

.tabelog-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--red);
  color: #fff;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.15s;
}
.tabelog-link:hover { background: var(--red-dark); }

/* ── Restaurant grid ──────────────────────────────────── */
.rst-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.rst-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.rst-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.rst-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #f0ede8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #ccc;
  flex-shrink: 0;
}
.rst-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rst-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }

.rst-awards {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.rst-award-badge {
  background: linear-gradient(135deg, #d4a017, #f0c040);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.rst-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.rst-cats {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.rst-cat {
  font-size: 11px;
  color: var(--text-sub);
  background: #f5f5f5;
  padding: 2px 8px;
  border-radius: 4px;
}

.rst-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.rating-tabelog {
  display: flex;
  align-items: center;
  gap: 5px;
}
.rating-score {
  font-size: 20px;
  font-weight: 800;
  color: var(--red);
}
.rating-label { font-size: 10px; color: var(--text-sub); }
.rating-count { font-size: 12px; color: var(--text-sub); }
.rating-stars { color: var(--gold); font-size: 12px; }

.rst-station {
  font-size: 12px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 4px;
}

.rst-price {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-sub);
}
.rst-price span { display: flex; align-items: center; gap: 3px; }

/* ── Pagination ───────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 36px;
  flex-wrap: wrap;
}
.page-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: all 0.15s;
}
.page-btn:hover { border-color: var(--red); color: var(--red); }
.page-btn.active { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.page-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Loading / No result ──────────────────────────────── */
.loading {
  text-align: center;
  padding: 80px 20px;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.no-result {
  text-align: center;
  padding: 80px 20px;
  font-size: 16px;
  color: var(--text-sub);
}
.no-result div { font-size: 48px; margin-bottom: 12px; }

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 740px;
  margin: auto;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 16px;
  border: none;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal photo gallery */
.modal-gallery {
  width: 100%;
  height: 260px;
  overflow: hidden;
  background: #1a1a1a;
  display: flex;
  gap: 2px;
}
.modal-gallery img {
  height: 100%;
  object-fit: cover;
  flex: 1;
  min-width: 0;
}
.modal-gallery-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #f0ede8, #e8e0d8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
}

.modal-body { padding: 24px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.modal-title { font-size: 22px; font-weight: 800; line-height: 1.3; flex: 1; }
.modal-rating-box {
  text-align: center;
  background: var(--red-light);
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 16px;
  flex-shrink: 0;
}
.modal-rating-score { font-size: 28px; font-weight: 900; color: var(--red); }
.modal-rating-label { font-size: 10px; color: var(--text-sub); }
.modal-review-count { font-size: 12px; color: var(--text-sub); }

.modal-cats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.modal-cat {
  padding: 4px 12px;
  background: #f5f5f5;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-sub);
}

.modal-description {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-sub);
  margin-bottom: 16px;
  padding: 12px;
  background: #fafafa;
  border-radius: 8px;
  border-left: 3px solid var(--red);
}

.modal-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.modal-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.modal-info-label {
  font-size: 11px;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.modal-info-value { font-size: 14px; color: var(--text); font-weight: 500; }

.modal-section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Reviews */
.review-list { display: flex; flex-direction: column; gap: 12px; }
.review-item {
  background: #fafafa;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--border);
}
.review-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.review-author { font-size: 13px; font-weight: 600; }
.review-rating { color: var(--gold); font-size: 12px; }
.review-text { font-size: 13px; line-height: 1.6; color: var(--text-sub); }

/* Taiwan reviews */
.tw-review-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tw-review-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  transition: all 0.15s;
  background: #fff;
}
.tw-review-link:hover { border-color: var(--red); background: var(--red-light); }
.tw-review-link-icon { font-size: 20px; }

/* Action buttons */
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.15s;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--red); color: var(--red); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .rst-grid { grid-template-columns: 1fr; }
  .nav-selectors { gap: 6px; }
  .select-group select { min-width: 100px; font-size: 13px; }
  .modal-header { flex-direction: column; }
  .modal-gallery { height: 180px; }
}
