/* ================================
   MAP CONTROLS PANEL
   ================================
   Sleek retractable map control panel in top-right corner
   Using existing panel styles for consistency
   ================================ */

@import url("color_palette.css");

/* ================================
   STANDARDIZED MAP BUTTON
   ================================
   Unified button style for all map controls
   ================================ */

button.standard-map-btn {
  display: flex !important;
  align-items: center !important;
  gap: var(--spacing-xs) !important;
  padding: var(--spacing-xs) var(--spacing-sm) !important;
  background: var(--color-primary-dark) !important;
  color: var(--text-on-dark) !important;
  border: 1px solid var(--border-medium) !important;
  border-radius: var(--radius-md) !important;
  cursor: pointer !important;
  font-size: var(--font-size-xs) !important;
  font-weight: var(--font-weight-medium) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  box-shadow: var(--shadow-lg) !important;
  transition: all var(--transition-base) !important;
  white-space: nowrap !important;
  min-height: 35px;
  width: auto !important;
  margin: 0 !important;
}

button.standard-map-btn:hover {
  background: var(--color-primary-lighter) !important;
  transform: translateY(-1px) !important;
  box-shadow: var(--shadow-xl) !important;
}

button.standard-map-btn:active {
  background: var(--color-primary-darker) !important;
  transform: translateY(0) !important;
}

button.standard-map-btn i {
  color: var(--color-accent-orange) !important;
  font-size: var(--font-size-sm) !important;
}

/* ================================
   ACTION CONTROLS (Orange buttons)
   ================================ */

button.action-controls {
  display: flex !important;
  align-items: center !important;
  gap: var(--spacing-sm) !important;
  padding: var(--spacing-sm) var(--spacing-lg) !important;
  background: var(--color-accent-orange) !important;
  color: var(--text-on-dark) !important;
  border: 1px solid var(--color-accent-orange) !important;
  border-radius: var(--radius-md) !important;
  cursor: pointer !important;
  font-size: var(--font-size-xs) !important;
  font-weight: var(--font-weight-medium) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  box-shadow: var(--shadow-lg) !important;
  transition: all var(--transition-base) !important;
  white-space: nowrap !important;
  min-height: 40px;
  width: auto !important;
  margin: 0 !important;
}

button.action-controls:hover {
  background: var(--color-primary-lighter) !important;
  border-color: var(--color-accent-orange) !important;
  transform: translateY(-1px) !important;
  box-shadow: var(--shadow-xl) !important;
}

button.action-controls:active {
  background: var(--color-primary-darker) !important;
  transform: translateY(0) !important;
}

button.action-controls i {
  color: var(--text-on-dark) !important;
  font-size: var(--font-size-sm) !important;
}

/* ================================
   MAP CONTROL PANEL POSITIONING
   ================================ */

#map-controls-panel {
  position: fixed;
  top: calc(var(--menu-bar-height, 50px) + 44px);
  right: 8px;
  z-index: 1000;
  width: 200px;
  max-height: 80vh;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-lg);
  display: block !important; /* Ensure visibility */
  background: var(--bg-primary); /* Ensure background */
  border: none; /* Remove border */
  border-radius: 0;
  overflow-y: auto; /* Enable scrolling */
}

/* Collapsed state - show only header */
#map-controls-panel.collapsed {
  width: auto;
  min-width: 150px;
  overflow: hidden;
}

#map-controls-panel.collapsed .panel-content {
  display: none;
}

#map-controls-panel.collapsed .panel-header {
  border-bottom: none;
  border-radius: 0;
}

/* ================================
   TOGGLE BUTTON (Inside header)
   ================================
   Uses .standard-map-btn class with additional positioning
   ================================ */

.map-controls-toggle {
  margin-left: auto; /* Push to right side */
}

.map-controls-toggle i {
  transition: transform var(--transition-fast);
}

/* Rotate icon when panel is expanded */
#map-controls-panel:not(.collapsed) .map-controls-toggle i {
  transform: rotate(180deg);
}

/* ================================
   PANEL HEADER (Compact with integrated toggle)
   ================================ */

#map-controls-panel .panel-header {
  background: var(--color-primary-dark) !important;
  color: var(--text-on-dark) !important;
  padding: var(--spacing-xs) var(--spacing-sm);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  min-height: 10px;
  border-bottom: 1px solid var(--color-accent-orange);
  border-radius: 0;
  cursor: default;
}

