/* 360° viewer */
html, body { background: #000; overflow: hidden; }

.viewer-shell {
  position: fixed;
  inset: 0;
  background: var(--vl-viewer-bg);
  font-family: var(--vl-font-body);
  color: #e8edf6;
}

.viewer-shell a-scene { width: 100% !important; height: 100% !important; }

.viewer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  color: var(--vl-slate-200);
  z-index: 9000;
  flex-direction: column;
  gap: 16px;
  pointer-events: none;
  transition: opacity 0.35s ease;
  font-size: 14px;
  font-weight: 500;
}
.viewer-loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 44px; height: 44px;
  border: 3.5px solid rgba(255,255,255,0.15);
  border-top-color: var(--vl-blue);
  border-radius: 999px;
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scene toast */
.scene-toast {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 18, 36, 0.82);
  backdrop-filter: blur(14px);
  color: var(--vl-white);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  z-index: 1000;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1);
  max-width: 80vw;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.25s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.scene-toast:hover { background: rgba(11, 18, 36, 0.92); }
.scene-toast i { font-size: 11px; opacity: 0.8; }
.scene-toast .scene-toast-desc {
  display: none;
  font-weight: 400;
  font-size: 13px;
  color: var(--vl-slate-200);
  padding-top: 6px;
  margin-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.12);
  line-height: 1.5;
}
.scene-toast.expanded {
  border-radius: 16px;
  flex-direction: column;
  align-items: flex-start;
  padding: 14px 18px;
  max-width: min(420px, 90vw);
}
.scene-toast.expanded .scene-toast-desc { display: block; }

/* Bottom navbar */
.viewer-navbar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 18, 36, 0.82);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 6px;
  display: flex;
  gap: 4px;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: transparent;
  border: none;
  color: var(--vl-white);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
  font-family: inherit;
}
.nav-btn:hover { background: rgba(255,255,255,0.15); transform: scale(1.05); }
.nav-btn:active { transform: scale(0.95); }
.nav-btn:disabled { opacity: 0.35; cursor: default; transform: none; }

/* Look around (mobile) */
.look-around-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(11, 18, 36, 0.82);
  backdrop-filter: blur(14px);
  color: var(--vl-white);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  z-index: 1000;
  display: none;
  font-family: inherit;
  gap: 6px;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.look-around-btn.is-active { background: var(--vl-blue); border-color: var(--vl-blue); box-shadow: var(--vl-shadow-blue); }
@media (max-width: 900px) { .look-around-btn { display: inline-flex; } }

/* Info / menu panels */
.viewer-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  width: min(380px, 100%);
  background: rgba(11, 18, 36, 0.93);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--vl-slate-200);
  z-index: 1500;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 28px 26px;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(0,0,0,0.4);
}
.viewer-panel.left  { left: 0; transform: translateX(-100%); border-left: none; }
.viewer-panel.right { right: 0; transform: translateX(100%); border-right: none; }
.viewer-panel.is-open { transform: translateX(0); }

.viewer-panel h2 {
  color: var(--vl-white);
  margin: 0 0 20px;
  font-size: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: -0.3px;
}
.viewer-panel .close-btn {
  background: transparent;
  border: none;
  color: var(--vl-slate-300);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background 0.12s ease, color 0.12s ease;
}
.viewer-panel .close-btn:hover { background: rgba(255,255,255,0.08); color: var(--vl-white); }

