* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; font-family: 'Segoe UI', system-ui, sans-serif; }

body { display: flex; background: #1a1a1a; }

/* ── Sidebar ── */
#sidebar {
  width: 320px;
  min-width: 320px;
  height: 100%;
  background: #1e1e1e;
  color: #e0ddd5;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: margin-left 0.25s ease;
  border-right: 1px solid #333;
}

#sidebar.collapsed { margin-left: -320px; }

#sidebar-header {
  padding: 16px;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}

#sidebar-header h1 {
  font-size: 16px;
  font-weight: 700;
  color: #c89b3c;
  letter-spacing: 0.5px;
}

#cycle-info {
  margin-top: 8px;
  font-size: 13px;
  color: #e0ddd5;
}

#cycle-info span {
  display: inline-block;
  background: #2a2520;
  border: 1px solid #c89b3c;
  border-radius: 4px;
  padding: 2px 8px;
  margin-left: 4px;
  font-weight: 600;
  color: #c89b3c;
}

/* ── Controls ── */
#sidebar-controls {
  padding: 12px 16px;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#sidebar-controls select {
  width: 100%;
  padding: 6px 8px;
  background: #2a2a2a;
  color: #e0ddd5;
  border: 1px solid #444;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}

#bulk-actions {
  display: flex;
  gap: 8px;
}

#bulk-actions button {
  flex: 1;
  padding: 6px 0;
  background: #2a2a2a;
  color: #e0ddd5;
  border: 1px solid #444;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

#bulk-actions button:hover { background: #3a3a3a; }


/* ── Extra Layers ── */
#extra-layers {
  padding: 4px 0;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}

/* ── Category List ── */
#category-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.category-group-label {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #999;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}

.category-item:hover { background: #2a2520; }

.category-item.disabled { opacity: 0.35; }

.category-item img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.category-item .cat-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

.category-item .cat-cycle {
  font-size: 11px;
  font-weight: 600;
  background: #2a2520;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 1px 6px;
  color: #c89b3c;
}

.category-item .cat-count {
  font-size: 11px;
  color: #e0ddd5;
}

/* ── Sidebar toggle ── */
#sidebar-toggle {
  position: fixed;
  top: 10px;
  left: 320px;
  z-index: 1001;
  width: 36px;
  height: 36px;
  background: #1e1e1e;
  color: #c89b3c;
  border: 1px solid #444;
  border-left: none;
  border-radius: 0 6px 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: left 0.25s ease;
}

#sidebar-toggle.shifted { left: 0; }

/* ── Map ── */
#map {
  flex: 1;
  height: 100%;
  background: #0a0a0a;
}

/* ── Map Icons ── */
.map-icon { background: none !important; border: none !important; }

.icon-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(0,0,0,0.4);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.icon-circle img {
  display: block;
  filter: brightness(0) invert(1);
}

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
  background: #1e1e1e;
  color: #e0ddd5;
  border-radius: 6px;
  border: 1px solid #444;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.leaflet-popup-tip { background: #1e1e1e; }

.leaflet-popup-content {
  margin: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
}

.popup-title {
  font-weight: 700;
  font-size: 14px;
  color: #c89b3c;
  margin-bottom: 4px;
}

.popup-desc { color: #e0ddd5; }

.popup-tool {
  margin-top: 4px;
  font-size: 12px;
  color: #bbb;
}

.popup-video {
  display: inline-block;
  margin-top: 6px;
  color: #6ba3d6;
  text-decoration: none;
  font-size: 12px;
}

.popup-video:hover { text-decoration: underline; }

/* Leaflet controls */
.leaflet-control-zoom a {
  background: #1e1e1e !important;
  color: #e0ddd5 !important;
  border-color: #444 !important;
}

.leaflet-control-attribution {
  background: rgba(30,30,30,0.8) !important;
  color: #999 !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a { color: #6ba3d6 !important; }

/* Scrollbar */
#category-list::-webkit-scrollbar { width: 6px; }
#category-list::-webkit-scrollbar-track { background: transparent; }
#category-list::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  #sidebar { width: 280px; min-width: 280px; position: fixed; height: 100%; }
  #sidebar.collapsed { margin-left: -280px; }
  #sidebar-toggle { left: 280px; }
  #sidebar-toggle.shifted { left: 0; }
  #map { width: 100%; }
}
