/* 斗六景點店家 CMS - 共用樣式 */
:root {
  --primary: #9A7B2E;
  --primary-light: #CDA649;
  --accent: #E0B84D;
  --bg: #f7f5f0;
  --text: #2a2a2a;
  --text-light: #5a5a5a;
  --white: #ffffff;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --radius: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --lang-bar-h: 48px;
  --content-max: 100%;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding-top: calc(var(--lang-bar-h) + var(--safe-top));
  padding-bottom: calc(80px + var(--safe-bottom));
  position: relative;
}

/* 語言列 */
.lang-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  width: 100%;
  max-width: 100%;
  height: var(--lang-bar-h);
  background: var(--primary);
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  padding-top: var(--safe-top);
  box-sizing: content-box;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.lang-btn {
  flex: 1;
  padding: 14px 0;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.25s ease;
  -webkit-appearance: none;
  appearance: none;
}

.lang-btn.active {
  background: var(--primary-light);
  color: var(--white);
}

.lang-btn:active { opacity: 0.9; }

/* Hero */
.hero {
  text-align: center;
  padding: 28px 20px 16px;
  background: linear-gradient(180deg, #f5edd8 0%, var(--bg) 100%);
}

.hero h1 {
  font-size: clamp(28px, 8vw, 42px);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.hero .subtitle {
  font-size: 14px;
  color: var(--text-light);
  letter-spacing: 0.05em;
}

/* Gallery */
.gallery-section { margin: 12px 0 24px; }

.gallery-wrap {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0;
  padding: 0;
}

.gallery::-webkit-scrollbar { display: none; }

.gallery-item {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
  position: relative;
  aspect-ratio: 16 / 10;
  background: #e8dfc8;
  overflow: hidden;
  box-sizing: border-box;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  color: white;
  font-size: 13px;
}

.gallery-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d4c9a8;
  transition: all 0.25s;
}

.dot.active {
  background: var(--primary);
  width: 20px;
  border-radius: 4px;
}

/* Section title */
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
}

/* Intro */
.intro-section { padding: 0 16px 32px; }

.intro-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.intro-card h2 {
  font-size: 17px;
  color: var(--primary);
  margin-bottom: 12px;
  font-weight: 700;
}

.intro-card p {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 14px;
  text-align: justify;
}

.intro-card p:last-of-type { margin-bottom: 0; }

.info-list {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5dfc8;
  font-size: 14px;
  color: var(--text-light);
}

.info-list dt {
  font-weight: 600;
  color: var(--primary);
  margin-top: 10px;
}

.info-list dd {
  margin-left: 0;
  margin-bottom: 4px;
}

/* 360 + Map */
.extra-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.btn-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.btn-menu:active { transform: scale(0.98); }
.btn-menu svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}
.btn-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: #fff;
  color: var(--text);
  border: 1.5px solid #d4c9a8;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.btn-link:active { transform: scale(0.98); }
.btn-link:hover { border-color: var(--primary); color: var(--primary); }
.btn-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}
.btn-360 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #9A7B2E 0%, #CDA649 100%);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(154, 123, 46, 0.35);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.btn-360:active { transform: scale(0.98); }

.btn-360 svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}

.map-wrap {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 75%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #e8e4d8;
}

.map-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Voice FAB */
.voice-fab {
  position: fixed;
  right: max(16px, var(--safe-right));
  bottom: calc(80px + var(--safe-bottom));
  z-index: 90;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: 0 6px 20px rgba(154, 123, 46, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.voice-fab:active { transform: scale(0.92); }

.voice-fab.playing {
  background: var(--accent);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(224, 184, 77, 0.5); }
  50% { box-shadow: 0 6px 28px rgba(224, 184, 77, 0.8); }
}

.voice-fab svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.voice-tooltip {
  position: absolute;
  right: 66px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.75);
  color: white;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.voice-fab:hover .voice-tooltip,
.voice-fab.show-tip .voice-tooltip { opacity: 1; }

/* Footer：全寬（不用 100%，避免橫向溢出／合成異常） */
.footer {
  background: #4A3A18;
  color: rgba(255,255,255,0.85);
  padding: 28px 16px calc(20px + var(--safe-bottom));
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  position: relative;
  clear: both;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer .copy {
  margin-top: 12px;
  opacity: 0.7;
  font-size: 12px;
}

/* ===== List page ===== */
.list-body {
  padding-top: var(--safe-top);
  padding-bottom: calc(24px + var(--safe-bottom));
}

.list-header {
  background: var(--primary);
  color: white;
  padding: 16px 16px 14px;
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  width: 100%;
  box-sizing: border-box;
}

.list-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
}

.list-header .sub {
  font-size: 12px;
  opacity: 0.85;
  text-align: center;
  margin-top: 2px;
}

.filter-panel {
  background: var(--white);
  padding: 16px;
  margin: 12px 12px 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
}
.filter-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
  opacity: 1;
  visibility: visible;
  position: relative;
  z-index: 1;
}

.filter-row { margin-bottom: 14px; }
.filter-row:last-child { margin-bottom: 0; }

.filter-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}

.filter-panel select {
  width: 100%;
  padding: 11px 14px;
  font-size: 15px;
  border: 1.5px solid #e5dfc8;
  border-radius: 10px;
  background: #fafbfa;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239A7B2E' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-btn {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 20px;
  border: 1.5px solid #d4c9a8;
  background: white;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-appearance: none;
  appearance: none;
  font-weight: 500;
}