#map-controls-panel .panel-header > i:first-child {
  font-size: var(--font-size-sm);
  color: var(--color-accent-orange);
}

#map-controls-panel .panel-header span {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-grow: 1;
}

.panel-close-btn {
  background: transparent;
  border: none;
  color: var(--text-on-dark);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  opacity: 0.8;
}

.panel-close-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.panel-close-btn i {
  font-size: var(--font-size-sm);
}

/* ================================
   CONTROL SECTIONS
   ================================ */

.map-control-section {
  padding: var(--spacing-xs) var(--spacing-sm);
  border-bottom: 1px solid var(--border-light);
}

.map-control-section:last-child {
  border-bottom: none;
}

.map-control-section h5 {
  margin: 0 0 4px 0;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ================================
   BASE LAYER BUTTONS
   ================================ */

.base-layer-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--font-size-xs);
  color: var(--text-primary);
  height: 28px;
  flex: 1;
  justify-content: center;
}

.base-layer-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--color-accent-orange);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.base-layer-btn.active {
  background: var(--color-primary-dark);
  color: var(--text-on-dark);
  border-color: var(--color-accent-orange);
  border-width: 2px;
}

.base-layer-btn i {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  width: 14px;
}

/* ================================
   MAP OVERLAYS
   ================================ */

.overlay-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--font-size-xs);
  color: var(--text-primary);
  height: 28px;
  flex: 1;
  justify-content: center;
}

.overlay-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--color-accent-orange);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.overlay-btn.active {
  background: var(--color-primary-dark);
  color: var(--text-on-dark);
  border-color: var(--color-accent-orange);
  border-width: 2px;
}

.overlay-btn i {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  width: 14px;
}

.overlay-btn.active i {
  color: var(--text-on-dark);
}

/* Sole occupant of the map controls drawer, so it sits flush at the top */
.custom-tiles-overlay {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.custom-tiles-input-row {
  display: flex;
  gap: 4px;
}

.custom-tiles-input {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  color: var(--text-primary);
  height: 28px;
  transition: all var(--transition-fast);
}

.custom-tiles-input:focus {
  outline: none;
  border-color: var(--color-accent-orange);
  background: var(--bg-primary);
}

.custom-tiles-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--color-primary-dark);
  color: var(--text-on-dark);
  border: 1px solid var(--color-accent-orange);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  height: 28px;
  font-size: var(--font-size-xs);
  white-space: nowrap;
}

