/* ==========================================================
   Global Reset & Base Setup
   ========================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #000000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #ffffff;
}

/* ==========================================================
   3D Panorama Canvas Container
   ========================================================== */
#panorama-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: grab;
}

#panorama-container:active {
  cursor: grabbing;
}

/* ==========================================================
   Loading Screen (Matches Reference Screenshot)
   ========================================================== */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000000;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
}

#loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 80vh;
  margin-bottom: 2rem;
}

.loading-logo {
  max-width: 85vw;
  max-height: 72vh;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.8));
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.98;
  }
  50% {
    transform: scale(1.015);
    opacity: 1;
  }
}

.progress-section {
  position: absolute;
  bottom: 8%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  padding: 0 20px;
}

.progress-bar-container {
  width: 380px;
  max-width: 65vw;
  height: 6px;
  background-color: #333333;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00b074, #00d285);
  border-radius: 999px;
  transition: width 0.08s linear;
  box-shadow: 0 0 12px rgba(0, 210, 133, 0.5);
}

#progress-text {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  min-width: 45px;
  text-align: left;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================
   Virtual Tour UI Overlay
   ========================================================== */
#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.5s ease;
}

#ui-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================
   Bottom Right: Brand Logo Badge (Matches Reference Screenshot)
   ========================================================== */
.brand-watermark {
  position: absolute;
  bottom: 24px;
  right: 28px;
  width: 90px;
  z-index: 25;
  pointer-events: none;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.75));
  opacity: 0.95;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.brand-watermark img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

/* Interaction Help Hint */
.interaction-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  font-size: 14px;
  color: #e2e8f0;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  animation: hintSequence 5s ease forwards;
}

@keyframes hintSequence {
  0% { opacity: 0; transform: translate(-50%, -40%); }
  15% { opacity: 1; transform: translate(-50%, -50%); }
  80% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, -60%); visibility: hidden; }
}

/* ==========================================================
   Bottom Center Toggle Button (Collapsed State - Screenshot 1)
   ========================================================== */
.bottom-toggle-btn {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(30, 36, 48, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 20;
}

.bottom-toggle-btn:hover {
  background: rgba(45, 55, 72, 0.95);
  transform: translateX(-50%) translateY(-3px) scale(1.05);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7);
}

.bottom-toggle-btn.hide {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(30px) scale(0.8);
}

/* ==========================================================
   Left Side: Floor Plan Mini-Map Card (Screenshot 2)
   ========================================================== */
.floor-plan-card {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 250px;
  height: 250px;
  background: rgba(26, 32, 45, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  z-index: 25;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.floor-plan-card.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.92);
}

.floor-plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(18, 22, 32, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.fp-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-pin-icon {
  color: #00a2e8;
  flex-shrink: 0;
}

.fp-dropdown-badge {
  font-size: 10px;
  font-weight: 500;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.fp-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.fp-close-btn:hover {
  color: #ffffff;
}

.floor-plan-body {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  background: #141822;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blank-floorplan-area {
  width: 100%;
  height: 100%;
  background: #141822;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  margin: 12px;
  border-radius: 10px;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* ==========================================================
   Main Expanded Bottom Panel (Screenshot 2)
   ========================================================== */
.tour-panel {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(840px, 94vw);
  min-height: 195px;
  background: rgba(28, 34, 46, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 20px 14px;
  gap: 10px;
  pointer-events: auto;
  z-index: 30;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease, visibility 0.45s;
}

.tour-panel.collapsed {
  transform: translateX(-50%) translateY(calc(100% + 40px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Panel Header */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-title-area {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.panel-subtitle {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 1px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
}

/* Tabs: Floor Plan / 3D Floor Plan */
.panel-tab-pills {
  display: flex;
  align-items: center;
  background: rgba(15, 20, 28, 0.6);
  padding: 3px;
  border-radius: 999px;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tab-pill {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
}

.tab-pill:hover {
  color: #ffffff;
}

.tab-pill.active {
  background: #00a2e8;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 162, 232, 0.4);
}

.panel-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.panel-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  transform: rotate(90deg);
}

/* Thumbnails Carousel */
.thumbnails-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 0 10px;
  scroll-behavior: smooth;
  min-height: 98px;
}

.thumbnails-container::-webkit-scrollbar {
  height: 4px;
}

.thumbnails-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
}

.thumbnails-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
}

.thumbnails-track {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.thumb-card {
  flex: 0 0 115px;
  display: flex;
  flex-direction: column;
  background: rgba(18, 22, 32, 0.8);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.25s ease;
}

.thumb-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 162, 232, 0.6);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.thumb-card.active {
  border-color: #00a2e8;
  box-shadow: 0 0 14px rgba(0, 162, 232, 0.5);
}

.thumb-card.placeholder {
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(18, 22, 32, 0.4);
  cursor: default;
  opacity: 0.7;
}

.thumb-card.placeholder:hover {
  transform: none;
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: none;
}

.thumb-img-wrapper {
  width: 100%;
  height: 65px;
  background: #111520;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-card.placeholder .thumb-img-wrapper {
  background: rgba(14, 18, 26, 0.5);
  color: #475569;
}

.thumb-title {
  padding: 6px 4px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  color: #cbd5e1;
  background: #161b26;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.thumb-card.active .thumb-title {
  background: #00a2e8;
  color: #ffffff;
}

.thumb-card.placeholder .thumb-title {
  color: #64748b;
  font-weight: 500;
}

/* Panel Toolbar */
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tool-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.tool-btn.active {
  color: #00a2e8;
  background: rgba(0, 162, 232, 0.15);
}

.tool-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 4px;
}

/* Responsive */
@media (max-width: 768px) {
  .tour-panel {
    width: 96vw;
    padding: 12px;
  }
  .thumb-card {
    flex: 0 0 95px;
  }
  .thumb-img-wrapper {
    height: 55px;
  }
  .floor-plan-card {
    width: 200px;
    height: 200px;
    bottom: 20px;
    left: 14px;
  }
  .tool-btn {
    width: 30px;
    height: 30px;
  }
  .brand-watermark {
    width: 65px;
    bottom: 16px;
    right: 16px;
  }
}
