/* UDH MapIndoor Custom Styles */

body {
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

#map {
  background-color: #f1f5f9;
}

/* Floor switcher buttons - Compact size */
.floor-btn {
  width: 1.65rem;
  height: 1.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.70rem;
  font-weight: 700;
  border-radius: 0.45rem;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  color: #475569;
}

.floor-btn:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.floor-btn.active {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
  transform: scale(1.05);
}

/* Search result item hover */
.search-item {
  transition: background-color 0.15s ease;
  cursor: pointer;
}
.search-item:hover {
  background-color: #f8fafc;
}

/* Room tooltip on hover */
.room-tooltip {
  background-color: rgba(15, 23, 42, 0.88);
  border: none;
  border-radius: 0.5rem;
  color: #ffffff;
  font-family: 'Prompt', sans-serif;
  font-size: 0.75rem;
  padding: 4px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.room-tooltip::before {
  border-top-color: rgba(15, 23, 42, 0.88) !important;
}

/* Highlighted room pulse animation */
@keyframes roomPulse {
  0% {
    stroke-width: 2px;
    stroke-opacity: 1;
  }
  50% {
    stroke-width: 6px;
    stroke-opacity: 0.6;
  }
  100% {
    stroke-width: 2px;
    stroke-opacity: 1;
  }
}

.highlighted-room {
  animation: roomPulse 1.2s infinite ease-in-out;
}

/* Radar pulse marker for "You Are Here" */
.radar-pulse-marker {
  position: relative;
  width: 24px;
  height: 24px;
}

.radar-pulse-marker .dot {
  width: 14px;
  height: 14px;
  background-color: #2563eb;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  position: absolute;
  top: 5px;
  left: 5px;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.6);
  z-index: 2;
}

.radar-pulse-marker .pulse {
  width: 24px;
  height: 24px;
  background-color: rgba(37, 99, 235, 0.35);
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  animation: radarWave 1.8s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
  z-index: 1;
}

@keyframes radarWave {
  0% {
    transform: scale(0.6);
    opacity: 1;
  }
  100% {
    transform: scale(2.8);
    opacity: 0;
  }
}

/* Custom scrollbar for search results */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Dotted animated navigation path */
@keyframes dash {
  to {
    stroke-dashoffset: -20;
  }
}

.nav-path-animated {
  stroke-dasharray: 6, 6;
  animation: dash 0.8s linear infinite;
}

/* Building badge and tooltip */
.building-tooltip {
  background-color: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.6rem;
  color: #ffffff;
  font-family: 'Prompt', sans-serif;
  font-size: 0.75rem;
  padding: 6px 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.building-tooltip::before {
  border-top-color: rgba(15, 23, 42, 0.92) !important;
}

.bldg-center-label {
  background: transparent;
  border: none;
}

/* Route Step Item Styling */
.route-step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.75rem;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
}

.route-step-item:hover {
  background-color: #f0fdf4;
  border-color: #86efac;
  transform: translateX(2px);
}

