/**
 * Marzipano 360° Tour — integrated into F3 layout
 * Based on original V1 style.css, adapted for Bootstrap 5 container
 * All positions relative to #tour-container instead of body/html
 */

/* ===== Container ===== */
#tour-container {
  position: relative;
  width: 100%;
  /* 16:10 aspect ratio via padding-bottom, overridden by JS for fullscreen */
  padding-bottom: 62.5%;
  overflow: hidden;
  background-color: #000;
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#tour-container.tour-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding-bottom: 0;
  z-index: 10000;
}

#tour-container a,
#tour-container a:hover,
#tour-container a:active,
#tour-container a:visited {
  text-decoration: none;
  color: inherit;
}

#tour-container a.infoLink {
  color: rgb(249, 187, 0);
}

/* ===== Pano ===== */
#tour-container #pano {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ===== Title Bar ===== */
#tour-container #titleBar {
  position: absolute;
  top: 0;
  left: 40px;
  right: 80px;
  height: 40px;
  text-align: center;
  z-index: 2;
}

#tour-container #titleBar .sceneName {
  width: 100%;
  height: 100%;
  line-height: 30px;
  padding: 5px;
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0;
  background-color: rgba(58, 68, 84, 0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* ===== Toggle Buttons ===== */
#tour-container #fullscreenToggle {
  display: block;
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  padding: 5px;
  background-color: rgba(103, 115, 131, 0.8);
  cursor: pointer;
  z-index: 2;
}

#tour-container #autorotateToggle {
  display: block;
  position: absolute;
  top: 0;
  right: 40px;
  width: 40px;
  height: 40px;
  padding: 5px;
  background-color: rgba(103, 115, 131, 0.8);
  cursor: pointer;
  z-index: 2;
}

#tour-container #sceneListToggle {
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  padding: 5px;
  background-color: rgba(103, 115, 131, 0.8);
  cursor: pointer;
  z-index: 2;
}

/* Icons in toggles */
#tour-container #fullscreenToggle .icon,
#tour-container #autorotateToggle .icon,
#tour-container #sceneListToggle .icon {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 30px;
  height: 30px;
}

/* On/Off states */
#tour-container #fullscreenToggle .icon.on,
#tour-container #autorotateToggle .icon.on,
#tour-container #sceneListToggle .icon.on {
  display: none;
}

#tour-container #fullscreenToggle .icon.off,
#tour-container #autorotateToggle .icon.off,
#tour-container #sceneListToggle .icon.off {
  display: block;
}

#tour-container #fullscreenToggle.enabled .icon.on,
#tour-container #autorotateToggle.enabled .icon.on,
#tour-container #sceneListToggle.enabled .icon.on {
  display: block;
}

#tour-container #fullscreenToggle.enabled .icon.off,
#tour-container #autorotateToggle.enabled .icon.off,
#tour-container #sceneListToggle.enabled .icon.off {
  display: none;
}

/* ===== Scene List ===== */
#tour-container #sceneList {
  position: absolute;
  top: 0;
  left: -220px;
  padding-top: 40px;
  width: 220px;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  margin-left: 0;
  transition: margin-left 0.5s ease-in-out;
  z-index: 1;
}

#tour-container #sceneList .scenes {
  width: 100%;
  background-color: rgba(58, 68, 84, 0.8);
}

#tour-container #sceneList.enabled {
  margin-left: 220px;
}

#tour-container #sceneList .scene {
  display: block;
  width: 100%;
  height: 30px;
}

#tour-container #sceneList .scene .text {
  width: 100%;
  height: 100%;
  padding: 0 15px;
  line-height: 30px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#tour-container #sceneList .scene:hover {
  background-color: rgba(103, 115, 131, 0.8);
}

#tour-container #sceneList .scene.current {
  background-color: rgba(103, 115, 131, 0.8);
}

/* ===== Link Hotspot ===== */
#tour-container .link-hotspot {
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-top: -30px;
  opacity: 0.9;
  transition: opacity 0.2s;
}

#tour-container .link-hotspot:hover {
  opacity: 1;
}

#tour-container .link-hotspot-icon {
  width: 100%;
  height: 100%;
  cursor: pointer;
}

