/* --- LAYOUT --- */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: #1a1a1a !important;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
  user-select: none;
}

#map {
  width: 100vw;
  height: 100vh;
  touch-action: none;
  background: #000000 !important;
  position: absolute;
  top: 0;
  left: 0;
  outline: none;
  z-index: 1;
}

.leaflet-container {
  height: 100% !important;
  width: 100% !important;
  background: #000000 !important;
}

/* --- OVERLAY SIDEBAR & HEADER --- */
#sidebar {
  width: 300px;
  height: 100vh;
  background: #111;
  color: #eee;
  padding: 20px;
  box-sizing: border-box;
  border-right: 2px solid #333;
  overflow-y: auto;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20000;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: flex-start;
  flex-direction: column;
}

#sidebar.collapsed {
  transform: translateX(-100%);
}

#sidebar h2 {
  color: #4CAF50;
  font-size: 20px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 0;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #333;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

#sidebar-toggle {
  position: fixed;
  top: 15px;
  left: 300px;
  width: 32px;
  height: 38px;
  background: #1a1a1a;
  border: 1px solid #4CAF50;
  border-left: none;
  color: #4CAF50;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 4px 4px 0;
  z-index: 20001;
  box-shadow: 3px 0 8px rgba(0,0,0,0.5);
  user-select: none;
  transition: left 0.3s ease;
}

body.sidebar-collapsed #sidebar-toggle {
  left: 0;
}

/* --- SHIFTING COORDINATES DISPLAY --- */
#coords-display {
  position: fixed;
  bottom: 15px;
  left: 315px; /* Sits right next to the 300px open sidebar */
  z-index: 10000;
  background: rgba(0, 0, 0, 0.85);
  color: #4CAF50;
  padding: 6px 12px;
  border: 1px solid #4CAF50;
  border-radius: 4px;
  font-family: monospace;
  font-size: 14px;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  transition: left 0.3s ease; /* Matches sidebar slide duration */
}

body.sidebar-collapsed #coords-display {
  left: 15px; /* Moves back to screen corner when sidebar closes */
}

#floor-label {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.85);
  color: #4CAF50;
  padding: 12px 24px;
  border-radius: 4px;
  border: 2px solid #4CAF50;
  font-weight: 900;
  font-size: 20px;
  pointer-events: none;
  text-transform: uppercase;
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  font-family: sans-serif;
  letter-spacing: 1px;
}

/* --- TOP-CENTER TOAST NOTIFICATION --- */
#toast-notification {
  position: fixed;
  top: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background-color: rgba(10, 18, 14, 0.95);
  border: 2px solid #4CAF50;
  color: #4CAF50;
  padding: 10px 24px;
  border-radius: 8px;
  font-family: sans-serif;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

#toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- GREEN SCROLLBAR --- */
#sidebar::-webkit-scrollbar { width: 8px !important; }
#sidebar::-webkit-scrollbar-track { background: #111 !important; }
#sidebar::-webkit-scrollbar-thumb { background: #4CAF50 !important; border-radius: 4px !important; }

/* --- ZOOM CONTROLS --- */
.leaflet-top.leaflet-right {
  top: 15px !important;
  right: 15px !important;
  z-index: 10000 !important;
}

.leaflet-bar a {
  background-color: #1a1a1a !important;
  color: #4CAF50 !important;
  border: 1px solid #4CAF50 !important;
}

/* --- IMAGE & MARKER INTERACTION --- */
img {
  -webkit-user-drag: none !important;
  user-select: none !important;
  pointer-events: none !important;
}

.leaflet-marker-icon, .expand-btn, input, button, .leaflet-popup-content-wrapper {
  pointer-events: auto !important;
}

.leaflet-marker-icon {
  transition: none !important;
}

.custom-marker img {
  width: var(--marker-size, 32px) !important;
  height: var(--marker-size, 32px) !important;
  transition: width 0.1s linear, height 0.1s linear;
  will-change: width, height;
}

/* --- POPUPS & GLOWS --- */
div.leaflet-popup-content-wrapper { background: transparent !important; box-shadow: none !important; padding: 0 !important; }
div.leaflet-popup-tip-container { display: none !important; }
div.leaflet-popup-content { margin: 0 !important; width: 300px !important; }

.selected-marker-glow { filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 3px #fff) !important; z-index: 1001 !important; }
.marker-glow-yellow { filter: drop-shadow(0 0 8px rgba(255, 255, 0, 0.8)) drop-shadow(0 0 3px #ff0) !important; z-index: 1000 !important; }

/* --- FLOOR & CLEAR BUTTONS --- */
.floor-controls {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 20px;
  background: #222;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #333;
}

.floor-btn {
  background: #2a2a2a;
  color: #888;
  border: 1px solid #444;
  padding: 10px 5px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.clear-btn {
  height: 100%;
  padding: 0 12px;
  background: #1a1a1a;
  border: 1px solid #4CAF50;
  color: #4CAF50;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: bold;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.floor-btn:hover, .clear-btn:hover {
  background: rgba(76, 175, 80, 0.2) !important;
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
  border-color: #4CAF50 !important;
  color: #4CAF50 !important;
}

.floor-btn:active, .clear-btn:active {
  background: #1b3d20 !important;
  transform: scale(0.96);
}

.active-floor {
  background: #1b3d20 !important;
  color: #4CAF50 !important;
  border-color: #4CAF50 !important;
}

/* --- SEARCH & INPUTS --- */
.search-box {
  width: 100%;
  padding: 10px;
  background: #222;
  border: 1px solid #444;
  color: #fff;
  box-sizing: border-box;
  border-radius: 4px;
  user-select: text !important;
}

.search-box:hover, .search-box:focus {
  border-color: #FFFFFF !important;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3) !important;
  outline: none;
}

/* --- CHECKBOXES --- */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid #555;
  border-radius: 3px;
  background-color: #1a1a1a;
  cursor: pointer;
}

input[type="checkbox"]:checked {
  background-color: #2ece48;
  border-color: #2ece48;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23121212' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: 12px;
  background-repeat: no-repeat;
  background-position: center;
}

/* --- COUNTER PILLS --- */
.marker-count, .category-count {
  background: #111;
  color: #4CAF50;
  border-radius: 20px;
  font-weight: bold;
  border: 1px solid #333;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-count { font-size: 10px; padding: 2px 8px; margin-left: auto; }
.category-count { font-size: 13px; padding: 4px 10px; margin-left: auto; margin-right: 10px; min-width: 20px; }

/* --- HOVER EFFECTS --- */
.category-header:hover {
  background-color: rgba(76, 175, 80, 0.2) !important;
  border-color: #4CAF50 !important;
}

.category-header:hover .header-style-text,
.category-header:hover .arrow-icon {
  color: #4CAF50 !important;
}

.sub-category-item-wrapper:hover {
  background: rgba(76, 175, 80, 0.1);
  border-radius: 4px;
}

.leaflet-tooltip.custom-marker-tooltip {
  background: #1a1a1a;
  border: 1px solid #4CAF50;
  color: #eee;
  font-size: 12px;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(0,0,0,0.6);
  letter-spacing: 0.5px;
}