/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #1e293b;
  overflow: hidden;
}

/* ── Map ─────────────────────────────────────────────── */
#map {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* ── Sign Count Badge ────────────────────────────────── */
.sign-count {
  position: fixed;
  top: 12px;
  left: 56px;
  background: #ffffffee;
  backdrop-filter: blur(6px);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  z-index: 1000;
  pointer-events: none;
}

/* ── Detail Panel ────────────────────────────────────── */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100%;
  background: #ffffff;
  box-shadow: -2px 0 12px rgba(0,0,0,.12);
  z-index: 1100;
  overflow-y: auto;
  padding: 24px 22px 32px;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}

.panel.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

.panel-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 6px;
  font-size: 20px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.panel-close:hover { background: #e2e8f0; color: #0f172a; }

.panel-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 18px;
  color: #0f172a;
}

/* Sign image */
.panel-img-wrap {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}
.panel-img-wrap img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

/* Sections */
.panel-section {
  margin-bottom: 16px;
}

.panel-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #94a3b8;
  margin-bottom: 4px;
}

.panel-value {
  font-size: 14px;
  color: #334155;
  line-height: 1.5;
}

.panel-text-value {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #0c4a6e;
}

.panel-vlm-value {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #713f12;
  max-height: 320px;
  overflow-y: auto;
}

.panel-mono {
  font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
  font-size: 12px;
  color: #64748b;
  word-break: break-all;
}

/* Arrow direction styling */
.panel-arrow-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.arrow-icon {
  font-size: 18px;
  color: #2563eb;
}

/* ── Satellite Toggle ────────────────────────────────── */
.satellite-toggle {
  position: fixed;
  bottom: 24px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffffee;
  backdrop-filter: blur(6px);
  padding: 6px 14px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  z-index: 1000;
  user-select: none;
}

.toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 22px;
  transition: background .2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: #2563eb;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ── Leaflet overrides ───────────────────────────────── */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.leaflet-popup-content {
  margin: 10px 14px;
  font-size: 13px;
  line-height: 1.45;
}

/* Cluster icon tweaks */
.marker-cluster-small {
  background-color: rgba(37, 99, 235, .25);
}
.marker-cluster-small div {
  background-color: rgba(37, 99, 235, .7);
  color: #fff;
  font-weight: 600;
}
.marker-cluster-medium {
  background-color: rgba(37, 99, 235, .35);
}
.marker-cluster-medium div {
  background-color: rgba(37, 99, 235, .8);
  color: #fff;
  font-weight: 600;
}
.marker-cluster-large {
  background-color: rgba(37, 99, 235, .45);
}
.marker-cluster-large div {
  background-color: rgba(37, 99, 235, .9);
  color: #fff;
  font-weight: 600;
}

/* ── Responsive: narrow / tablet ─────────────────────── */
@media (max-width: 600px) {
  .panel {
    width: 100%;
    height: 55%;
    top: auto;
    bottom: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,.15);
  }
  .panel.hidden {
    transform: translateY(100%);
  }
  .sign-count {
    top: auto;
    bottom: 12px;
    left: 12px;
  }
}