.tag-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.result-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 6px;
  font-size: 13px;
  color: var(--text-light);
}

.result-bar strong {
  color: var(--primary);
  font-weight: 700;
}

.reset-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
}

.list-wrap { padding: 0 12px 20px; }

/* 列表：單欄 Flex，不用 absolute 偽元素（避免長列表跑版） */
.shop-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid #e8e4d8;
  box-shadow: none;
  overflow: hidden;
}

.shop-item {
  display: flex;
  flex-direction: column;
  padding: 14px 16px 14px 14px;
  border-bottom: 1px solid #f0ebe0;
  border-left: 4px solid var(--accent);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: #fff;
  position: static;
  box-sizing: border-box;
}

.shop-item:last-child { border-bottom: none; }

.shop-item .name {
  display: block;
  padding-left: 0;
  word-break: break-word;
}

.shop-item .meta {
  display: block;
  padding-left: 0;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
  font-weight: 400;
}

.shop-item:active { background: #f9f6ef; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-size: 15px;
  display: none;
}

.empty-state.show { display: block; }

.footer-link {
  text-align: center;
  padding: 8px 16px 16px;
}

.footer-link a {
  color: var(--primary);
  font-size: 14px;
  text-decoration: none;
  font-weight: 600;
}

/* RWD ≥768 */
@media (min-width: 768px) {
  :root {
    --content-max: 720px;
    --lang-bar-h: 52px;
  }

  body { box-shadow: 0 0 40px rgba(0,0,0,0.06); }

  .gallery {
    padding: 0 20px;
    gap: 12px;
  }

  .gallery-item {
    flex: 0 0 88%;
    border-radius: var(--radius);
    overflow: hidden;
  }

  .gallery-item:last-child { margin-right: 20px; }

  .intro-section { padding-left: 28px; padding-right: 28px; }

  .intro-card { padding: 28px; }

  .voice-fab {
    width: 60px;
    height: 60px;
    right: calc(50% - 360px + 20px);
  }

  .filter-panel {
    margin: 20px auto 0;
    max-width: 720px;
    padding: 20px 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
  }

  .filter-row { margin-bottom: 0; }
  .filter-row:last-child { grid-column: 1 / -1; }

  .result-bar, .list-wrap, .footer-link {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 1024px) {
  :root { --content-max: 900px; }

  .gallery-item { flex: 0 0 82%; }

  .intro-card {
    padding: 36px 40px;
    border-radius: 16px;
  }

  .info-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 20px;
    align-items: baseline;
  }

  .info-list dt { margin-top: 0; }

  .btn-360,
  .btn-menu,
  .btn-link {
    max-width: 360px;
    margin: 0 auto;
  }

  .voice-fab {
    width: 64px;
    height: 64px;
    right: calc(50% - 450px + 24px);
  }

  .filter-panel,
  .result-bar,
  .list-wrap,
  .footer-link { max-width: 900px; }
}

@media (min-width: 1280px) {
  :root { --content-max: 960px; }
  .gallery-item { flex: 0 0 80%; }
  .filter-panel,
  .result-bar,
  .list-wrap,
  .footer-link { max-width: 960px; }
}

@media (hover: hover) and (pointer: fine) {
  .lang-btn:hover { background: rgba(255,255,255,0.12); }
  .lang-btn.active:hover { background: var(--primary-light); }
  .btn-360:hover { transform: translateY(-1px); }
  .voice-fab:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 24px rgba(154, 123, 46, 0.5);
  }
  .shop-item:hover { background: #f9f6ef; }
}


/* ===== List page + Footer 全寬 ===== */
body.list-body {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  box-shadow: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  padding-bottom: calc(24px + var(--safe-bottom));
  overflow-x: hidden;
}

body.list-body .lang-bar {
  width: 100%;
  max-width: 100%;
  left: 0;
  right: 0;
}

body.list-body .list-header {
  position: relative !important;
  top: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  border-radius: 0;
  box-sizing: border-box;
}

/* 篩選／列表：與螢幕同寬，僅保留左右小間距 */
body.list-body .filter-panel,
body.list-body .result-bar,
body.list-body .list-wrap,
body.list-body .footer-link {
  max-width: 100% !important;
  width: auto !important;
  margin-left: 12px !important;
  margin-right: 12px !important;
  box-sizing: border-box;
}

body.list-body .filter-panel {
  margin-top: 12px !important;
  display: block;
}

body.list-body .list-wrap {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.list-body .shop-list,
body.list-body .shop-item {
  max-width: 100%;
  box-sizing: border-box;
}

/* 內頁 footer 全寬貼邊 */
body .footer,
footer.footer {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
}

@media (min-width: 768px) {
  body.list-body .filter-panel {
    margin: 16px 16px 0 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
  }
  body.list-body .filter-row {
    margin-bottom: 0;
  }
  body.list-body .filter-row:last-child {
    grid-column: 1 / -1;
  }
  body.list-body .result-bar,
  body.list-body .list-wrap,
  body.list-body .footer-link {
    margin-left: 16px !important;
    margin-right: 16px !important;
  }

  /* 桌面：中段內容可置中限寬，footer 仍全寬 */
  .intro-section,
  .gallery {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 1024px) {
  .intro-section,
  .gallery {
    max-width: 900px;
  }
}

@media (min-width: 1280px) {
  .intro-section,
  .gallery {
    max-width: 960px;
  }
}
