/* ─── Compare Districts ─────────────────────────────────────────────── */

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  align-items: start;
}

/* ─── Column cards ─────────────────────────────────────────────────── */

.compare-col {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
  min-width: 0;
}

.compare-col-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

/* ─── Drag handle ─────────────────────────────────────────────────── */

.compare-drag-handle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.5rem;
  cursor: grab;
  color: #d1d5db;
  border-radius: 0.25rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.compare-drag-handle:hover {
  color: #6b7280;
  background: #f3f4f6;
}

.compare-drag-handle:active {
  cursor: grabbing;
}

.compare-drag-handle svg {
  width: 0.75rem;
  height: 0.75rem;
}

.compare-col--dragging {
  opacity: 0.4;
}

.compare-col--drag-over {
  outline: 2px dashed #c0793a;
  outline-offset: -2px;
  border-color: transparent;
}

.compare-select {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 2rem 0.5rem 0.65rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e3329;
  background: #faf6f0;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.compare-select:hover {
  border-color: #9ca3af;
  background-color: #fff;
}

.compare-select:focus {
  outline: 2px solid #008080;
  outline-offset: 1px;
}

/* ─── Column body (sections) ───────────────────────────────────────── */

.compare-col-body {
  padding: 0.75rem 1rem 1rem;
}

.compare-section {
  margin-bottom: 1rem;
}

.compare-section:last-child {
  margin-bottom: 0;
}

.compare-section-title {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin: 0 0 0.35rem;
}

/* ─── Mini map ─────────────────────────────────────────────────────── */

.compare-map {
  width: 100%;
  height: 140px;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f3f4f6;
}

/* ─── Clickable map link ──────────────────────────────────────────── */

.compare-map-link {
  display: block;
  text-decoration: none;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.compare-map-link:hover {
  box-shadow: 0 2px 8px rgba(0, 128, 128, 0.15);
}

/* ─── Metric rows ──────────────────────────────────────────────────── */

.compare-metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.3rem 0;
}

.compare-metric-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.compare-metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e3329;
  font-variant-numeric: tabular-nums;
}

.compare-metric-value--muted {
  color: #9ca3af;
  font-weight: 500;
  font-style: italic;
  font-size: 0.8rem;
}

/* ─── Highlight (best value across columns) ────────────────────────── */

.compare-best {
  background: rgba(192, 121, 58, 0.08);
  border-radius: 0.25rem;
  margin: 0 -0.35rem;
  padding: 0.3rem 0.35rem;
}

.compare-best .compare-metric-value {
  color: #c0793a;
}

/* ─── Chart containers ─────────────────────────────────────────────── */

.compare-chart {
  position: relative;
  height: 160px;
}

.compare-chart--tall {
  height: 200px;
}

/* ─── Empty state ──────────────────────────────────────────────────── */

.compare-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  color: #9ca3af;
  text-align: center;
  min-height: 180px;
}

.compare-empty-icon {
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}

.compare-empty-text {
  font-size: 0.8rem;
  margin: 0;
}

/* ─── Price trend line chart ───────────────────────────────────────── */

.compare-trend-chart {
  position: relative;
  height: 180px;
}

/* ─── Responsive: tablet ───────────────────────────────────────────── */

@media (min-width: 768px) and (max-width: 1023px) {
  .compare-grid {
    gap: 0.75rem;
  }

  .compare-chart {
    height: 130px;
  }

  .compare-chart--tall {
    height: 160px;
  }

  .compare-trend-chart {
    height: 150px;
  }

  .compare-map {
    height: 120px;
  }
}

/* ─── Responsive: mobile ───────────────────────────────────────────── */

@media (max-width: 767px) {
  .compare-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
  }

  .compare-col {
    min-width: 280px;
    flex: 0 0 85%;
    scroll-snap-align: start;
  }

  .compare-drag-handle {
    display: none;
  }

  .compare-chart {
    height: 140px;
  }

  .compare-trend-chart {
    height: 150px;
  }

  .compare-map {
    height: 120px;
  }

  /* Gradient hint to indicate scrollable content */
  .compare-scroll-wrapper {
    position: relative;
  }

  .compare-scroll-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 2rem;
    background: linear-gradient(to right, transparent, #faf6f0);
    pointer-events: none;
    z-index: 1;
    border-radius: 0 0.75rem 0.75rem 0;
  }
}