#tour-container .link-hotspot-tooltip {
  position: absolute;
  left: 100%;
  top: 14px;
  margin-left: 3px;
  font-size: 16px;
  max-width: 300px;
  padding: 8px 10px;
  border-radius: 5px;
  background-color: rgba(58, 68, 84, 0.8);
  color: #fff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: translateX(-8px);
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
}

#tour-container .link-hotspot:hover .link-hotspot-tooltip {
  opacity: 1;
  transform: translateX(0);
  pointer-events: all;
}

/* ===== Info Hotspot ===== */
#tour-container .info-hotspot {
  line-height: 1.2em;
  opacity: 0.9;
  transition: opacity 0.2s 0.2s;
}

#tour-container .info-hotspot:hover {
  opacity: 1;
  transition: opacity 0.2s;
}

#tour-container .info-hotspot.visible {
  opacity: 1;
}

#tour-container .info-hotspot .info-hotspot-header {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background-color: rgb(103, 115, 131);
  cursor: pointer;
  transition: width 0.3s ease-in-out 0.5s,
              border-radius 0.3s ease-in-out 0.5s;
}

#tour-container .info-hotspot .info-hotspot-header:hover {
  width: 260px;
  border-radius: 5px;
  transition: width 0.3s ease-in-out,
              border-radius 0.3s ease-in-out;
}

#tour-container .info-hotspot.visible .info-hotspot-header,
#tour-container .info-hotspot.visible .info-hotspot-header:hover {
  width: 260px;
  border-radius: 5px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
  transition: width 0.3s ease-in-out,
              border-radius 0.3s ease-in-out;
}

#tour-container .info-hotspot .info-hotspot-icon-wrapper {
  width: 40px;
  height: 40px;
}

#tour-container .info-hotspot .info-hotspot-icon {
  width: 90%;
  height: 90%;
  margin: 5%;
}

#tour-container .info-hotspot .info-hotspot-title-wrapper {
  position: absolute;
  left: 40px;
  top: 0;
  width: 0;
  height: 40px;
  padding: 0;
  overflow: hidden;
  transition: width 0s 0.4s, padding 0s 0.4s;
}

#tour-container .info-hotspot.visible .info-hotspot-title-wrapper,
#tour-container .info-hotspot .info-hotspot-header:hover .info-hotspot-title-wrapper {
  width: 220px;
  padding: 0 5px;
  transition: width 0s 0.4s, padding 0s 0.4s;
}

#tour-container .info-hotspot .info-hotspot-title-wrapper:before {
  content: '';
  display: inline-block;
  vertical-align: middle;
  height: 100%;
}

#tour-container .info-hotspot .info-hotspot-title {
  display: inline-block;
  vertical-align: middle;
  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

#tour-container .info-hotspot .info-hotspot-close-wrapper {
  position: absolute;
  left: 260px;
  top: 0;
  height: 40px;
  width: 40px;
  border-top-right-radius: 5px;
  background-color: rgb(78, 88, 104);
  visibility: hidden;
  transform: perspective(200px) rotateY(90deg);
  transform-origin: 0 50% 0;
  transition: transform 0.3s 0.3s, visibility 0s 0.6s;
}

#tour-container .info-hotspot.visible .info-hotspot-close-wrapper {
  visibility: visible;
  transform: perspective(200px) rotateY(0deg);
  transition: transform 0.3s, visibility 0s 0s;
}

#tour-container .info-hotspot .info-hotspot-close-icon {
  width: 70%;
  height: 70%;
  margin: 15%;
}

#tour-container .info-hotspot .info-hotspot-text {
  position: absolute;
  z-index: 9000;
  width: 300px;
  height: auto;
  max-height: 200px;
  top: 40px;
  left: 0;
  padding: 10px;
  background-color: rgb(58, 68, 84);
  border-bottom-right-radius: 5px;
  border-bottom-left-radius: 5px;
  overflow-y: auto;
  visibility: hidden;
  transform: perspective(200px) rotateX(-89.999deg);
  transform-origin: 50% 0 0;
  transition: transform 0.3s, visibility 0s 0.3s;
  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

#tour-container .info-hotspot.visible .info-hotspot-text {
  visibility: visible;
  transform: perspective(200px) rotateX(0deg);
  transition: transform 0.3s 0.3s, visibility 0s 0s;
}

