/* =====================================================================
   Virtual Tour 360 — stili condivisi
   Gli hotspot sono elementi DOM iniettati in Pannellum: la freccia e il
   badge leggono i colori/font dal database tramite custom properties
   impostate inline da JS (--vt-bg, --vt-text, --vt-font).
   ===================================================================== */

:root {
  --vt-ui-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --vt-arrow-size: 76px;
  --vt-badge-gap: 14px;
  --vt-floor-angle: 58deg;
}

/* ---------------------------------------------------------------- */
/*  Layout viewer a schermo intero                                  */
/* ---------------------------------------------------------------- */

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0b0b0f;
  color: #fff;
  font-family: var(--vt-ui-font);
  overscroll-behavior: none;
}

#panorama, .vt-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------------------------------------------------------------- */
/*  HOTSPOT — contenitore                                           */
/* ---------------------------------------------------------------- */

/* Pannellum posiziona il div .pnlm-hotspot-base e lo centra sul punto
   pitch/yaw; dentro ci sta un <span> che facciamo diventare il nostro
   wrapper. Il wrapper ha le dimensioni della sola freccia, cosi il
   centro della freccia coincide col punto cliccato e il badge fluttua
   sopra fuori dal flusso. */
.vt-hotspot {
  z-index: 2;
}

.vt-hs {
  position: relative;
  display: block;
  width: var(--vt-arrow-size);
  height: var(--vt-arrow-size);
  font-family: var(--vt-font, var(--vt-ui-font));
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
  will-change: transform;
}

/* ---------------------------------------------------------------- */
/*  HOTSPOT — freccia prospettica "adagiata a terra"                */
/* ---------------------------------------------------------------- */

.vt-hs-arrow {
  position: absolute;
  inset: 0;
  transform: perspective(300px) rotateX(var(--vt-floor-angle));
  transform-origin: 50% 65%;
  transition: transform 220ms cubic-bezier(.2, .8, .3, 1), filter 220ms ease;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .45));
}

.vt-hs-arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Alone pulsante sotto la freccia: resta sul piano del pavimento. */
.vt-hs-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--vt-bg, #7c3aed);
  opacity: 0;
  transform: perspective(300px) rotateX(var(--vt-floor-angle)) scale(1);
  transform-origin: 50% 65%;
  animation: vt-pulse 2.6s ease-out infinite;
  pointer-events: none;
}

@keyframes vt-pulse {
  0%   { opacity: .55; transform: perspective(300px) rotateX(var(--vt-floor-angle)) scale(.85); }
  70%  { opacity: 0;   transform: perspective(300px) rotateX(var(--vt-floor-angle)) scale(1.6); }
  100% { opacity: 0;   transform: perspective(300px) rotateX(var(--vt-floor-angle)) scale(1.6); }
}

.vt-hs:hover .vt-hs-arrow {
  transform: perspective(300px) rotateX(var(--vt-floor-angle)) scale(1.14);
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .55));
}

/* ---------------------------------------------------------------- */
/*  HOTSPOT — badge/etichetta fluttuante                            */
/* ---------------------------------------------------------------- */

