/* ================================================================
   Virtual Tour Player CSS — v1.7.0
   ================================================================ */

/* ── Hard reset: fill the entire screen with no gaps ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  /* Prevent iOS bounce/scroll that reveals white gaps */
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Stack height declarations: browser takes the last one it understands */
  height: 100vh;
  height: 100svh;   /* small viewport height: always excludes browser chrome */
}

/* ── Shell: the full-screen flex container ── */
#shell {
  display: flex;
  flex-direction: row;
  width: 100%;
  /* Use svh so the layout never includes mobile browser chrome in its height.
     svh = Small Viewport Height = constant "smallest possible viewport"
     This is better than dvh for layout because it doesn't resize as the
     browser chrome appears/disappears causing reflows. */
  height: 100vh;
  height: 100svh;
  position: fixed;  /* fixes iOS Safari where body still scrolls */
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
}

/* ── Sidebar ── */
#scene-sidebar {
  width: 220px;
  min-width: 220px;
  height: 100%;
  background: rgba(10,12,18,0.97);
  border-right: 1px solid rgba(255,255,255,0.09);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  z-index: 30;
  transition: width 0.22s ease, min-width 0.22s ease, opacity 0.22s ease;
}
#scene-sidebar.collapsed { width: 0; min-width: 0; overflow: hidden; opacity: 0; pointer-events: none; }
#scene-sidebar::-webkit-scrollbar { width: 3px; }
#scene-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
#scene-sidebar-inner { padding: 10px 8px; display: flex; flex-direction: column; gap: 7px; }

/* ── Scene thumbnail card ── */
.scene-card {
  border-radius: 9px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; background: rgba(255,255,255,0.04);
  transition: border-color 0.14s, transform 0.12s; position: relative; flex-shrink: 0;
}
.scene-card:hover  { border-color: rgba(255,255,255,0.3); transform: translateY(-1px); }
.scene-card.active { border-color: #5b8dee; box-shadow: 0 0 0 1px #5b8dee; }
.scene-card img    { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.scene-card-label  {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
  color: #fff; font-size: 12px; font-weight: 500; padding: 18px 8px 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scene-card-badge  {
  position: absolute; top: 5px; left: 5px; background: #5b8dee; color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px;
}

/* ── Main area: panorama fills all remaining space ── */
#main-area {
  flex: 1;
  min-width: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* #tour must be exactly the same size as #main-area.
   Do NOT add transform, scale, or any sizing that would confuse Pannellum's
   WebGL aspect ratio calculation. Pannellum reads clientWidth/clientHeight
   of its container to calculate the projection — any mismatch causes distortion. */
#tour {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
}

/* ── Sidebar toggle — VERTICALLY CENTERED on left edge of panorama ── */
#sidebar-toggle {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);   /* exactly centered vertically */
  z-index: 25;
  background: rgba(8,10,14,0.70);
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  display: grid; place-items: center;
  cursor: pointer; font-size: 15px; line-height: 1;
  backdrop-filter: blur(6px);
  transition: background 0.12s, border-color 0.12s;
  user-select: none;
}
#sidebar-toggle:hover { background: rgba(91,141,238,0.55); border-color: #5b8dee; }

/* ── Scene title pill ── */
#scene-title {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(8,10,14,0.68); color: #fff; padding: 7px 18px;
  border-radius: 999px; font-size: 13.5px; letter-spacing: 0.02em;
  pointer-events: none; z-index: 20; backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.11);
  max-width: calc(100% - 80px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Boot status ── */
#boot-status {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  color: #cfd6dd; font-size: 15px; text-align: center;
  line-height: 1.7; padding: 22px 28px; z-index: 40; max-width: 420px;
}
#boot-status small { color: #8d98a5; font-size: 13px; }
#boot-status.boot-error {
  background: rgba(24,18,18,0.92); border: 1px solid #6e3531;
  border-radius: 14px; color: #ffd9d6;
}

/* ─────────────────────────────────────────────────────────────────────────────
   UPDATE 1 — Hide Pannellum's raw download progress (shows "2.5 MB / 6 MB")
   and replace with a clean, professional 360° loading experience.
   We hide: the load box (which contains the progress bar + size text),
   the lbox (spinning square), and the load button.
   We show our own spinner overlay instead.
───────────────────────────────────────────────────────────────────────────── */

/* Kill the raw progress elements entirely */
.pnlm-load-box,
.pnlm-lbox,
.pnlm-load-button { display: none !important; }

/* Professional loading overlay — shown while Pannellum is fetching the panorama.
   Pannellum adds/removes .pnlm-load-box display:block; our overlay uses the same
   timing by watching the .pnlm-render-container which goes opacity 0→1 on load. */