.custom-tiles-add-btn:hover {
  background: var(--color-primary-lighter);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.custom-tiles-status {
  display: none;
  padding: 6px 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}

.custom-tiles-status.active {
  display: block;
}

.custom-tiles-status.success {
  border-color: var(--color-green-600);
  color: var(--color-green-600);
}

.custom-tiles-status.error {
  border-color: var(--color-red-600);
  color: var(--color-red-600);
}

.custom-tiles-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.custom-tile-item,
.custom-tile-empty {
  padding: 6px 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.custom-tile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.custom-tile-empty {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  font-style: italic;
}

.custom-tile-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
}

.custom-tile-name {
  font-size: var(--font-size-xs);
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
}

.custom-tile-url {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-tile-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.custom-tile-opacity-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 6px;
  align-items: center;
}

.custom-tile-opacity-label,
.custom-tile-opacity-value {
  font-size: 11px;
  color: var(--text-muted);
}

.custom-tile-opacity-value {
  min-width: 34px;
  text-align: right;
}

.custom-tile-opacity-slider {
  width: 100%;
  margin: 0;
  accent-color: var(--color-accent-orange);
  cursor: pointer;
}

.custom-tile-control-btn {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.custom-tile-control-btn:hover {
  color: var(--text-primary);
  border-color: var(--color-accent-orange);
  background: var(--bg-primary);
}

.custom-tile-control-btn.is-active {
  color: var(--color-accent-orange);
}

/* ================================
   ACTIVE LAYERS LIST
   ================================ */

.active-layers-list {
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.active-layers-list:empty::after {
  content: "No active layers";
  display: block;
  padding: var(--spacing-md);
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: var(--font-size-sm);
}

.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-bottom: 1px solid var(--border-light);
  transition: all var(--transition-fast);
  font-size: var(--font-size-sm);
}

.layer-item:last-child {
  border-bottom: none;
}

.layer-item:hover {
  background: var(--bg-primary);
}

.layer-item-name {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  color: var(--text-primary);
}

.layer-item-name i {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.layer-item-controls {
  display: flex;
  gap: var(--spacing-xs);
}

.layer-toggle-btn,
.layer-remove-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-size: var(--font-size-sm);
}

.layer-toggle-btn {
  color: var(--text-muted);
}

.layer-toggle-btn:hover {
  background: var(--bg-tertiary);
  color: var(--interactive-primary);
}

.layer-toggle-btn.visible {
  color: var(--interactive-primary);
}

.layer-remove-btn {
  color: var(--text-muted);
}

.layer-remove-btn:hover {
  background: var(--crimson-overlay-10);
  color: var(--color-red-600);
}

/* ================================
   QUICK ACTIONS
   ================================ */

.map-quick-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.quick-action-btn {
  flex: 1;
  padding: 4px 6px;
  background: var(--color-primary-dark);
  color: var(--text-on-dark);
  border: 1px solid var(--color-accent-orange);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  height: 26px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.quick-action-btn:hover {
  background: var(--color-primary-lighter);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.quick-action-btn i {
  font-size: var(--font-size-sm);
}

/* ================================
   ZOOM CONTROLS
   ================================ */

.zoom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
}

.zoom-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--font-size-md);
  color: var(--text-primary);
}

.zoom-btn:hover {
  background: var(--color-primary-dark);
  color: var(--text-on-dark);
  border-color: var(--color-accent-orange);
}

.zoom-level {
  min-width: 50px;
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
}

/* ================================
   MINIMAP (Optional)
   ================================ */

.minimap-container {
  height: 120px;
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: var(--bg-secondary);
  margin-top: var(--spacing-sm);
}

.minimap-viewport {
  position: absolute;
  border: 2px solid var(--color-accent-orange);
  background: var(--orange-overlay-20);
  pointer-events: none;
}

/* ================================
   COORDINATE DISPLAY
   ================================ */

.coordinate-display {
  padding: var(--spacing-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--spacing-sm);
}

.coordinate-display span {
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
}

/* ================================
   SCROLLBAR STYLING
   ================================ */

.active-layers-list::-webkit-scrollbar {
  width: 6px;
}

.active-layers-list::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.active-layers-list::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: var(--radius-sm);
}

.active-layers-list::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-600);
}

/* ================================
   MAP LAYER TOGGLES (top right, under the drawer tabs)
   Vertical stack of on/off boxes: base layer (one active) then overlays.
   Sized to match .drawer-tab so the whole right edge reads as one column.
   ================================ */

.map-layer-toggles {
  position: fixed;
  top: calc(var(--menu-bar-height, 50px) + 48px);
  right: 8px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 18px; /* group separation; boxes within a group are tighter */
  transition: right 0.3s ease;
}

.map-toggle-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* No layers yet — collapse so the parent gap doesn't leave a floating void */
.map-toggle-group:empty {
  display: none;
}

/* The layer list is a single anchor box now (the per-layer eyes live in its
   flyout panel), so it never grows — no wrap/max-height management needed. */

