body, html {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    display: flex;
    height: 100vh;
}

#app {
    display: flex;
    flex-direction: column; /* Default to column layout */
    width: 100%;
    height: 100%;
}

#map {
    cursor: crosshair;
}

.sidebar {
  background: #f4f4f4;
  border-right: 1px solid #ddd;
  box-shadow: 2px 0 5px rgba(0,0,0,0.1);
  width: 300px;
  max-width: 300px;
  height: 100vh;
  padding: 15px;
  overflow-y: auto;
}

.sidebar .sidebar-section {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.sidebar .sidebar-section:first-of-type {
  margin-top: 0;
}

.sidebar .sidebar-heading {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #555;
  margin-bottom: 0.5rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid #ddd;
}

.sidebar .sidebar-block {
  background: rgba(255,255,255,0.7);
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.sidebar .sidebar-block .mb-3:last-child,
.sidebar .sidebar-block .form-text:last-of-type {
  margin-bottom: 0;
}

.sidebar .cursor-readout-box {
  background: rgba(255,255,255,0.9);
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.sidebar .cursor-readout-box .form-text {
  margin-bottom: 0.15rem;
}

.sidebar .cursor-readout-box .form-text:last-child {
  margin-bottom: 0;
}

.legend-container {
  margin-top: 10px;
}
#legend-floating {
  position: fixed;
  bottom: 16px;
  left: 16px;
  background: rgba(255,255,255,0.85);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 50;
  font-size: 14px;
  min-width: 140px;
  pointer-events: none;
  display: none;
}

@media (min-width: 768px) {
  #app { flex-direction: row; }
  #legend-floating { display: none !important; }
  #legend-sidebar { display: block; }
  .col-md-10,
  .map-area { flex-grow: 1; width: calc(100vw - 300px); height: 100vh; }
  #map { height: 100vh; width: 100%; }
}

@media (max-width: 767px) {
  .sidebar { display: none; }
  .col-md-10,
  .map-area { flex-grow: 1; width: 100vw; height: 100vh; }
  #map { height: 100vh; width: 100vw; }
  body, html { overflow-x: hidden; }
  #legend-sidebar { display: none; }
  #legend-floating { display: block; }
}


#map {
    flex-grow: 1;
    height: 100vh;
}

.form-group {
    margin-bottom: 15px;
}

.legend-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-color.red {
    background-color: red;
}

.legend-color.yellow {
    background-color: yellow;
}

.pac-container { z-index: 99999 !important; }

/* Mobile hamburger button */
.mobile-menu-btn {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1300;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  padding: 0;
}
.mobile-menu-btn .hamburger { display: inline-block; width: 24px; height: 18px; position: relative; }
.mobile-menu-btn .hamburger span { position: absolute; left:0; width:100%; height:3px; background:#fff; border-radius:2px; transition:.3s; }
.mobile-menu-btn .hamburger span:nth-child(1){ top:0; }
.mobile-menu-btn .hamburger span:nth-child(2){ top:7.5px; }
.mobile-menu-btn .hamburger span:nth-child(3){ top:15px; }

/* Offcanvas tweaks */
.offcanvas.offcanvas-bottom { height: 40vh; border-top-left-radius: 16px; border-top-right-radius: 16px; }
.offcanvas-body { overflow-y: auto; }

/* ============================================================
   Sidebar enhancements (betatron page).
   Class names below are unique to betatron's enhanced sidebar so they
   don't need an ancestor scope — important because controls-content
   travels into the offcanvas on mobile and would otherwise lose its
   styling there.
   ============================================================ */
.sidebar-enhanced {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-enhanced .sidebar-title {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0;
  padding: 12px 15px 10px;
  background: #f4f4f4;
  border-bottom: 1px solid #ddd;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
}

.sidebar-enhanced #controls-content {
  padding: 12px 15px 0;
  flex: 1 1 auto;
}

.sidebar-cursor-section {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.sidebar-cursor-section .cursor-readout-box {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0;
  font-size: 0.9rem;
}

.sidebar-cursor-section .cursor-readout-box .form-text { margin-bottom: 0.15rem; }
.sidebar-cursor-section .cursor-readout-box .form-text:last-child { margin-bottom: 0; }

/* Collapsible sections */
.sidebar-details {
  margin-bottom: 0.6rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

.sidebar-details > summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #555;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.sidebar-details > summary::-webkit-details-marker { display: none; }

.sidebar-details > summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid #888;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.sidebar-details[open] > summary::before {
  transform: rotate(90deg);
}

.sidebar-details > summary:hover {
  background: rgba(0, 0, 0, 0.03);
}

.sidebar-details > summary:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: -2px;
}

.sidebar-details[open] > summary {
  border-bottom: 1px solid #e8e8e8;
}

.sidebar-details-body {
  padding: 12px;
}

/* Tighten the inner block since the details body provides its own padding/border */
.sidebar-details-body .sidebar-block {
  background: transparent;
  border: 0;
  padding: 0;
  margin-bottom: 0;
}

.sidebar-details-body .mb-3:last-child,
.sidebar-details-body > .form-text:last-of-type {
  margin-bottom: 0;
}

/* Sticky footer for primary action */
.sidebar-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 0.5rem -15px 0;
  padding: 10px 15px;
  background: #f4f4f4;
  border-top: 1px solid #ddd;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.04);
}

/* Inside the offcanvas the bottom-sticky footer matches the white panel */
.offcanvas-body .sidebar-footer {
  background: #fff;
  margin-left: -16px;
  margin-right: -16px;
  padding-left: 16px;
  padding-right: 16px;
}

/* Place-marker armed badge */
.place-marker-armed-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #c0392b;
  letter-spacing: 0.04em;
}

.place-marker-armed-badge[hidden] { display: none; }

.place-marker-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e74c3c;
  box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.55);
  animation: place-marker-pulse 1.4s ease-out infinite;
}

@keyframes place-marker-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .place-marker-dot { animation: none; }
}

/* Map cursor signals armed state (overrides default crosshair on #map) */
body.place-marker-armed #map { cursor: copy; }