/* ===== Info Hotspot Modal (mobile) ===== */
#tour-container .info-hotspot-modal {
  top: 0;
  left: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 11000 !important;
  background-color: rgba(0, 0, 0, .5);
  line-height: 1.2em;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-in-out 0.5s, visibility 0s 0.7s;
}

#tour-container .info-hotspot-modal.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease-in-out, visibility 0s 0s;
}

#tour-container .info-hotspot-modal .info-hotspot-header {
  position: absolute;
  top: 60px;
  left: 10px;
  right: 10px;
  width: auto;
  height: 50px;
  background-color: rgba(103, 115, 131, 0.8);
  opacity: 0;
  transition: opacity 0.3s ease-in-out 0.2s;
}

#tour-container .info-hotspot-modal.visible .info-hotspot-header {
  opacity: 1;
}

#tour-container .info-hotspot-modal .info-hotspot-icon-wrapper {
  width: 50px;
  height: 50px;
}

#tour-container .info-hotspot-modal .info-hotspot-icon {
  width: 90%;
  height: 90%;
  margin: 5%;
}

#tour-container .info-hotspot-modal .info-hotspot-title-wrapper {
  position: absolute;
  top: 0;
  left: 50px;
  right: 50px;
  width: auto;
  height: 50px;
  padding: 0 10px;
}

#tour-container .info-hotspot-modal .info-hotspot-title-wrapper:before {
  content: '';
  display: inline-block;
  vertical-align: middle;
  height: 100%;
}

#tour-container .info-hotspot-modal .info-hotspot-title {
  display: inline-block;
  vertical-align: middle;
}

#tour-container .info-hotspot-modal .info-hotspot-close-wrapper {
  position: absolute;
  top: 0;
  right: 0;
  width: 50px;
  height: 50px;
  background-color: rgba(78, 88, 104, 0.8);
  cursor: pointer;
}

#tour-container .info-hotspot-modal .info-hotspot-close-icon {
  width: 70%;
  height: 70%;
  margin: 15%;
}

#tour-container .info-hotspot-modal .info-hotspot-text {
  position: absolute;
  top: 110px;
  bottom: 10px;
  left: 10px;
  right: 10px;
  padding: 10px;
  background-color: rgba(58, 68, 84, 0.8);
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

#tour-container .info-hotspot-modal.visible .info-hotspot-text {
  opacity: 1;
  transition: opacity 0.3s ease-in-out 0.4s;
}

/* ===== Video Hotspot ===== */
#tour-container .video-hotspot {
  z-index: 1000;
  background-color: #444;
  position: relative;
  width: 200px;
  height: 114px;
}

/* ===== View Control Buttons ===== */
#tour-container .viewControlButton {
  display: none;
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 40px;
  height: 40px;
  padding: 5px;
  background-color: rgba(103, 115, 131, 0.8);
  z-index: 2;
}

#tour-container.view-control-buttons .viewControlButton {
  display: block;
}

@media (max-width: 600px) {
  #tour-container.view-control-buttons .viewControlButton {
    display: none;
  }
}

#tour-container .viewControlButton .icon {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 30px;
  height: 30px;
}

#tour-container .viewControlButton-1 { margin-left: -145px; }
#tour-container .viewControlButton-2 { margin-left: -95px; }
#tour-container .viewControlButton-3 { margin-left: -45px; }
#tour-container .viewControlButton-4 { margin-left: 5px; }
#tour-container .viewControlButton-5 { margin-left: 55px; }
#tour-container .viewControlButton-6 { margin-left: 105px; }

/* ===== Mobile adjustments ===== */
@media (max-width: 768px) {
  #tour-container {
    padding-bottom: 75%; /* taller on mobile */
  }

  #tour-container #sceneList {
    width: 100%;
    left: -100%;
  }

  #tour-container #sceneList.enabled {
    margin-left: 100%;
  }

  #tour-container #sceneList .scene {
    height: 40px;
  }

  #tour-container #sceneList .scene .text {
    line-height: 40px;
  }

  #tour-container #titleBar {
    height: 50px;
  }

  #tour-container #titleBar .sceneName {
    line-height: 40px;
  }
}
