:root {
  --brand: #991b1e;
  --brand-hover: #7e171a;
  --bg: #f5f6fa;
  --surface: #fff;
  --text: #182132;
  --muted: #778196;
  --border: #e3e7ef;
  --shadow: 0 2px 5px #18213206;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Noto Sans Lao",
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: none;
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Header */

.header {
  background: white;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1600px;
  margin: auto;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  /* color: white;
  background: var(--brand); 
  border-radius: 50%;
  box-shadow: 0 3px 5px #991b1e20; */
  object-fit: cover;
}
.logo {
  width: 100%;
}

.brand h1 {
  font-size: 16px;
  letter-spacing: -0.5px;
}

.brand p {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  padding: 3px;
  border-radius: 20px;
  border: 1px solid var(--border);
  gap: 2px;
  flex-shrink: 0;
}

.lang-btn {
  border: 0;
  background: transparent;
  padding: 5px 11px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  line-height: 1;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: 0 1px 4px rgba(24, 33, 50, 0.12);
  font-weight: 750;
}

.flag-icon {
  font-size: 13px;
  line-height: 1;
}

.navigation {
  display: flex;
  gap: 8px;
}

.nav-button {
  min-height: 44px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
}

.nav-button.current {
  color: var(--brand);
  border-color: var(--brand);
  font-weight: 700;
}

/* Mobile-first layout */

.layout {
  max-width: 1600px;
  margin: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}

/* show password */


.directory {
  order: 2;
}

.directory-heading {
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.directory-heading h2 {
  font-size: 15px;
}

.count {
  font-size: 12px;
  color: var(--muted);
}

.directory-list {
  padding: 0 12px 12px;
  display: grid;
  gap: 10px;
  align-content: start;
  max-height: 410px;
  overflow-y: auto;
}

.shop-card {
  width: 100%;
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  text-align: left;
  background: white;
  border: 1px solid var(--border);
  border-radius: 13px;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.shop-card:hover {
  background: #fafbfc;
}

.shop-card.selected {
  border-color: #ef9ca7;
  background: #fff8f9;
  box-shadow: 0 0 0 1px #ef9ca725;
}

.shop-logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 27px;
  background: var(--logo-bg, #f6eee8);
  justify-content: center;
  overflow: hidden;
}

.shop-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.shop-text {
  min-width: 0;
}

.shop-title {
  font-size: 12px;
  font-weight: 750;
  line-height: 1.6;
}

.small-badge {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 5px;
  border-radius: 4px;
  background: var(--brand);
  color: white;
  font-size: 10px;
  vertical-align: 1px;
}

.shop-meta {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
}

.directory-footer {
  padding: 15px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.link-button {
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.empty {
  padding: 30px 15px;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
}

/* Search and map */

.map-column {
  order: 1;
  min-width: 0;
}

.search-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-wrap .icon {
  position: absolute;
  left: 13px;
  top: 14px;
  color: #9099ab;
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 46px;
  padding: 10px 12px 10px 39px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  color: var(--text);
  font-size: 13px;
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px #991b1e10;
}

.category-select {
  width: auto;
  min-width: 120px;
  max-width: 220px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  font-size: 12px;
  cursor: pointer;
}
.category-select:focus{
  border-color: var(--brand);
}
.category-select.has-selection {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px #991b1e10;
}
.origin-controls {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}

.origin-button,
.origin-clear-button {
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.origin-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  white-space: nowrap;
}

.origin-button:hover,
.origin-button.active {
  border-color: #1a73e8;
  background: #1a73e8;
  color: #fff;
}

.origin-clear-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  background: #fff;
  color: #64748b;
}

.origin-clear-button span:first-child {
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}

.origin-clear-button:hover {
  border-color: #fda4af;
  background: #fff1f2;
  color: #be123c;
}

.origin-button:focus-visible,
.origin-clear-button:focus-visible {
  outline: 3px solid #1a73e833;
  outline-offset: 2px;
}

@media (max-width: 639px) {
      .route-marker {
    width: 11px;
    height: 16px;
  }

  .search-toolbar {
    flex-wrap: wrap;
  }

  .search-wrap {
    flex-basis: 100%;
  }

  .category-select {
    flex: 1;
    min-width: 0;
  }

  .origin-button,
  .origin-clear-button {
    min-height: 40px;
    border-radius: 10px;
    font-size: 11px;
  }

  .origin-button {
    padding: 0 10px;
  }


  .origin-clear-button {
    width: 40px;
    justify-content: center;
    padding: 0;
  }

  .origin-clear-button span:last-child {
    display: none;
  }
}
.reset-filter {
  background-color: #fff;
  border: 1px solid var(--border);
  font-size: 12px;
  border-radius: 5px;
  padding: 0 10px;
  width: 92px;
}
.zone-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 13px;
  scrollbar-width: none;
}

.zone-chip {
  min-height: 40px;
  padding: 8px 15px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
  color: #536075;
  font-size: 12px;
  font-weight: 650;
}

.zone-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}



/* ========================================
   MAP
======================================== */

.map-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
}

.map-viewport {
  width: 100%;
  height: 58vh;
  min-height: 390px;
  max-height: 770px;

  overflow: hidden;
  position: relative;

  background: #fff;

  cursor: grab;

  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;

  /*
   * สำคัญสำหรับ Mobile
   * ให้ JavaScript ควบคุม pan / pinch เอง
   */
  touch-action: none;

  overscroll-behavior: auto;
}

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  background: rgb(255 255 255 / 82%);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  backdrop-filter: blur(2px);
}

