/* Sài Gòn Heritage Hub - Custom Stylesheet */

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Glassmorphism Panel */
.glass-panel {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Pin Glowing Pulse */
@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 0.9; }
  50% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(0.9); opacity: 0.9; }
}

.pin-pulse::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 9999px;
  background: #91000a;
  animation: pulse-ring 2.2s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
  z-index: -1;
}

/* Map Pan & Zoom Viewport */
#map-viewport {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  /* The map pans/zooms itself; stop the browser claiming vertical swipes as scroll / pull-to-refresh */
  touch-action: none;
  overscroll-behavior: none;
}

#map-viewport.is-dragging {
  cursor: grabbing;
}

#map-content {
  transform-origin: 0 0;
  transition: transform 0.04s ease-out;
  will-change: transform;
}

#map-content.smooth-transition {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tour Route Line Animated Dash */
@keyframes tourDash {
  to {
    stroke-dashoffset: -40;
  }
}

.tour-route-line-animated {
  animation: tourDash 1.2s linear infinite;
}

/* ==========================================================================
   MOBILE LAYOUT (< 768px)
   Full-bleed map with a floating search pill + chip row on top, round map
   controls that ride above the bottom sheet, and a 3-tier sheet sitting on
   a 4-tab bar. Desktop (>= 768px) is untouched by everything below.
   ========================================================================== */
@media (max-width: 767px) {
  :root {
    --sheet-peek: 172px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* 100vh includes the area behind mobile browser toolbars, which pushes the tab bar
     off-screen; 100dvh is the visible height. `.h-screen` in the selector is needed
     to outrank Tailwind's own `.h-screen { height: 100vh }`. */
  html body.h-screen {
    height: 100vh;
    height: 100dvh;
  }

  /* --- Floating top bar --- */
  #mobile-map-topbar {
    padding-top: calc(var(--safe-top) + 10px);
  }

  .m-float-shadow {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.14);
  }

  .m-chip {
    height: 34px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    border-radius: 9999px;
    background: #ffffff;
    color: #1e293b;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), 0 1px 6px rgba(15, 23, 42, 0.1);
    transition: background-color 0.15s, color 0.15s;
  }
  .m-chip i {
    font-size: 12px;
  }
  .m-chip.is-active {
    background: #91000a;
    color: #ffffff;
  }
  .m-chip.is-active i {
    color: #fed488 !important;
  }

  /* --- Bottom sheet --- */
  #heritage-drawer.mobile-bottom-sheet,
  #tour-drawer.mobile-bottom-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-top-left-radius: 1.25rem;
    border-top-right-radius: 1.25rem;
    border: 0;
    box-shadow: 0 -2px 6px rgba(15, 23, 42, 0.06), 0 -8px 24px rgba(15, 23, 42, 0.12);
    z-index: 35;
    flex-direction: column;
    overflow: hidden;
  }

  .mobile-bottom-sheet.sheet-smooth-transition {
    transition: height 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* No !important here: the inline height set while dragging must win */
  .mobile-bottom-sheet.tier-peek {
    height: var(--sheet-peek);
  }
  .mobile-bottom-sheet.tier-half {
    height: 52%;
  }
  .mobile-bottom-sheet.tier-full {
    height: calc(100% - var(--safe-top) - 8px);
  }

  [data-sheet-drag] {
    touch-action: none;
  }

  /* Pill actions in the place sheet */
  .m-pill {
    height: 36px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #1e293b;
    font-size: 13px;
    font-weight: 600;
  }
  .m-pill i {
    font-size: 14px;
  }
  .m-pill-primary {
    background: #91000a;
    border-color: #91000a;
    color: #ffffff;
  }

  /* The pill row at the top of the sheet already carries every action */
  #drawer-bottom-actions {
    display: none;
  }

  /* Tour sheet: compact header (the eyebrow label already names the view) */
  #tour-header-banner {
    padding: 4px 16px 12px;
  }
  #tour-header-banner h2 {
    display: none;
  }
  #tour-stats-container {
    margin-top: 10px;
    padding-top: 10px;
  }
  #tour-stats-container > div {
    padding: 8px 6px;
  }

  /* --- Map pins: icon-only on phones; only the selected / current-stop pin keeps its label --- */
  .pin-item .marker-badge.bg-slate-900\/95 {
    display: none;
  }
  .pin-item .marker-icon.w-9 {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  /* --- Map overlays --- */
  #map-legend-badge,
  #gmaps-alternative-bar,
  #zoom-indicator,
  #map-controls .w-6,
  #map-controls button[onclick="resetMapView()"] {
    display: none !important;
  }

  /* Round controls ride just above the sheet (--sheet-h is set by SheetController) */
  #map-controls {
    top: auto;
    right: 12px;
    bottom: calc(var(--sheet-h, var(--sheet-peek)) + 12px);
    transition: bottom 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  }
  #map-controls.is-dragging {
    transition: none;
  }
  #map-controls > div:first-child {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    gap: 10px;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  #map-controls button {
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.14);
  }
  #map-controls button[onclick^="centerToHeritage"] {
    color: #91000a;
  }

  #touring-hud-bar {
    top: calc(var(--safe-top) + 10px);
  }

  /* --- Tab bar --- */
  #mobile-tabbar {
    padding-bottom: var(--safe-bottom);
  }
  .m-tab {
    height: 62px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
  }
  .m-tab-icon {
    width: 56px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-size: 16px;
    transition: background-color 0.2s;
  }
  .m-tab.is-active {
    color: #91000a;
    font-weight: 700;
  }
  .m-tab.is-active .m-tab-icon {
    background: #fde8e8;
  }
}

/* Lightbox Image Styles */
.cursor-zoom-in {
  cursor: zoom-in;
}

#lightbox-img {
  transition: transform 0.15s ease-out;
  user-select: none;
  -webkit-user-drag: none;
}

#lightbox-img.cursor-move {
  cursor: grab;
}
#lightbox-img.cursor-move:active {
  cursor: grabbing;
}