#vt-loading-overlay {
  position: absolute; inset: 0; z-index: 35;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  background: rgba(6, 8, 12, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
  transition: opacity 0.4s ease;
}
#vt-loading-overlay.vt-loaded { opacity: 0; pointer-events: none; }

/* Spinner ring */
.vt-spinner {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: rgba(255,255,255,0.85);
  animation: vt-spin 0.9s linear infinite;
}
@keyframes vt-spin { to { transform: rotate(360deg); } }

/* "Loading scene…" text */
.vt-loading-text {
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: system-ui, -apple-system, sans-serif;
}

/* ── Boot status ── (duplicate rule removed — defined once above) */

/* ── Hotspots ── */
.vt-hotspot { cursor: pointer; }
.vt-wrap { display: flex; flex-direction: column; align-items: center;
  transform: translate(-50%,-50%); position: absolute; }
.vt-scale-inner { display: flex; flex-direction: column; align-items: center; transition: transform 0.12s ease; }
.vt-arrow-img { width: 64px; height: 64px; object-fit: contain; user-select: none;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.7)); transition: filter 0.14s; }
.vt-wrap:hover .vt-arrow-img { filter: drop-shadow(0 0 10px rgba(255,255,255,0.75)); }
.vt-dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; color: #fff; font-size: 16px; font-weight: 700;
  border: 2px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.15); transition: transform 0.14s; }
.vt-wrap:hover .vt-dot { transform: scale(1.15); }
.vt-dot-image { color: #0ea472; }
.vt-dot-link  { color: #cf671b; }
.vt-label { margin-top: 5px; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px);
  color: #fff; font-size: 12px; font-weight: 600;
  padding: 4px 12px; border-radius: 999px; white-space: nowrap; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
/* Label sits beside the dot icon in a seamless pill for image/link hotspots */
.vt-label-inline {
  margin-top: 0; background: none !important; border: none !important;
  box-shadow: none !important; backdrop-filter: none !important;
  padding: 0 0 0 10px; display: flex; align-items: center;
  font-size: 13px; font-weight: 700; height: 32px;
  color: #fff; white-space: nowrap;
  text-shadow:
    1px  1px 0 rgba(0,0,0,0.8),
   -1px -1px 0 rgba(0,0,0,0.8),
    1px -1px 0 rgba(0,0,0,0.8),
   -1px  1px 0 rgba(0,0,0,0.8),
    0    2px 4px rgba(0,0,0,0.6);
}
/* Make the dot square-left when paired with an inline label */
.vt-dot:has(+ .vt-label-inline) { border-radius: 50%; border-right: 2px solid currentColor; }
.vt-tag {
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 0;
  border-radius: 0;
  letter-spacing: 0.01em;
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Multi-layered shadow gives clean readability on any panorama background */
  text-shadow:
    1px  1px 0 rgba(0,0,0,0.9),
   -1px -1px 0 rgba(0,0,0,0.9),
    1px -1px 0 rgba(0,0,0,0.9),
   -1px  1px 0 rgba(0,0,0,0.9),
    0    2px 6px rgba(0,0,0,0.7),
    0    0  12px rgba(0,0,0,0.5);
  transition: none;
}
.vt-wrap:hover .vt-tag { background: none; transform: none; }

/* ── Static overlay hotspot ── */
.player-static-hs { position: absolute; bottom: 24px; right: 20px; z-index: 15;
  cursor: pointer; transition: transform 0.14s; }
.player-static-hs:hover { transform: scale(1.08); }

/* ── Hotspot modal ── */
#hotspot-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
#hotspot-modal.hidden { display: none; }
#hotspot-modal-card { background: #fff; color: #1a1d21; border-radius: 14px;
  max-width: 540px; width: 100%; max-height: 80svh; max-height: 80vh;
  overflow-y: auto; padding: 24px 26px; position: relative;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45); }
#hotspot-modal-card h3 { margin: 0 0 10px; font-size: 18px; }
#hotspot-modal-card p  { margin: 0; line-height: 1.55; font-size: 15px; color: #3a3f45; }
.vt-modal-img { width: 100%; border-radius: 10px; margin-bottom: 12px; display: block; }
#hotspot-modal-close { position: absolute; top: 10px; right: 12px; background: none; border: none;
  font-size: 26px; line-height: 1; cursor: pointer; color: #888; }
#hotspot-modal-close:hover { color: #222; }

/* ================================================================
   MOBILE RESPONSIVE
   On phones: sidebar hidden by default, toggle to open
   ================================================================ */
