/* ═══════════════════════════════════════════
   LAYOUT — flex row: map left, panel right
═══════════════════════════════════════════ */
.map-body-layout {
  display: flex;
  flex-direction: row;
  gap: 14px;
  align-items: flex-start;
  width: 100%;
}

/* ── MAP ── */
.map-wrapper {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
  background: #f5f5f5;
}

#map-svg {
  width: 100%;
  height: 580px;
  display: block;
}

/* ── STATE PATHS ── */
.state-path {
  stroke: #fff;
  stroke-width: 0.7;
  cursor: pointer;
  transition: opacity 0.15s;
}
.state-path:hover {
  stroke: #333;
  stroke-width: 2;
  filter: brightness(1.15);
}
.state-path.selected {
  fill: #FF6B35 !important;
  stroke: #fff;
  stroke-width: 1.5;
}

/* ── ZOOM CONTROLS ── */
.zoom-controls {
  position: absolute;
  bottom: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}
.zc-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: rgba(255,255,255,0.95);
  color: #444;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  box-shadow: 0 1px 5px rgba(0,0,0,0.15);
  transition: background 0.18s, color 0.18s;
}
.zc-btn:hover       { background: #FF6B35; color: #fff; border-color: #FF6B35; }
.zc-btn.reset       { font-size: 14px; color: #FF6B35; }
.zc-btn.reset:hover { color: #fff; }

.map-hint {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-size: 11px;
  color: rgba(0,0,0,0.28);
  pointer-events: none;
}

/* ── LOADER ── */
.loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 14px;
  gap: 12px;
  background: rgba(255,255,255,0.88);
  border-radius: 12px;
  z-index: 5;
}
/* .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #FF6B35;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
} */
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOOLTIP ── */
#tooltip {
  position: fixed;
  background: rgba(0,0,0,0.82);
  color: #fff;
  padding: 5px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  display: none;
  z-index: 99999;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* ═══════════════════════════════════════════
   PANEL — right side, wider for full names
═══════════════════════════════════════════ */
.panel {
  width: 280px;          /* wide enough for long state names */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 580px;
  overflow-y: auto;
}

/* Count badge */
.count-badge {
  background: linear-gradient(135deg, #FF6B35, #ff9a6c);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  color: #fff;
  flex-shrink: 0;
}
.count-badge .number {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}
.count-badge .lbl {
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.88;
  font-weight: 600;
}

/* List box */
.list-box {
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #eee;
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  max-height: 300px;    /* taller so names aren't cut off */
}

.box-lbl {
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 8px;
}

.empty-msg {
  font-size: 12px;
  color: #bbb;
  text-align: center;
  margin-top: 20px;
  line-height: 1.8;
}

/* Tag item */
.tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #ffe0d0;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;        /* readable size */
  font-weight: 500;
  margin-bottom: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  word-break: break-word;
}
.tag span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag .n {
  color: #FF6B35;
  margin-right: 5px;
  font-size: 11px;
  font-weight: 700;
}
.tag .rm {
  background: none;
  border: none;
  color: #ff4444;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  padding: 0 2px 0 8px;
  flex-shrink: 0;
}
.tag .rm:hover { color: #cc0000; }

/* Clear button */
#btn-clear {
  display: none;
  width: 100%;
  background: #fff0ed;
  border: 1px solid #ffb89e;
  color: #FF6B35;
  border-radius: 10px;
  padding: 9px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  transition: background 0.18s, color 0.18s;
  flex-shrink: 0;
}
#btn-clear:hover { background: #FF6B35; color: #fff; }

/* As text box */
.text-box {
  display: none;
  background: #fff8f5;
  border-radius: 10px;
  border: 1px solid #ffd5c0;
  padding: 10px;
  font-size: 12px;
  line-height: 1.7;
  max-height: 100px;
  overflow-y: auto;
  flex-shrink: 0;
}
.text-box .box-lbl { margin-bottom: 4px; }
#sel-text {
  color: #e85d04;
  font-weight: 600;
  word-break: break-word;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 900px) {
  .map-body-layout  { flex-direction: column; }
  .panel            { width: 100%; max-height: none; }
  #map-svg          { height: 360px; }
}


.map-container {
    width: 100%;
    height: 100%;
    background: #ffffff;
    position: relative;
  }
 
  #target-map {
    height: 100%;
    position: relative;
  }
 
  /* Spinner animation keyframes */
  @keyframes spinner {
    to {
      transform: rotate(360deg);
    }
  }
 
  /* Spinner overlay - applied to .map-container via JS */
  .spinner::after {
    content: "";
    box-sizing: border-box;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    margin-left: -20px;
    border-radius: 50%;
    border: 5px solid rgba(180, 180, 180, 0.6);
    border-top-color: rgba(0, 0, 0, 0.6);
    animation: spinner 0.6s linear infinite;
    z-index: 9999;
    pointer-events: none;
  }
 
  /* Optional: Dim the map while loading */
  .spinner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.3);
    z-index: 9998;
    pointer-events: none;
  }