.vt-hs-badge {
  position: absolute;
  left: 50%;
  bottom: calc(100% + var(--vt-badge-gap));
  /* --vt-badge-dx/dy: scostamento libero rispetto alla freccia, dal database. */
  transform: translateX(-50%) translate(var(--vt-badge-dx, 0px), var(--vt-badge-dy, 0px));
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--vt-bg, #7c3aed);
  color: var(--vt-text, #fff);
  font-family: var(--vt-font, var(--vt-ui-font));
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: transform 220ms cubic-bezier(.2, .8, .3, 1);
}

.vt-hs-badge:empty {
  display: none;
}

/* Trattino che collega badge e freccia: lunghezza e inclinazione sono
   ricalcolate da JS quando il badge viene spostato. */
.vt-hs-badge::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: var(--vt-link-len, var(--vt-badge-gap));
  background: var(--vt-bg, #7c3aed);
  transform-origin: 50% 0;
  transform: translateX(-50%) rotate(var(--vt-link-rot, 0deg));
  opacity: .65;
}

.vt-hs-badge[data-link="off"]::after {
  display: none;
}

.vt-hs:hover .vt-hs-badge {
  transform: translateX(-50%)
             translate(var(--vt-badge-dx, 0px), calc(var(--vt-badge-dy, 0px) - 3px));
}

/* Varianti di scala per il tipo "dot" (punto informativo compatto). */
.vt-hs[data-arrow="dot"] {
  width: calc(var(--vt-arrow-size) * .6);
  height: calc(var(--vt-arrow-size) * .6);
}

.vt-hs[data-arrow="dot"] .vt-hs-arrow,
.vt-hs[data-arrow="dot"] .vt-hs-pulse {
  transform: none;
}

.vt-hs[data-arrow="dot"]:hover .vt-hs-arrow {
  transform: scale(1.14);
}

/* Anteprima statica (pannello admin): nessuna prospettiva schiacciata
   sul badge, freccia visibile per intero. */
.vt-preview-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 190px;
  padding: 58px 16px 28px;
  border-radius: 14px;
  background:
    radial-gradient(120% 90% at 50% 120%, rgba(255, 255, 255, .14), transparent 60%),
    linear-gradient(180deg, #2a2f3a 0%, #15181f 100%);
  overflow: hidden;
}

/* ---------------------------------------------------------------- */
/*  UI del tour pubblico                                            */
/* ---------------------------------------------------------------- */

.vt-topbar {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.vt-chip {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: rgba(14, 16, 22, .62);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: default;
}

button.vt-chip {
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
  font-family: inherit;
}

button.vt-chip:hover {
  background: rgba(30, 34, 44, .85);
  border-color: rgba(255, 255, 255, .28);
}

/* ---------------------------------------------------------------- */
/*  Striscia delle anteprime in basso                               */
/* ---------------------------------------------------------------- */

.vt-roomlist {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 56px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  background: linear-gradient(rgba(6, 7, 11, 0), rgba(6, 7, 11, .78) 60%);
}

.vt-roomlist::-webkit-scrollbar {
  display: none;
}

.vt-roomlist[hidden] {
  display: none;
}

.vt-room-btn {
  position: relative;
  flex: 0 0 auto;
  width: 150px;
  height: 92px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, .16);
  border-radius: 12px;
  background: rgba(14, 16, 22, .62);
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease;
}

.vt-room-btn:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, .45);
}

.vt-room-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.vt-room-btn[aria-current="true"] {
  border-color: #7c3aed;
  box-shadow: 0 6px 22px rgba(124, 58, 237, .45);
}

.vt-room-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #15171f;
}

.vt-room-btn > span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 9px 6px;
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .82));
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  .vt-roomlist { gap: 8px; padding-top: 44px; }
  .vt-room-btn { width: 116px; height: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .vt-room-btn:hover { transform: none; }
}

.vt-empty {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: #0b0b0f;
}

.vt-empty[hidden] {
  display: none;
}

.vt-empty h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.vt-empty p {
  margin: 0;
  max-width: 420px;
  color: rgba(255, 255, 255, .62);
  font-size: 14px;
  line-height: 1.6;
}

.vt-empty a {
  display: inline-block;
  margin-top: 6px;
  padding: 10px 20px;
  border-radius: 999px;
  background: #7c3aed;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

/* Pannellum: alleggeriamo i controlli di serie. */
.pnlm-load-box {
  background: rgba(11, 11, 15, .9) !important;
  border-radius: 12px;
}

.pnlm-controls-container {
  display: none;
}

.pnlm-compass,
.pnlm-panorama-info,
.pnlm-title-box,
.pnlm-author-box {
  display: none !important;
}

@media (max-width: 640px) {
  :root { --vt-arrow-size: 62px; }
  .vt-hs-badge { font-size: 13px; padding: 7px 13px; max-width: 170px; }
  .vt-topbar { top: 12px; left: 12px; right: 12px; }
  .vt-roomlist { left: 12px; right: 12px; bottom: 12px; }
}