.map-loading[hidden] {
  display: none;
}

.map-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #f3c3cc;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: map-loading-spin .75s linear infinite;
}

@keyframes map-loading-spin {
  to { transform: rotate(360deg); }
}


.floor-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.floor-svg text {
  font-family: inherit;
  pointer-events: none;
}

/* ========================================
   MAP BOTTOM
======================================== */

.map-bottom {
  min-height: 66px;

  padding: 10px 14px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  color: var(--muted);
  font-size: 11px;

  border-top: 1px solid #f1f3f7;

  background: white;
}

.map-bottom-left,
.route-legend {
  display: flex;
  align-items: center;
}

.map-bottom-left {
  gap: 14px;
  min-width: 0;
}

.route-legend {
  gap: 12px;
}

.route-legend > span {
  display: flex;
  gap: 5px;
  align-items: center;
  white-space: nowrap;
}

.route-marker {
  width: 14px;
  height: 20px;
  flex-shrink: 0;
  display: inline-block;
  background: center / contain no-repeat;
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 25%));
}

/* หมุด "ฉันอยู่ที่นี่" สีน้ำเงิน */
.route-marker.origin {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-23 -63 46 66'%3E%3Cpath d='M0 0C0 0 -20 -26 -20 -40C-20 -51 -12 -60 0 -60C12 -60 20 -51 20 -40C20 -26 0 0 0 0Z' fill='%231a73e8' stroke='%23fff' stroke-width='5' stroke-linejoin='round' paint-order='stroke'/%3E%3Ccircle cx='0' cy='-40' r='8' fill='%23fff'/%3E%3C/svg%3E");
}

/* หมุดปลายทาง สีแดง */
.route-marker.destination {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-23 -63 46 66'%3E%3Cpath d='M0 0C0 0 -20 -26 -20 -40C-20 -51 -12 -60 0 -60C12 -60 20 -51 20 -40C20 -26 0 0 0 0Z' fill='%23e8365d' stroke='%23fff' stroke-width='5' stroke-linejoin='round' paint-order='stroke'/%3E%3Ccircle cx='0' cy='-40' r='8' fill='%23fff'/%3E%3C/svg%3E");
}

/* ========================================
   MAP ACTIONS
======================================== */

