/* ==========================================================================
   360 PANORAMA VIRTUAL TOUR - MAIN STYLESHEET
   ========================================================================== */

:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --bg-glass: rgba(22, 27, 38, 0.78);
  --bg-glass-card: rgba(30, 36, 50, 0.85);
  --border-glass: rgba(255, 255, 255, 0.14);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow-glow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 20px rgba(59, 130, 246, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: #090d14;
  color: var(--text-main);
}

/* ==========================================================================
   1. PRELOADER SCREEN
   ========================================================================== */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #1e293b 0%, #0b0f17 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

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

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.loader-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-main);
}

.loader-logo i {
  color: var(--primary-color);
  font-size: 26px;
}

.progress-ring-container {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring-bar {
  transition: stroke-dashoffset 0.2s linear;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.percentage-text {
  position: absolute;
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.loader-status {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* ==========================================================================
   2. PANORAMA CONTAINER
   ========================================================================== */
.panorama-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  overflow: hidden;
  background-color: #000;
}

#panorama-container .pnm-container,
#panorama-container .pnm-render-container,
#panorama-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Hide default Pannellum controls to use custom sleek UI */
.pnm-controls-container,
.pnm-load-button,
.pnm-hotspot-tooltip,
.pnm-hotspot-container,
.pnm-hotspot,
.pnm-title-box,
.pnm-author-box,
.pnm-compass,
.pnm-video-controls,
.pnm-panorama-info,
.pnm-scene-title,
.pnm-title,
.pnm-info-box,
div[class*="pnm-title"],
div[class*="pnm-info"],
div[class*="pnm-hotspot"] {
  display: none !important;
}

/* Custom 360 Hotspot Styling (Speech Bubble Badge + Ground Circle Ring) */
.pnm-hotspot {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: auto !important;
  height: auto !important;
}

.custom-hotspot-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.25s ease, filter 0.25s ease;
  z-index: 10;
  transform: translate(-50%, -50%);
}

.custom-hotspot-wrapper:hover {
  transform: translate(-50%, -50%) scale(1.12);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.95));
}

.hotspot-label-box {
  position: relative;
  background: rgba(55, 55, 55, 0.92);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  letter-spacing: 0.3px;
  margin-bottom: 8px;
  text-transform: lowercase;
}

/* Downward speech bubble pointer arrow pointing to the ground ring */
.hotspot-label-box::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(55, 55, 55, 0.92);
}

.hotspot-ground-circle {
  width: 36px;
  height: 14px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  animation: groundPulse 2.2s infinite ease-in-out;
}

@keyframes groundPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
    box-shadow: 0 0 16px rgba(255, 255, 255, 1);
  }
}

/* ==========================================================================
   3. TOP BRANDING HEADER
   ========================================================================== */
.top-branding {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 10;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   4. MINI MAP WIDGET (BOTTOM LEFT)
   ========================================================================== */
.map-widget {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 20;
  width: 260px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, transform 0.35s ease;
  opacity: 1;
}

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

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.map-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-title-icon {
  color: var(--primary-color);
  font-size: 14px;
}

.map-scene-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.map-selector-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.floor-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  color: #fff;
  padding: 4px 22px 4px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  outline: none;
  transition: background 0.2s;
}

.floor-select:hover {
  background: rgba(255, 255, 255, 0.2);
}

.dropdown-arrow {
  position: absolute;
  right: 8px;
  font-size: 9px;
  color: var(--text-muted);
  pointer-events: none;
}

.map-canvas-container {
  position: relative;
  width: 100%;
  height: 170px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.map-canvas-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0.9) contrast(1.1);
}

.map-pins-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Map Pin Marker Styling */
.map-pin {
  position: absolute;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #1e293b;
  font-size: 9px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  transition: transform 0.2s ease, background 0.2s ease;
}

.map-pin:hover {
  transform: translate(-50%, -50%) scale(1.3);
  background: #ffffff;
  z-index: 10;
}

.map-pin.active {
  background: var(--primary-color);
  color: #ffffff;
  width: 22px;
  height: 22px;
  z-index: 8;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.9);
}

.map-pin.active::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  animation: mapPulse 1.8s infinite;
}

@keyframes mapPulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Map Pin Tooltip */
.map-pin-tooltip {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.map-pin:hover .map-pin-tooltip {
  opacity: 1;
}

/* ==========================================================================
   5. BOTTOM CENTER COLLAPSED TOGGLE BUTTON (STATE 2 UI)
   ========================================================================== */
.drawer-open-btn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s;
}

.drawer-open-btn:hover {
  transform: translateX(-50%) scale(1.12);
  background: rgba(35, 42, 58, 0.95);
  border-color: rgba(255, 255, 255, 0.3);
}

.drawer-open-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px) scale(0.8);
}

/* ==========================================================================
   6. EXPANDED UI OPTIONS DRAWER (STATE 1 UI)
   ========================================================================== */
.ui-options-drawer {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 40;
  width: min(860px, 92vw);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-glow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 1;
}

.ui-options-drawer.hidden {
  transform: translateX(-50%) translateY(120%);
  opacity: 0;
  pointer-events: none;
}

/* Drawer Header */
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title-wrapper {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
}

.drawer-subtitle {
  color: var(--text-muted);
}

.drawer-active-name {
  color: #ffffff;
  font-weight: 700;
  text-transform: uppercase;
}

/* Category Filter Tabs */
.category-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.cat-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.cat-tab.active {
  background: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.drawer-close-icon {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
}

.drawer-close-icon:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Carousel Wrapper & Scroll Container */
.carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.carousel-nav-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s ease;
}

.carousel-nav-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.thumbnail-carousel {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 6px 2px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;  /* IE/Edge */
}

.thumbnail-carousel::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* Thumbnail Item Card */
.thumb-card {
  position: relative;
  flex: 0 0 140px;
  height: 84px;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  background: #0f172a;
}

.thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.thumb-card:hover img {
  transform: scale(1.08);
}

.thumb-label {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 12px 6px 4px 6px;
  text-align: center;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thumb-card.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.7);
  transform: scale(1.03);
}

.thumb-card.active .thumb-label {
  color: var(--primary-color);
}

/* Toolbar Controls Bar */
.toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tool-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateY(-2px);
}

.tool-btn.active {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
}

.tool-btn.btn-danger:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

/* ==========================================================================
   7. RESPONSIVE DESIGN (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 768px) {
  .map-widget {
    width: 200px;
    bottom: 16px;
    left: 16px;
    padding: 10px;
  }
  
  .map-canvas-container {
    height: 120px;
  }
  
  .ui-options-drawer {
    width: 95vw;
    padding: 12px;
    bottom: 12px;
  }

  .category-tabs {
    scale: 0.9;
  }

  .thumb-card {
    flex: 0 0 110px;
    height: 68px;
  }

  .tool-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
}