/* 32px matches the drawer tabs directly above this stack */
.map-layer-toggles .base-layer-btn,
.map-layer-toggles .overlay-btn,
.map-layer-toggles .layer-eye,
.map-layer-toggles .map-clear-btn,
.map-layer-toggles .map-tiles-btn {
  width: 32px;
  height: 32px;
  flex: none;
  gap: 0;
  padding: 0;
  font-size: var(--font-size-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gd-surface, #131a24);
  border: 1px solid var(--gd-rim, #212d3f);
  border-radius: var(--gd-r, 2px);
  color: var(--gd-text-mid, #8fa3bd);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}

.map-layer-toggles .base-layer-btn i {
  width: auto;
  font-size: 14px; /* matches .drawer-tab i */
  color: inherit;
}

/* Overlay glyphs: square (MGRS), hexagon (H3), blob (heatmap) — outline only,
   inherits button colour so hover/active states carry through */
.toggle-glyph {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.map-layer-toggles .base-layer-btn:hover,
.map-layer-toggles .overlay-btn:hover,
.map-layer-toggles .layer-eye:hover,
.map-layer-toggles .map-tiles-btn:hover {
  background: var(--gd-elevated, #1a2333);
  border-color: var(--gd-rim, #212d3f);
  color: var(--gd-text-hi, #e8edf5);
  transform: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}

/* ---- Active layers: one anchor box; the per-layer eyes live in a flyout
   panel, one row per layer (eye + colour swatch + name + feature count).
   The row toggles visibility, hovering it rings the layer's features on the
   map, the X removes — same behaviours the old per-layer boxes had. ---- */
.map-layer-box {
  position: relative;
  display: flex;
  align-items: center;
}

.map-layer-toggles .layer-eye i {
  font-size: 13px;
  color: inherit;
}

/* Layer count in the anchor's corner — the box reads as "N layers" at rest */
.layers-anchor {
  position: relative;
}

.layers-anchor-count {
  position: absolute;
  bottom: 1px;
  right: 2px;
  font-family: var(--gd-font-mono, "SF Mono", "Menlo", "Consolas", monospace);
  font-size: 8px;
  line-height: 1;
  color: var(--gd-amber, #e07b00);
}

/* Flyout opens leftwards (the stack is pinned to the right edge). Visibility
   is driven by classes on the stable #map-layer-boxes container — hover sets
   .layers-open, clicking the anchor toggles .layers-pinned — so re-renders of
   the children never close it. */
.map-layers-panel {
  display: none;
  position: absolute;
  top: 0;
  right: calc(100% + 8px);
  min-width: 200px;
  max-width: 280px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 3px;
  background: var(--gd-surface, #131a24);
  border: 1px solid var(--gd-rim, #212d3f);
  border-radius: var(--gd-r, 2px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  z-index: 40;
}

#map-layer-boxes.layers-open .map-layers-panel,
#map-layer-boxes.layers-pinned .map-layers-panel {
  display: block;
}

#map-layer-boxes.layers-pinned .layers-anchor {
  color: var(--gd-amber, #e07b00);
  border-color: var(--gd-amber, #e07b00);
}

.map-layers-row {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 7px;
  cursor: pointer;
  color: var(--gd-text-mid, #8fa3bd);
  font-size: var(--font-size-xs);
  white-space: nowrap;
}

.map-layers-row:hover {
  background: var(--gd-elevated, #1a2333);
  color: var(--gd-text-hi, #e8edf5);
}

/* Hidden layer: eye-slash + dimmed row. The swatch keeps its hue — colour is
   how you tell hidden layers apart, only the emphasis drops. */
.map-layers-row.row-off {
  opacity: 0.55;
}

.map-layers-row.row-off:hover {
  opacity: 1;
}

.layers-row-eye {
  width: 14px;
  flex: none;
  font-size: 11px;
  text-align: center;
}

.layers-row-swatch {
  width: 7px;
  height: 7px;
  flex: none;
  background: var(--gd-rim, #212d3f);
}

.layers-row-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layers-row-count {
  flex: none;
  font-family: var(--gd-font-mono, "SF Mono", "Menlo", "Consolas", monospace);
  font-size: 10px;
  color: var(--gd-text-low, #4d6078);
}

.map-layers-row:hover .layers-row-count {
  color: var(--gd-text-mid, #8fa3bd);
}

/* Destructive, so it reads red rather than borrowing the amber accent.
   Surfaces only when its row is in play — keeps the list quiet at rest. */
.layers-row-delete {
  flex: none;
  width: 16px;
  height: 16px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--gd-text-low, #4d6078);
  font-size: 9px;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.15s ease,
    color 0.15s ease;
}

.map-layers-row:hover .layers-row-delete,
.layers-row-delete:focus-visible {
  opacity: 1;
}

.layers-row-delete:hover,
.layers-row-delete:focus-visible {
  color: var(--gd-red, #d94040);
}

/* Clear all — destructive, so it reads red on hover like the per-layer delete */
.map-layer-toggles .map-clear-btn i,
.map-layer-toggles .map-tiles-btn i {
  font-size: 14px;
  color: inherit;
}

/* Tiles drawer opener — amber while its drawer is open, like a pressed tab */
.map-layer-toggles .map-tiles-btn.active {
  background: var(--gd-amber, #e07b00);
  border-color: var(--gd-amber, #e07b00);
  color: #000;
}

.map-layer-toggles .map-clear-btn:hover {
  color: var(--gd-red, #d94040);
  background: var(--gd-red-dim, rgba(217, 64, 64, 0.12));
  border-color: var(--gd-red, #d94040);
}

.map-layer-toggles .base-layer-btn.active,
.map-layer-toggles .overlay-btn.active {
  background: var(--gd-amber, #e07b00);
  border-color: var(--gd-amber, #e07b00);
  border-width: 1px;
  color: #000;
}

.map-layer-toggles .base-layer-btn:focus-visible,
.map-layer-toggles .overlay-btn:focus-visible,
.map-layer-toggles .layer-eye:focus-visible,
.map-layer-toggles .map-clear-btn:focus-visible,
.map-layer-toggles .map-tiles-btn:focus-visible {
  outline: 1px solid var(--gd-amber, #e07b00);
  outline-offset: 1px;
}

/* ================================
   GRID SEARCH SECTION
   ================================ */

.grid-search-result {
  padding: var(--spacing-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: none;
}

.grid-search-result.active {
  display: block;
}

.grid-search-result.success {
  border-color: var(--color-green-600);
  color: var(--color-green-600);
}

.grid-search-result.error {
  border-color: var(--color-red-600);
  color: var(--color-red-600);
}

/* Floating variant — sits above the grid search box in the bottom-right stack */
.floating-quick-controls .grid-search-result {
  max-width: 320px;
  padding: 6px 8px;
  background: var(--gd-surface, #131a24);
  border-color: var(--gd-rim, #212d3f);
  border-radius: var(--gd-r, 2px);
  color: var(--gd-text-mid, #8fa3bd);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}

/* ================================
   MAP STATUS DISPLAY (Always Visible)
   ================================ */

.map-status-display {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  background: var(--bg-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  font-family: monospace;
}

.map-coords {
  display: flex;
  gap: var(--spacing-md);
}

.map-coords span {
  color: var(--color-accent-orange);
  font-weight: var(--font-weight-semibold);
}

.map-zoom-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding-left: var(--spacing-md);
  border-left: 1px solid var(--border-light);
}

.map-zoom-info .zoom-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-primary);
  font-size: var(--font-size-xs);
}

.map-zoom-info .zoom-btn:hover {
  background: var(--color-primary-dark);
  color: var(--text-on-dark);
  border-color: var(--color-accent-orange);
}

.map-zoom-info .zoom-level {
  min-width: 40px;
  text-align: center;
  color: var(--color-accent-orange);
  font-weight: var(--font-weight-semibold);
}

/* ================================
   SHARED ANIMATIONS
   ================================ */

/* Slide animations for panels and menus */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Pulse animations - multiple variants for different uses */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

@keyframes pulseScale {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(2.5);
  }
}

@keyframes pulseShadow {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

@keyframes pulseSubtle {
  0% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.8;
  }
  100% {
    opacity: 0.3;
  }
}

#map-controls-panel {
  animation: slideIn 0.3s ease-out;
}

/* ================================
   MOBILE RESPONSIVENESS
   ================================ */

@media (max-width: 768px) {
  #map-controls-panel {
    width: 180px;
    top: 10px;
    right: 10px;
  }

  #map-controls-panel.collapsed {
    min-width: 120px;
  }

  .map-status-display {
    bottom: 10px;
    right: 10px;
    font-size: var(--font-size-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
  }
}

/* ================================
   MAP CONTROLS — STANDARDISED STRIP ROWS
   ================================
   Renders drawer sub-elements (custom tiles, active layers) as full-width
   strip rows matching the SEARCH PARAMETERS selectable-list-item style.
   Scoped to #map-controls-drawer.
   ================================ */

/* Box spacing matches the SEARCH PARAMETERS left column */
#map-controls-drawer .collapsible-section {
  margin-bottom: 6px !important;
}

/* Shared strip-row box appearance */
#map-controls-drawer .custom-tile-item {
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 5px 8px;
  border: 1px solid var(--gd-rim);
  border-radius: var(--gd-r);
  background: var(--gd-surface);
  color: var(--gd-text-hi);
  font-size: var(--gd-sz-xs);
  box-shadow: none;
  transition:
    background var(--gd-t),
    border-color var(--gd-t);
}

#map-controls-drawer .custom-tile-item:hover {
  background: var(--gd-elevated);
  border-color: var(--gd-stroke);
  transform: none;
  box-shadow: none;
}