.map-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;

  gap: 8px;

  flex-shrink: 0;
}

/* Zoom controls */

.map-controls {
  position: static;

  display: flex;
  align-items: center;

  gap: 4px;

  padding: 3px;

  border: 1px solid var(--border);
  border-radius: 11px;

  background: #fffffff5;

  box-shadow: 0 2px 8px #1821320b;
}

.control-button {
  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  border: 0;
  border-radius: 8px;

  background: white;

  font-size: 21px;
  line-height: 1;

  transition:
    background 0.15s,
    transform 0.15s;
}

.control-button:hover {
  background: #f1f3f7;
}

.control-button:active {
  transform: scale(0.94);
}

.control-button.fit {
  font-size: 16px;
}

/* 100% */

.zoom-value {
  min-width: 48px;

  text-align: center;

  font-size: 11px;
  font-weight: 700;

  color: var(--text);
}



.map-viewport.dragging {
  cursor: grabbing;
}

.floor-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.floor-svg text {
  font-family: inherit;
  pointer-events: none;
}

.booth {
  cursor: pointer;
}

.booth rect,
.booth ellipse,
.booth polygon {
  transition:
    fill 0.15s,
    stroke 0.15s,
    opacity 0.15s;
}

.booth:hover rect,
.booth:hover ellipse,
.booth:hover polygon {
  stroke: var(--brand);
  stroke-width: 2;
}

.booth.selected rect,
.booth.selected ellipse,
.booth.selected polygon {
  fill: var(--brand);
  stroke: #741417;
  stroke-width: 2;
}
.booth.selected {
  filter: drop-shadow(0 3px 6px #991b1e35);
}

/* @keyframes boothPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.06);
  }

  100% {
    transform: scale(1);
  }
} */

.booth.selected {
  animation: boothPulse 0.35s ease;
}

.booth.selected .booth-label {
  fill: white;
  font-weight: 750;
}

.booth.match:not(.selected) rect,
.booth.match:not(.selected) ellipse,
.booth.match:not(.selected) polygon {
  stroke: var(--brand);
  stroke-width: 2.5;
}

.booth.muted-booth {
  opacity: 0.2;
}

.booth:focus {
  outline: none;
}

.booth:focus-visible rect,
.booth:focus-visible ellipse,
.booth:focus-visible polygon {
  stroke: #182132;
  stroke-width: 3;
}


.control-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: white;
  font-size: 24px;
}

.control-button:hover {
  background: #f1f3f7;
}

.control-button.fit {
  font-size: 17px;
}

.route-notice {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fafafa;
  border: 1.5px dashed #d1d5db;
  color: transparent;
  font-size: 12px;
  line-height: 1.6;
  min-height: 46px;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.route-notice.is-visible {
  background: #fff1e5;
  border: 1.5px solid #f4c08a;
  color: #854c20;
}

/* Detail card */

.desktop-detail {
  display: none;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid #eff1f6;
}

.detail-badge {
  background: var(--brand);
  color: white;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 750;
}

.detail-category {
  color: var(--muted);
  font-size: 11px;
}

.detail-body {
  padding: 18px;
}

.detail-body h2 {
  font-size: 22px;
  letter-spacing: -0.6px;
}



.detail-gallery {
  margin: 16px 0 0;
}

.detail-gallery-main {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: #f1f3f7;
}

.detail-gallery-main > img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.gallery-counter {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgb(0 0 0 / 45%);
  backdrop-filter: blur(4px);
  color: white;
  font-size: 11px;
  font-weight: 650;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 45%);
  backdrop-filter: blur(4px);
  color: white;
  transition: background 0.15s;
}

.gallery-nav:hover {
  background: rgb(0 0 0 / 65%);
}

.gallery-nav.prev { left: 10px; }
.gallery-nav.next { right: 10px; }

.gallery-nav svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border-radius: 16px;
  background: white;
  box-shadow: 0 2px 12px #1821321a;
}

