html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
  background: #000;
  color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

model-viewer {
  width: 100%;
  height: 100%;
}

model-viewer > #ar-prompt {
  display: none !important;
}

.viewer-container {
  position: absolute;
  width: 100%;
  height: 100%;
}

/* Harry Potter Logo at top */
.logo-container {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}

.hp-logo {
  height: 50px;
  width: auto;
  opacity: 0.9;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* JJP Logo at top */
.jjp-logo-container {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}

.jjp-logo-container a {
  pointer-events: auto;
  display: inline-block;
  cursor: pointer;
  transition: opacity 0.2s;
}

.jjp-logo-container a:hover {
  opacity: 0.8;
}

.jjp-logo {
  height: 64px;
  width: auto;
  opacity: 0.9;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  display: block;
}

/* Corner Buttons */
.custom-ar-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 10;
  padding: 0;
  border: none;
  background: none;
  opacity: 1;
  cursor: pointer;
}
.custom-ar-button img {
  width: 48px;
  height: 48px;
  display: block;
  background: none;
}

/* QR Code Overlay for Desktop AR */
#qr-code-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  z-index: 100000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.qr-code-container {
  background: #222;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  text-align: center;
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.qr-code-container h2 {
  margin: 0 0 24px 0;
  color: #fff;
  font-size: 1.8rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.qr-code-image {
  width: 300px;
  height: 300px;
  max-width: 90vw;
  display: block;
  margin: 0 auto 24px auto;
  background: white;
  padding: 12px;
  border-radius: 8px;
}

.qr-code-container p {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.qr-close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  padding: 5px 10px;
  transition: color 0.2s;
}

.qr-close-button:hover {
  color: #ffd700;
}

/* Firefox AR Browser Prompt */
#firefox-ar-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  z-index: 100000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.firefox-browser-link {
  display: inline-block;
  margin: 10px 0;
  padding: 16px 32px;
  background: linear-gradient(135deg, #b8860b 0%, #ffd700 100%);
  color: #000;
  text-decoration: none;
  border-radius: 8px;
  font-size: 1.3rem;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.firefox-browser-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 215, 0, 0.5);
}

/* Background Selector (upper right) */
.background-selector {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Shop Now Button (lower left) */
.shop-now-button {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 10;
  padding: 0;
  border: none;
  background: none;
  opacity: 1;
  cursor: pointer;
}
.shop-now-button img {
  width: 48px;
  height: 48px;
  display: block;
  background: none;
}
.bg-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 8px;
  transition: box-shadow 0.2s;
  display: none;
}
.bg-btn.selected {
  display: inline-block;
}
.background-selector.open .bg-btn {
  display: inline-block;
}
.bg-btn img {
  width: 48px;
  height: 48px;
  display: block;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Copyright text */
.copyright-text {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  max-width: 90%;
  line-height: 1.3;
}

/* Anchor Selector (upper left) */
.jump-to-view-selector {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
}
.jump-to-view-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.jump-to-view-button img {
  width: 48px;
  height: 48px;
  display: block;
}
.jump-to-view-dropdown {
  position: absolute;
  top: 56px;
  left: 0;
  background: #222;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  list-style: none;
  margin: 0;
  padding: 8px 0;
  min-width: 140px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.jump-to-view-dropdown li {
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.2s;
}
.jump-to-view-dropdown li:hover {
  background: #ffd700;
  color: #222;
}

.progress-bar {
  display: block;
  width: 33%;
  height: 10%;
  max-height: 2%;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate3d(-50%, -50%, 0);
  border-radius: 25px;
  box-shadow: 0px 3px 10px 3px rgba(0, 0, 0, 0.5), 0px 0px 5px 1px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.9);
  background-color: rgba(0, 0, 0, 0.5);
}

.progress-bar.show {
  background: #000;
}

.progress-bar.hide {
  visibility: hidden;
  transition: visibility 1s;
}

.update-bar {
  background-color: rgba(255, 255, 255, 0.9);
  width: 0%;
  height: 100%;
  border-radius: 25px;
  float: left;
  transition: width 0.3s;
}

/* AR Loader Overlay */
#ar-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column; 
  justify-content: center;
  align-items: center;
  z-index: 1000;
  gap: 20px;
}

