:root {
  --panel-bg: #ffffff;
  --panel-border: #d0d7de;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  --accent: #2563eb;
  --accent-50: rgba(37, 99, 235, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --panel-bg: #2d3748;
    --panel-border: #4a5568;
    color: #f7fafc;
  }

  .sidebar-header {
    background: #1a202c;
  }

  .btn:hover {
    background: var(--accent-50);
    border-color: var(--accent);
  }

  .list-item small {
    color: #a0aec0;
  }

  .tx-marker {
    background: #1a202c;
    color: #f7fafc;
  }
}

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

#map { position: absolute; inset: 0; }

/* Toolbar centered; draggable may set inline top/left later */
.toolbar {
  position: absolute;
  top: 12px;
  left: 50%;
  display: flex;
  gap: 8px;
  z-index: 1100;
  flex-wrap: wrap;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 8px;
  max-width: calc(100% - 24px);
  transform: translateX(-50%);
}
.toolbar .drag-handle {
  cursor: grab;
  padding: 6px 8px;
  font-weight: 700;
  user-select: none;
}

.btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.btn:hover { background: var(--accent-50); border-color: var(--accent); }

.input, .select {
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14px;
}

/* ==== Panels (drag‑freundlich) ====
   - Keine !important
   - Kein 'right' setzen, damit inline left/top vom Drag nicht blockiert wird
   - Starten auf Toolbar-Höhe (12px), Reset-Script setzt exakte Positionen beim Laden
*/
.sidebar,
.sidebar-right {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 340px;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Rechte Panel-Breite etwas größer */
.sidebar-right {
  width: 380px;
  z-index: 1001;
}

.sidebar.hidden { display: none; }
.sidebar-right.hidden { display: none; }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--panel-border);
  background: #f8fafc;
  cursor: grab;
  user-select: none;
}
.sidebar-header h2 { font-size: 16px; margin: 0; flex: 1; }
.sidebar-body { padding: 10px; overflow: auto; }

.search { width: 100%; padding: 10px 12px; border: 1px solid var(--panel-border); border-radius: 10px; margin-bottom: 10px; font-size: 14px; }
.list-item { padding: 10px; border: 1px solid var(--panel-border); border-radius: 10px; margin-bottom: 8px; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.list-item h3 { margin: 0 0 6px; font-size: 14px; }
.list-item small { color: #6b7280; }
.status-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; margin-left: 6px; }
.actions { display: flex; gap: 8px; }
.link { text-decoration: none; font-weight: 600; }

.legend {
  position: absolute;
  bottom: 12px;
  left: 50%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  z-index: 998;
  font-size: 13px;
  transform: translateX(-50%);
}
.legend-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

.contact-info {
  justify-content: center;
  font-size: 11px;
}

.hidden { display: none !important; }

/* Transmitter marker (divIcon) */
.tx-marker {
  background: #ffffff;
  border: 2px solid var(--accent);
  color: #111827;
  padding: 2px 4px;
  font-size: 11px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  transform: translate(-50%, -100%);
  white-space: nowrap;
}
.tx-marker::before {
  content: "📡";
  margin-right: 4px;
}

/* Mobile: beide Panels dürfen Breite flexibel nutzen */
@media (max-width: 900px) {
  .sidebar, .sidebar-right {
    width: auto;
    left: 12px;
    right: 12px;
  }
}


/* --- Initial on-screen placement for HFCC panel without JS ---
   We compute an initial 'left' so it sits 12px from the right edge,
   assuming the default width (380px). Dragging will later set inline left/top.
*/
#cirafPanel {
  width: 380px; /* required for calc */
  left: calc(100vw - 12px - 380px);
  top: 12px;
}
/* Left panel initial spot */
#sidebar {
  left: 12px;
  top: 12px;
}