.venue-meta {
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
}
.venue-meta dt {
  color: var(--vl-slate-400);
  font-weight: 700;
  margin-top: 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.venue-meta dt:first-child { margin-top: 0; }
.venue-meta dd { margin: 5px 0 0; color: var(--vl-white); font-weight: 500; }
.venue-meta a { color: #93c5fd; font-weight: 600; }
.venue-meta a:hover { color: #c7ddff; }
.venue-meta .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.venue-meta .tags span {
  background: rgba(255,255,255,0.08);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

/* Menu (scene list) */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.menu-scene {
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.menu-scene:hover { transform: translateY(-2px); border-color: var(--vl-blue); }
.menu-scene.active {
  border-color: var(--vl-blue);
  box-shadow: 0 0 0 2px rgba(36, 83, 255, 0.4);
}
.menu-scene-thumb {
  aspect-ratio: 2 / 1;
  background-size: cover;
  background-position: center;
  background-color: rgba(255,255,255,0.04);
}
.menu-scene-title { padding: 9px 11px; font-size: 11.5px; color: var(--vl-white); font-weight: 600; }

/* Info tooltip (in-scene info hotspots) */
.viewer-tooltip {
  position: absolute;
  background: rgba(11, 18, 36, 0.97);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 14px 16px;
  min-width: 220px;
  max-width: 300px;
  color: var(--vl-white);
  z-index: 1100;
  font-size: 13.5px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
  transform: translate(-50%, calc(-100% - 18px));
  pointer-events: auto;
  animation: tooltipIn 0.22s ease;
}
@keyframes tooltipIn { from { opacity: 0; transform: translate(-50%, calc(-100% - 10px)); } to { opacity: 1; transform: translate(-50%, calc(-100% - 18px)); } }
.viewer-tooltip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.viewer-tooltip h3 { margin: 0; font-size: 14.5px; color: var(--vl-white); }
.viewer-tooltip p  { margin: 0; font-size: 13.5px; color: var(--vl-slate-200); line-height: 1.55; }
.viewer-tooltip .tooltip-close {
  background: transparent;
  border: none;
  color: var(--vl-slate-400);
  cursor: pointer;
  padding: 2px 8px;
  font-size: 16px;
  border-radius: 6px;
  transition: background 0.12s ease, color 0.12s ease;
}
.viewer-tooltip .tooltip-close:hover { background: rgba(255,255,255,0.08); color: var(--vl-white); }

/* Watermark */
.viewer-watermark {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  font-weight: 600;
  pointer-events: auto;
  padding: 6px 12px 6px 8px;
  background: rgba(11, 18, 36, 0.5);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
}
.viewer-watermark:hover { color: var(--vl-white); text-decoration: none; }

/* In-scene hotspot markers (DOM overlay) */
.viewer-hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}
.v-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
}
.v-hotspot-marker {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: rgba(36, 83, 255, 0.92);
  border: 3px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: hsPulseV 2.2s infinite;
  transition: transform 0.15s ease;
}
.v-hotspot:hover .v-hotspot-marker { transform: scale(1.1); }
.v-hotspot.info .v-hotspot-marker {
  background: rgba(21, 167, 83, 0.92);
  animation-delay: 0.5s;
}
.v-hotspot-label {
  position: absolute;            /* keep the marker exactly centred on the point */
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: block;
  background: rgba(11, 18, 36, 0.9);
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
@keyframes hsPulseV {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 0 rgba(36, 83, 255, 0.4); }
  50%      { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 14px rgba(36, 83, 255, 0); }
}

/* Hide A-Frame default UI */
.a-enter-vr, .a-enter-ar { display: none !important; }

/* Edit bar - shown to owners / super-admins on the live viewer */
.viewer-edit-bar {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1500;
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.viewer-edit-bar > * { pointer-events: auto; }

.viewer-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--vl-blue);
  color: var(--vl-white);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: var(--vl-shadow-blue), 0 8px 24px rgba(0,0,0,0.35);
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}
.viewer-edit-btn:hover {
  background: var(--vl-blue-hover);
  color: var(--vl-white);
  transform: translateY(-1px);
  text-decoration: none;
}
.viewer-edit-btn:active { transform: translateY(0); }

.viewer-draft-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(217, 119, 6, 0.95);
  color: #fff;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

@media (max-width: 900px) {
  /* On mobile, look-around is top-right; keep edit bar at top-left
     but stack vertically if both have many children */
  .viewer-edit-bar { top: 14px; left: 14px; }
  .viewer-edit-btn { padding: 8px 12px; font-size: 12px; }
  .viewer-draft-pill { padding: 6px 10px; font-size: 10.5px; }
}

/* Map panel - Google Maps embed inside the viewer's right-side panel */
#vMap .venue-map {
  position: relative;
  width: 100%;
  height: calc(100% - 110px);
  min-height: 320px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
#vMap .venue-map iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #1a2236;
}
#vMap .venue-map-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--vl-slate-400);
  font-size: 13.5px;
}
#vMap .venue-map-meta {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--vl-slate-300);
  line-height: 1.6;
}
#vMap .venue-map-meta a { color: #93c5fd; font-weight: 600; }
#vMap .venue-map-meta a:hover { color: #c7ddff; }

/* ── Back / exit button (top-left) ───────────────────────────────────── */
.viewer-back-btn {
  position: absolute; top: 20px; left: 20px; z-index: 1500;
  width: 44px; height: 44px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(11, 18, 36, 0.82); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.1); color: var(--vl-white);
  font-size: 16px; text-decoration: none; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  transition: background 0.15s ease, transform 0.15s ease;
}
.viewer-back-btn:hover { background: rgba(255,255,255,0.15); color: var(--vl-white); transform: scale(1.05); text-decoration: none; }
.viewer-back-btn:active { transform: scale(0.95); }

/* Make room for the back button: owner edit-bar sits to its right */
.viewer-edit-bar { left: 76px; }

/* ── Mobile: stop the tour-viewer buttons from overlapping ───────────── */
@media (max-width: 760px) {
  .viewer-back-btn { top: 12px; left: 12px; width: 42px; height: 42px; font-size: 15px; }
  .viewer-edit-bar { top: 12px; left: 62px; gap: 8px; }
  .viewer-edit-btn { padding: 0; width: 42px; height: 42px; justify-content: center; }
  .viewer-edit-btn .vl-eb-label { display: none; }     /* icon-only */
  .viewer-draft-pill { display: none; }
  .look-around-btn { top: 12px; right: 12px; height: 42px; padding: 0 14px; gap: 7px; justify-content: center; }
  .look-around-btn .vl-eb-label { display: inline; }   /* show icon + "Look Around" text */
  /* Scene name drops to its own row below the top buttons */
  .scene-toast { top: 64px; max-width: 92vw; padding: 9px 16px; font-size: 12.5px; }
  .scene-toast > #vToastTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  /* Bottom bar: respect safe area + keep the watermark clear of the navbar */
  .viewer-navbar { bottom: max(14px, env(safe-area-inset-bottom)); gap: 2px; padding: 5px; }
  .nav-btn { width: 40px; height: 40px; font-size: 15px; }
  .viewer-watermark {
    left: 12px;
    bottom: calc(max(14px, env(safe-area-inset-bottom)) + 56px);
    font-size: 11px; padding: 4px 9px 4px 7px;
  }
}
@media (max-width: 380px) {
  .viewer-navbar .nav-btn { width: 36px; height: 36px; font-size: 14px; }
}