.ar-loader-content {
  text-align: center;
  max-width: 90%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ar-loader-content h2 {
  color: #ffd700;
  font-size: 1.8em;
  margin: 20px 0 15px 0;
  font-weight: 600;
}

.ar-loader-content p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1em;
  margin: 10px 0;
  line-height: 1.5;
}

/* Make the text specifically white (legacy support) */
#ar-loader p {
  color: white;
  font-size: 1.5em;
  margin: 0;
}

/* The Spinner Animation */
#ar-loader .spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffd700;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ADD styles for the new Info Button (upper right) */
#info-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
#info-button img {
  width: 48px;
  height: 48px;
  display: block;
}


/* Add Tooltip Styles */
.tooltip-box {
  position: absolute;
  /* width: 220px; */
  padding: 15px;
  background-color: rgba(20, 20, 20, 0.9);
  border: 2px solid #ffd700;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 15px;
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 0.9em;
  line-height: 1.4;
}

.tooltip-box img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

#tooltip-controls {
  /* Centering */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  
  /* Sizing and layout */
  width: 90vw;
  max-width: 400px;
  flex-direction: column;
  align-items: flex-start;
  white-space: normal; /* ADD this to allow text to wrap inside this specific box */
}

/* List inside the controls tooltip */
.controls-list {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.controls-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.controls-list li:last-child {
  margin-bottom: 0;
}

.controls-list img {
  width: 32px; /* Slightly smaller icons for the list */
  height: 32px;
}

/* Individual Tooltip Positioning */
#tooltip-jumpto {
  top: 65px; /* Below the JumpTo button */
  left: 10px;
}

#tooltip-background {
  bottom: 65px; /* Above the Background button */
  left: 10px;
}

#tooltip-ar {
  bottom: 65px; /* Above the AR button */
  right: 10px;
}

#tooltip-info {
  top: 65px;
  right: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 128px;
}

#tooltip-options {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 215, 0, 0.3);
  width: 100%;
}

#tooltip-options label {
  display: flex;
  align-items: center;
  cursor: pointer;
  color: white;
  -webkit-user-select: none;
  user-select: none;
  font-size: 0.9em;
}

#tooltip-options input[type="checkbox"] {
  margin-right: 8px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: rgba(255, 215, 0, 0.95);
}

.background-buttons-container {
  margin-top: 8px;
}

.background-buttons-container > label {
  display: block;
  color: white;
  font-size: 0.9em;
  margin-bottom: 6px;
}

.background-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
}

.bg-option-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.bg-option-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.2);
}

.bg-option-btn.selected {
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.8));
}

.bg-option-btn img {
  display: block;
}

/* Annotation container - this is new and critical */
#annotation-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999999;
}

/* Ensure annotations are visible in AR mode */
model-viewer[ar-status="session-started"] ~ #annotation-container,
body:has(model-viewer[ar-status="session-started"]) #annotation-container {
  z-index: 2147483647; /* Maximum z-index */
}

/* Active annotation with navigation arrows */
.active-annotation {
  position: absolute;
  pointer-events: auto;
  background: rgba(20,20,20,0.75); /* Reduced from 0.95 by 1/4: 0.95 * 0.75 = 0.7125 */
  color: #f7f7f7;
  border: 2px solid rgba(255, 215, 0, 0.9);
  font-size: 0.95em;
  font-weight: 600;
  letter-spacing: 0.02em;
  max-width: min(480px, 80vw);
  white-space: normal;
  border-radius: 12px;
  padding: calc(0.55em + 2px) calc(1em + 2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  z-index: 1000000;
  overflow: visible;
  --min-hotspot-opacity: 0;
}

/* Title styling - center the title text */
.active-annotation > div:first-child:not(.active-details) {
  text-align: center;
}

/* Navigation arrow buttons */
.annotation-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(184, 134, 11, 0.9);
  border: 2px solid rgba(255, 215, 0, 0.95);
  border-radius: 50%;
  width: 12px;
  height: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: auto;
}