.gallery-thumb {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f3f7;
  cursor: pointer;
  transition: border-color 0.15s;
}

.gallery-thumb.active {
  border-color: var(--brand);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(0 0 0 / 50%);
  color: white;
  font-size: 15px;
  font-weight: 700;
}

.gallery-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.gallery-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #d5d9e2;
  transition: background 0.15s, transform 0.15s;
}

.gallery-dot.active {
  background: var(--brand);
  transform: scale(1.25);
}


.detail-gallery-main > img {
  cursor: zoom-in;
}

dialog.lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: pan-y;
}

dialog.lightbox[open] {
  display: flex;
  animation: lightbox-in 0.2s ease;
}

dialog.lightbox::backdrop {
  background: rgb(0 0 0 / 92%);
}

@keyframes lightbox-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 14%);
  color: white;
  z-index: 1;
  transition: background 0.15s;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgb(255 255 255 / 28%);
}

.lightbox-close {
  top: max(14px, env(safe-area-inset-top, 0px));
  right: 14px;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-nav.prev { left: 14px; }
.lightbox-nav.next { right: 14px; }

.lightbox-close svg,
.lightbox-nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox-counter {
  position: absolute;
  top: max(24px, calc(env(safe-area-inset-top, 0px) + 10px));
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 12px;
  border-radius: 999px;
  background: rgb(255 255 255 / 14%);
  color: white;
  font-size: 12px;
  font-weight: 650;
}

dialog.lightbox.single .lightbox-nav,
dialog.lightbox.single .lightbox-counter {
  display: none;
}

/* Icon */
.icon.fb-logo {
  fill: none;
  stroke: none;
  margin-right:2px;
}
.icon.fb-logo rect { fill: #1877F2; }
.icon.fb-logo path { fill: #fff; }

body.picking-origin .booth { cursor: crosshair; }
body.picking-origin #map-section {
  outline: 3px solid #1a73e8;
  outline-offset: -3px;
}
.detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.detail-logo {
  width: 49px;
  height: 49px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid #0000000a;
  background: var(--logo-bg, #f6eee8);
}

.detail-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 2px;
}

.detail-title {
  min-width: 0;
}

.detail-header h2 {
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.4px;
  overflow-wrap: anywhere;
}

.detail-subtitle {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}



.detail-section {
  margin-top: 18px;
}

.detail-section h3 {
  margin-bottom: 9px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.description {
  color: #59657a;
  font-size: 12px;
  line-height: 1.85;
}

.detail-facts {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #eff1f6;
  font-size: 12px;
  color: #59657a;
}

.fact {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fact .icon {
  color: #98a2b4;
  width: 16px;
  height: 16px;
}

.detail-actions {
  padding: 16px 18px;
  display: grid;
  gap: 9px;
  border-top: 1px solid #eff1f6;
}

.button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  font-size: 12px;
  font-weight: 650;
}

.button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.button.primary:hover {
  background: var(--brand-hover);
}


.close-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #f5f6fa;
  font-size: 23px;
}

.info-dialog {
  width: min(450px, calc(100% - 32px));
  padding: 25px;
  border: 0;
  border-radius: 18px;
  color: var(--text);
}

.info-dialog h2 {
  margin-bottom: 12px;
  font-size: 21px;
}

.info-dialog p {
  margin-bottom: 18px;
  color: #59657a;
  font-size: 13px;
  line-height: 1.8;
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: #182132;
  color: white;
  font-size: 12px;
  text-align: center;
  box-shadow: 0 5px 20px #0002;
}

footer {
  padding: 22px 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* Mobile bottom navigation */
@media (max-width: 639px) {

  /* เว้นพื้นที่ไม่ให้ navigation บังเนื้อหาท้ายหน้า */
  body {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  body:not(.booths-page) #directory {
    display: none;
  }

  /* ย้ายเมนูเดิมจาก Header มาไว้ด้านล่างจอ */
  .navigation {
    position: fixed;
    inset: auto 0 0;
    z-index: 40;

    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 4px;

    width: 100%;
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));

    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgb(24 33 50 / 8%);
  }

  /* แต่ละปุ่มกว้างเท่ากัน และวางไอคอนเหนือข้อความ */
  .navigation .nav-button {
    flex: 1;
    min-width: 0;
    min-height: 56px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;

    padding: 8px 4px;
    border: 0;
    border-radius: 10px;

    background: transparent;
    color: var(--muted);
    text-align: center;
  }

  .navigation .nav-button .icon {
    width: 22px;
    height: 22px;
  }

  /* CSS เดิมซ่อนข้อความบนมือถือ จึงเปิดให้แสดงที่แถบล่าง */
  .navigation .nav-label {
    display: block;
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
  }

  .navigation .nav-button.current {
    background: #fff1f2;
    color: var(--brand);
    font-weight: 700;
  }

  .navigation .nav-button:active {
    background: #fff1f2;
    color: var(--brand);
  }

  /* ยกข้อความแจ้งเตือนขึ้น ไม่ให้ทับ navigation */
  .toast {
    bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  }
  .map-bottom {
    min-height: auto;

    padding: 9px 10px;
    gap: 8px;
  }

  .map-bottom-left {
    gap: 6px;

  }

  .route-legend {
    gap: 8px;
    font-size: 10px;
      flex-direction: column;
  }


  .origin-button,
  .origin-clear-button {
    min-height: 36px;
    border-radius: 9px;
    font-size: 11px;
  }

  .origin-button {
    padding: 0 9px;
  }

  .origin-clear-button {
    width: 36px;
    justify-content: center;
    padding: 0;
  }

  .origin-clear-button span:last-child {
    display: none;
  }

  .map-actions {
    gap: 5px;
  }


  .control-button {
    width: 34px;
    height: 34px;
    border-radius: 7px;

    font-size: 19px;
  }

  .control-button.fit {
    font-size: 14px;
  }

  .zoom-value {
    min-width: 40px;
    font-size: 10px;
  }
    .lightbox-nav {
    width: 38px;
    height: 38px;
  }
}

@media (min-width: 1100px) {
  .layout {
    grid-template-columns: 250px minmax(0, 1fr) 260px;
    align-items: start;
    gap: 16px;
  }

  .directory {
    order: 0;
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 170px);
    min-height: 0;
  }

  .directory-list {
    flex: 1;
    max-height: none;
  }

  .map-column {
    order: 0;
  }

  .search-toolbar {
    gap: 7px;
    margin-bottom: 8px;
  }

  .search-wrap input {
    height: 40px;
    border-radius: 10px;
    font-size: 12px;
  }

  .search-wrap .icon {
    left: 12px;
    top: 11px;
  }

  .category-select {
    min-width: 108px;
    max-width: 190px;
    border-radius: 10px;
    font-size: 11px;
  }

  .zone-filters {
    gap: 7px;
    padding: 1px 0 8px;
  }

  .zone-chip {
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
  }

  /* Give the 4:5 map more vertical room on desktop, so the fitted map is
     larger without stretching its proportions or changing map controls. */
  .map-shell {
    height: clamp(500px, calc(100dvh - 190px), 740px);
  }

  .map-viewport {
    height: auto;
    flex: 1;
    min-height: 0;

    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;

    overscroll-behavior: auto;
  }

  .desktop-detail {
    display: block;
    height: calc(100dvh - 170px);
    max-height: none;
    min-height: 0;
    overflow-y: auto;
  }

  .navigation {
    gap: 24px;
  }
   .map-bottom {
    min-height: 62px;
  }

  .map-actions {
    margin-left: auto;
  }

  .control-button {
    width: 40px;
    height: 40px;
  }
  
  .booths-page .layout {
    grid-template-columns: minmax(0, 1fr) 310px;
  }

  .booths-page .directory-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1400px) {
  .layout {
    grid-template-columns: 260px minmax(0, 1fr) 270px;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================
Navigation: ซ่อนเป็นค่าเริ่มต้น
======================================== */

/* .navigation {
  display: none;
} */

.navigation .nav-button {
  text-decoration: none;
}

/* ========================================
All Booths page
======================================== */

/* แสดงช่องค้นหาและตัวกรอง แต่ซ่อนตัวแผนผัง */
.booths-page .map-shell,
.booths-page #route-notice {
  display: none;
}

.booths-page .layout {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.booths-page .map-column {
  order: 0;
  grid-column: 1 / -1;
}

.booths-page .directory {
  order: 1;
  height: auto;
  min-height: 0;
}

.booths-page .directory-list {
  grid-template-columns: minmax(0, 1fr);
  max-height: none;
  overflow: visible;
}

.booths-page .desktop-detail {
  order: 2;
}

@media (max-width: 1099px) {
  body:not(.booths-page) #directory {
    display: none;
  }
  /* ========================================
   Mobile Booth Detail - Bottom Sheet
======================================== */
 #detail-dialog {
    position: fixed !important;

    inset: auto 0 0 0 !important;

    top: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;

    width: min(480px, 100%) !important;
    max-width: 480px !important;

    height: auto !important;
    max-height: 85dvh !important;

    margin: 0 auto !important;
    padding: 0 !important;

    border: 0 !important;
    border-radius: 22px 22px 0 0;

    overflow: hidden;

    transform: translateY(100%);
    opacity: 0;

    transition:
      transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.25s ease;

    z-index: 1000;
  }

  /* #detail-dialog[open], */
  #detail-dialog.is-open {
    transform: translateY(0);
    opacity: 1;
  }

  #detail-dialog.dragging {
    transition: none !important;
  }

  #detail-dialog.closing {
    transform: translateY(100%);
    opacity: 0;
  }

  /*
   * Expanded
   */
  #detail-dialog.expanded {
    height: 95dvh !important;
    max-height: 95dvh !important;
  }

  /*
   * Handle
   */
  .detail-drag-handle {
    width: 42px;
    height: 5px;

    margin: 10px auto 4px;

    border-radius: 999px;

    background: #d6d0cc;

    cursor: grab;

    touch-action: none;
    user-select: none;

    flex-shrink: 0;
  }

  .detail-drag-handle:active {
    cursor: grabbing;
  }

  /*
   * Header
   */
  #detail-dialog .dialog-heading {
    touch-action: none;
    user-select: none;
    cursor: grab;

     position: relative;

  display: flex;
  align-items: center;
  justify-content: space-between;

  width: 100%;

  padding: 6px 15px 10px;

  background: white;

  border-bottom: 1px solid var(--border);

  font-size: 12px;
  font-weight: 700;
  }

  #detail-dialog .dialog-heading:active {
    cursor: grabbing;
  }

  /*
   * Close button ต้องยัง click ได้
   */
  #detail-dialog #close-detail {
    touch-action: manipulation;
    cursor: pointer;
  }

  /*
   * Content
   */
  #mobile-detail {
    max-height: calc(85dvh - 62px);

    overflow-y: auto;

    overscroll-behavior: contain;

    -webkit-overflow-scrolling: touch;
  }

  /*
   * Expanded content
   */
  #detail-dialog.expanded #mobile-detail {
    max-height: calc(95dvh - 62px);
  }

  /*
   * Backdrop
   */
  #detail-dialog::backdrop {
    background: rgb(23 32 52 / 0%);

    transition:
      background 0.35s ease;
  }

  #detail-dialog[open]::backdrop {
    background: rgb(23 32 52 / 45%);
  }

  #detail-dialog.closing::backdrop {
    background: rgb(23 32 52 / 0%);
  }
}