@media (max-width: 768px) {
  /* Collapse sidebar; user opens with toggle */
  #scene-sidebar { width: 0; min-width: 0; opacity: 0; pointer-events: none; }
  #scene-sidebar.mobile-open { width: 200px; min-width: 200px; opacity: 1; pointer-events: auto; }
  #scene-title { font-size: 12px; padding: 6px 14px; max-width: calc(100% - 60px); }
}
@media (max-width: 480px) {
  #scene-sidebar.mobile-open { width: 175px; min-width: 175px; }
  .scene-card-label { font-size: 11px; }
  #scene-title { font-size: 11.5px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .vt-scale-inner, .vt-arrow-img, .vt-dot, .vt-tag,
  .scene-card, #scene-sidebar, #sidebar-toggle { transition: none !important; }
}

/* ═══════════════════════════════════════════════════════════════
   Custom Floating Toolbar  (#vt-toolbar)
   Glass-morphism panel, bottom-center, responsive
   ═══════════════════════════════════════════════════════════════ */

/* Hide Pannellum's own native controls — we replace them entirely */
.pnlm-controls-container { display: none !important; }

#vt-toolbar {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;

  /* Glass pill */
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(12, 14, 20, 0.62);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 0 0 0.5px rgba(255, 255, 255, 0.08) inset;

  /* Don't block drag/pan interaction with the panorama on the sides */
  pointer-events: auto;
  user-select: none;
}

/* Individual icon buttons */
.vtc-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.12s ease,
    box-shadow 0.15s ease;
  position: relative;
}
.vtc-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
}
.vtc-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transform: scale(1.1);
}
.vtc-btn:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.08);
}
.vtc-btn:focus-visible {
  outline: 2px solid rgba(91, 141, 238, 0.85);
  outline-offset: 2px;
}
.vtc-btn.vtc-active {
  color: #78a8ff;
  background: rgba(91, 141, 238, 0.22);
}
.vtc-btn.vtc-active:hover {
  background: rgba(91, 141, 238, 0.32);
}

/* Tooltip on hover (uses CSS only, no JS) */
.vtc-btn::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 14, 20, 0.9);
  color: #e8ecf1;
  font-size: 11.5px;
  font-family: system-ui, -apple-system, sans-serif;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease 0.5s;
  z-index: 40;
  letter-spacing: 0.01em;
}
.vtc-btn:hover::after { opacity: 1; }

/* Vertical divider between button groups */
.vtc-sep {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 4px;
  flex-shrink: 0;
  border-radius: 1px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  #vt-toolbar {
    bottom: 18px;
    gap: 0;
    padding: 4px 6px;
  }
  .vtc-btn {
    width: 36px;
    height: 36px;
  }
  .vtc-btn svg { width: 16px; height: 16px; }
  .vtc-btn::after { display: none; } /* no hover tooltips on touch */
}
@media (max-width: 380px) {
  .vtc-btn { width: 32px; height: 32px; }
  .vtc-btn svg { width: 15px; height: 15px; }
}

/* Ensure the toolbar stays above scene sidebar when sidebar is open */
#main-area #vt-toolbar { z-index: 30; }

/* Don't show while the panorama is still loading */
#tour:not(:has(canvas)) #vt-toolbar { opacity: 0; pointer-events: none; }

/* ── Overlay / Logo hotspot ── */
.vt-overlay-wrap { cursor: default !important; }
.vt-overlay-img {
  display: block;
  max-width: none;
  user-select: none;
  pointer-events: none;
  transition: opacity 0.2s;
}
.vt-overlay-placeholder {
  width: 60px; height: 60px;
  background: rgba(255,255,255,0.12);
  border: 2px dashed rgba(255,255,255,0.4);
  border-radius: 8px;
  display: grid; place-items: center;
  color: rgba(255,255,255,0.5);
  font-size: 22px;
}

/* ── Callout hotspot — pinned to panorama point, dot + line + label card ── */

/* Pannellum wrapper that holds the whole callout assembly */
.vt-callout-wrap {
  /* opacity toggled by JS — transitions controlled inline */
  overflow: visible !important;
  cursor: default !important;
}

/* Pulsing anchor dot at the exact 3D point */
.vt-callout-dot {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 10px; height: 10px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.35);
  animation: vt-callout-pulse 2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes vt-callout-pulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(255,255,255,0.35); }
  50%      { box-shadow: 0 0 0 7px rgba(255,255,255,0.12); }
}

/* Label card — white background, like the reference */
.vt-callout-card {
  background: #fff;
  color: #111;
  border-radius: 6px;
  padding: 8px 12px;
  width: max-content;
  max-width: 200px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.28);
  pointer-events: none;
  white-space: nowrap;
}
.vt-callout-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
}
.vt-callout-card-body {
  font-size: 0.74rem;
  color: #444;
  margin-top: 3px;
  line-height: 1.4;
  white-space: normal;
}