.route-step-item.active {
  background-color: #ecfdf5;
  border-color: #10b981;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.route-step-badge {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Distinct path styling */
.nav-path-outdoor {
  stroke-dasharray: 8, 6;
  animation: dash 0.9s linear infinite;
}

.nav-path-indoor {
  stroke-dasharray: 6, 6;
  animation: dash 0.7s linear infinite;
}

/* Walkway Editor Markers & Controls */
.walkway-node-marker {
  width: 14px;
  height: 14px;
  background: #ffffff;
  border: 2.5px solid #475569;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.walkway-node-marker:hover {
  transform: scale(1.35);
  border-color: #0284c7;
  background: #e0f2fe;
}

.walkway-entrance-marker {
  width: 26px;
  height: 26px;
  background: #10b981;
  color: #ffffff;
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.walkway-entrance-marker:hover {
  transform: scale(1.25);
  background: #059669;
}

.walkway-gate-marker {
  width: 28px;
  height: 28px;
  background: #0284c7;
  color: #ffffff;
  border: 2px solid #ffffff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.walkway-gate-marker:hover {
  transform: scale(1.25);
  background: #0369a1;
}

/* Floating View Controls - Compact leaflet-control-layers-toggle with aria-haspopup */
.map-layers-wrapper {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 1000;
}

.leaflet-control-layers-toggle.map-layers-toggle-btn {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  color: #334155;
  user-select: none;
}

.leaflet-control-layers-toggle.map-layers-toggle-btn:hover {
  background: #ffffff;
  color: #059669;
  border-color: #cbd5e1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  transform: scale(1.05);
}

.leaflet-control-layers-toggle.map-layers-toggle-btn.active {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
}

.layers-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  width: 205px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 1rem;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 0.45rem;
  z-index: 1001;
  animation: fadeInDown 0.18s ease-out forwards;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.layers-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem 0.35rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 0.25rem;
}

.layers-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.55rem;
  border-radius: 0.65rem;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.layers-menu-item:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.layers-menu-item.active {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.layers-menu-item.active .layers-check {
  display: inline-block !important;
}

/* Selected Room Dark Badge Tooltip (ตรึงอยู่ตามรูปแนบ) */
.leaflet-tooltip.room-selected-tooltip {
  background-color: #0f172a !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  border-radius: 9999px !important;
  padding: 4px 10px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
  letter-spacing: 0.01em;
}

.leaflet-tooltip.room-selected-tooltip::before {
  border-top-color: #0f172a !important;
}

/* Clean Fullscreen Mode Styles */
body.fullscreen-clean-mode #buildingSelectPopupBtn,
body.fullscreen-clean-mode #emergencyTopBtn,
body.fullscreen-clean-mode #openDirectionsBtn,
body.fullscreen-clean-mode #eventsTopBtn {
  display: none !important;
}

/* Permanent Building Map Labels - Compact, subtle & faint matching mockup */
.building-permanent-label {
  background: rgba(255, 255, 255, 0.90) !important;
  color: #475569 !important; /* จางลง นุ่มนวล ไม่แย่งสายตา */
  border: 1px solid rgba(203, 213, 225, 0.85) !important;
  border-radius: 0.35rem !important;
  padding: 0.12rem 0.38rem !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
  font-size: 0.58rem !important; /* ตัวหนังสือเล็กลง (~9.5px) */
  font-weight: 600 !important;
  line-height: 1.15 !important;
  text-align: center !important;
  white-space: nowrap !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, color 0.15s ease !important;
}

.building-permanent-label::before,
.building-permanent-label::after {
  display: none !important;
}

.building-permanent-label:hover {
  transform: scale(1.06) !important;
  color: #0f172a !important;
  background: rgba(255, 255, 255, 0.98) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14) !important;
  border-color: #94a3b8 !important;
}

.building-permanent-label.active-building-label {
  background: #059669 !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35) !important;
  transform: scale(1.05) !important;
  font-size: 0.62rem !important;
  z-index: 600 !important;
}

/* 2.5D / 3D Isometric Mode Styles */
.map-container-3d {
  perspective: 1200px;
  overflow: hidden;
}

.map-3d-active .leaflet-map-pane {
  transform: rotateX(45deg) rotateZ(-18deg) scale(0.95);
  transform-origin: 50% 50%;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.leaflet-map-pane {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 3D Extrusion on Building Polygons */
.bldg-3d-extruded {
  filter: drop-shadow(0 6px 8px rgba(15, 23, 42, 0.3));
}

/* 3D Elevated Skywalk styling */
.skywalk-3d-elevated {
  transition: all 0.3s ease;
}
.map-3d-active .skywalk-3d-elevated {
  filter: drop-shadow(0 4px 6px rgba(124, 58, 237, 0.35));
}

.campus-walkway-faint {
  transition: opacity 0.3s ease;
}

/* Multi-floor Stack Visuals */
.floor-stack-plane {
  transition: all 0.3s ease;
}

.floor-stack-badge {
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  white-space: nowrap;
}

.vertical-shaft-line {
  stroke-dasharray: 4, 4;
  animation: shaftPulse 1.2s ease-in-out infinite alternate;
}

@keyframes shaftPulse {
  0% { opacity: 0.4; }
  100% { opacity: 0.95; }
}

/* Print Styles for QR Code Cards */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    overflow: visible !important;
  }

  header, nav, #toolbarCampus, #toolbarFloor, .tab-btn, .no-print,
  #roomModal, #buildingModal, #floorModal, #singleQrModal,
  .toast, #statBuildingCount, .editor-tool-btn, #saveAllBtn,
  #tabRooms, #tabMapEditor, #tabBuildings, #tabExport,
  #tabQrCode > div:first-child {
    display: none !important;
  }

  main {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  #tabQrCode {
    display: block !important;
  }

  #qrPrintArea {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .qr-card {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    border: 1.5px solid #94a3b8 !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }
}