/* Expand clickable area to 2x size without changing visual appearance */
.annotation-nav-btn::before {
  content: '';
  position: absolute;
  top: -100%;
  right: -100%;
  bottom: -100%;
  left: -100%;
  cursor: pointer;
}

.annotation-nav-btn:hover {
  background: rgba(255, 215, 0, 0.95);
  transform: translateY(-50%) scale(1.2);
}

.annotation-nav-btn img {
  width: 28px;
  height: 28px;
  pointer-events: none;
}

.annotation-nav-btn.prev {
  left: -10px;
}

.annotation-nav-btn.next {
  right: -10px;
}

/* Active details styling */
.active-details {
  margin-top: 0.5em;
  background: rgba(97, 97, 97, 0.75);
  color: #cacaca;
  border-radius: 6px;
  padding: 0.7em 1em;
  font-size: 0.92em;
  font-weight: 400;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  line-height: 1.5;
  letter-spacing: 0.01em;
}

/* Hotspot styling */
.Hotspot {
  --min-hotspot-opacity: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 215, 0, 1);
  background: radial-gradient(circle at 30% 30%, #ffe9a6, #b8860b);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, opacity 0.5s ease;
  cursor: pointer;
  position: relative;
  pointer-events: auto;
  outline: none; /* Remove focus outline */
}

/* Remove focus outline on all states */
.Hotspot:focus,
.Hotspot:focus-visible {
  outline: none;
}

/* Only show hotspots when model-viewer marks them as visible */
.Hotspot:not([data-visible]) {
  opacity: 0 !important;
  pointer-events: none;
}

.Hotspot[data-visible] {
  opacity: 0.5; /* Normal visibility when facing camera and not occluded */
}

/* Visible state for hotspots */
/* .Hotspot.visible {
  opacity: 0.4;
  pointer-events: auto;
  --min-hotspot-opacity: 0;
} */

/* Active hotspot styling */
.Hotspot.active {
  opacity: 1 !important;
  transform: scale(1.1);
}

/* Hover state */
.Hotspot:hover {
  opacity: 1 !important;
}

/* Fade in animation when hotspots become visible */
.Hotspot.visible {
  animation: fadeIn 0.5s ease-in-out forwards;
}

/* Global hotspot hide - master switch from info panel */
.Hotspot.globally-hidden {
  display: none !important;
}

/* Distance-based hotspot hide - only applies when globally visible */
.Hotspot.distance-hidden {
  display: none !important;
}

/* Animation for annotation appearance */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.4;
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  /* Move controls tooltip down on mobile to avoid overlapping info panel */
  #tooltip-controls {
    top: 60%;
  }

  .active-annotation {
    max-width: 75vw; /* Consistent 75% screen width on mobile */
    width: 75vw; /* Force width to be exactly 75% of viewport */
    box-sizing: border-box; /* Include padding in width calculation */
  }
  
  .active-details {
    width: auto; /* Let details box fill the annotation width */
  }

  /* Larger navigation arrows for easier touch on mobile - 25% size increase */
  .annotation-nav-btn {
    width: 16px;  
    height: 16px;
  }

  .annotation-nav-btn img {
    width: 36px;  
    height: 36px; 
  }

  .annotation-nav-btn.prev {
    left: -12px; 
  }

  .annotation-nav-btn.next {
    right: -12px; 
  }
}

/* Hide hotspots in AR mode */
model-viewer[ar-status="session-started"] .Hotspot {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
