/* ==========================================================================
   Canadian Postal Code Radius Search - Tool-Specific Styles
   Layout adapted from /tools/postcode-radius/postcode-radius.css (AU);
   the amber "flagged" language (rural / near-boundary) matches
   /tools/ca-postcode-mapper/ca-postcode-mapper.css's degraded-result
   colour (#d97706) so the two CA tools read as one visual system.
   ========================================================================== */

.dev-banner {
  display: none;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #d97706;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

html[data-theme='dark'] .dev-banner {
  background: rgba(217, 119, 6, 0.15);
  color: #fbbf24;
}

.sidebar-content label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
  margin-top: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

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

.tool-section h3 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-section {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--card) 100%);
  margin: -20px -20px 0 -20px;
  padding: 20px;
  border-radius: 12px 12px 0 0;
}

.range-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-container input[type='range'] {
  flex: 1;
}

.range-value {
  min-width: 60px;
  text-align: center;
  font-weight: 600;
  color: var(--primary);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.unit-toggle {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.unit-toggle button {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  border-radius: var(--radius);
  cursor: pointer;
}

.unit-toggle button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.origin-box {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}

.origin-postcode {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  word-break: break-word;
}

.origin-coords {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.origin-caveat {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #92400e;
  line-height: 1.4;
  text-align: left;
}

html[data-theme='dark'] .origin-caveat {
  color: #fbbf24;
}

.results-badge {
  background: var(--primary);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-left: auto;
}

.truncation-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 10px;
  display: none;
}

.honesty-summary {
  font-size: 0.8rem;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #d97706;
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 10px;
}

.honesty-summary p {
  margin: 0;
}

html[data-theme='dark'] .honesty-summary {
  background: rgba(217, 119, 6, 0.15);
  color: #fbbf24;
}

.empty-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  line-height: 1.5;
}

.results-list {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.result-item:hover {
  background: var(--hover-bg);
  border-color: var(--primary);
}

.result-item.active {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--primary);
}

.result-item.is-rural,
.result-item.is-uncertain,
.result-item.is-scattered {
  border-left: 3px solid #d97706;
}

.result-info {
  flex: 1;
  min-width: 0;
}

.result-postcode-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.result-postcode {
  font-weight: 600;
  color: var(--text);
  font-size: 0.92rem;
}

.flag-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #d97706;
  cursor: help;
}

html[data-theme='dark'] .flag-tag {
  background: rgba(217, 119, 6, 0.2);
  color: #fbbf24;
}

.result-distance {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.result-note {
  font-size: 0.75rem;
  color: #92400e;
  margin-top: 4px;
  line-height: 1.4;
}

html[data-theme='dark'] .result-note {
  color: #fbbf24;
}

.result-arrow {
  color: var(--text-muted);
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.result-item:hover .result-arrow {
  opacity: 1;
}

.popup-caveat {
  color: #d97706;
  font-size: 0.8rem;
}

.tool-info {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border);
}

.tool-item {
  font-size: 13px;
  color: var(--text);
  padding: 6px 0;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.load-progress {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.button-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.button-row .btn {
  flex: 1;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.tool-distinction {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.tool-distinction a {
  color: var(--primary);
}

@media (max-width: 900px) {
  .result-postcode {
    font-size: 0.88rem;
  }
}

@media (max-width: 600px) {
  .input-section {
    margin: -16px -16px 0 -16px;
    padding: 16px;
  }

  .button-row {
    flex-direction: column;
  }
}

/* Map legend: same visual language as the postal code mapper's own
   legend (.ca-map-legend, .ca-legend-row) - a small, permanent key,
   not a tooltip someone has to discover. */
.ca-map-legend {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  max-width: 240px;
}

.ca-legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 3px 0;
}

.ca-legend-dot {
  flex-shrink: 0;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-sizing: border-box;
}

.ca-legend-dot-normal {
  background: #06b6d4;
  border: 2px solid #0e7490;
}

.ca-legend-dot-flagged {
  background: #d97706;
  border: 2px solid #b45309;
}