/* Floating Panels (Route Planner, Voice Search, QR Scanner) & Overlays */
#routePlannerPanel {
  z-index: 1100;
}

#voiceSearchModal,
#qrScanModal {
  z-index: 1200;
}

#navGuidance {
  position: fixed !important;
  z-index: 9500 !important;
}

#poiDrawer {
  position: fixed !important;
  z-index: 9000 !important;
}

#toast,
#qrSuccessToast {
  z-index: 100001 !important;
}

/* Voice Search Soundwave Equalizer Animation */
@keyframes soundwave-anim {
  0%, 100% { height: 6px; }
  50% { height: 26px; }
}

.soundwave-bar {
  animation: soundwave-anim 1.1s ease-in-out infinite;
}
.soundwave-bar:nth-child(2) { animation-delay: 0.15s; }
.soundwave-bar:nth-child(3) { animation-delay: 0.3s; }
.soundwave-bar:nth-child(4) { animation-delay: 0.45s; }
.soundwave-bar:nth-child(5) { animation-delay: 0.6s; }

/* Bottom Navigation Bar & Safe Area */
#bottomNav {
  z-index: 8000 !important;
  padding-bottom: max(6px, env(safe-area-inset-bottom, 6px));
}

#emergencyModal {
  z-index: 100000 !important;
}

@keyframes slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.animate-slide-up {
  animation: slide-up 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#journeyModal {
  z-index: 100000 !important;
}

/* Elderly / High-Contrast Mode Styles */
body.elderly-mode {
  font-size: 1.15rem;
}
body.elderly-mode input,
body.elderly-mode select {
  font-size: 1.05rem !important;
  min-height: 48px;
}
body.elderly-mode .text-xs {
  font-size: 0.95rem !important;
  line-height: 1.35 !important;
}
body.elderly-mode .text-sm {
  font-size: 1.12rem !important;
  line-height: 1.4 !important;
}
body.elderly-mode .text-\[10px\],
body.elderly-mode .text-\[11px\] {
  font-size: 0.85rem !important;
}
body.elderly-mode button {
  font-weight: 700 !important;
  min-height: 44px;
}

/* Utilities */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Building Select Modal */
#buildingSelectModal .bldg-filter-pill {
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

/* Leaflet Zoom Control on Mobile - Elevated above bottom nav */
@media (max-width: 768px) {
  .leaflet-bottom.leaflet-right {
    margin-bottom: 4.85rem !important; /* Above bottom navigation bar */
    margin-right: 0.65rem !important;
  }

  .leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18) !important;
    border-radius: 0.85rem !important;
    overflow: hidden !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
  }

  .leaflet-control-zoom a {
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #334155 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-bottom: 1px solid #f1f5f9 !important;
    transition: all 0.15s ease !important;
  }

  .leaflet-control-zoom a:hover,
  .leaflet-control-zoom a:active {
    background: #ecfdf5 !important;
    color: #059669 !important;
  }
}

/* POI Drawer Hero Header Background */
#drawerHeroHeader {
  min-height: 84px;
}

#drawerHeroBg {
  background-size: cover;
  background-position: center;
  filter: saturate(1.15) brightness(0.95);
}




