/* ──────────────────────────────────────────────────────────────────
   THAMAN — Main Stylesheet
   ────────────────────────────────────────────────────────────────── */

/* ── CSS Variables ────────────────────────────────────────────────── */
:root {
  --blue:        #2563eb;
  --blue-light:  #dbeafe;
  --blue-dark:   #1d4ed8;
  --green:       #059669;
  --green-light: #d1fae5;
  --red:         #dc2626;
  --red-light:   #fee2e2;
  --purple:      #7c3aed;
  --purple-light:#ede9fe;
  --orange:      #d97706;
  --gray-50:     #f8fafc;
  --gray-100:    #f1f5f9;
  --gray-200:    #e2e8f0;
  --gray-300:    #cbd5e1;
  --gray-400:    #94a3b8;
  --gray-500:    #64748b;
  --gray-600:    #475569;
  --gray-700:    #334155;
  --gray-900:    #0f172a;
  --dark-nav:    #1e293b;
  --white:       #ffffff;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:   0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.08);
  --radius:      10px;
  --radius-sm:   6px;
  --radius-lg:   14px;
  --indigo:      #6366f1;
  --indigo-light:#eef2ff;
  --shadow-card: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lift: 0 8px 24px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.05);
  --sidebar-w:   460px;
  --header-h:    54px;
  --font:        'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-ar:     'Tajawal', 'Cairo', 'Segoe UI', system-ui, sans-serif;
  --font-mono:   'SFMono-Regular', Consolas, monospace;
  --text:        var(--gray-900);
  --bg:          var(--white);
  --accent:      var(--blue);
  --accent-dark: var(--blue-dark);
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-900);
  background: var(--gray-100);
  overflow: hidden;
  font-feature-settings: "cv02","cv03","cv04","cv11";
}

/* ── Header ────────────────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: linear-gradient(135deg, #0f1629 0%, #1a2540 60%, #0f1e38 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 1100;
  box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 4px 16px rgba(0,0,0,.4);
  backdrop-filter: blur(12px);
}
.header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, #3b82f6 0%, #6366f1 40%, #8b5cf6 70%, #3b82f6 100%);
  background-size: 200% 100%;
  animation: hdr-shimmer 4s linear infinite;
}
@keyframes hdr-shimmer {
  0%   { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -.4px;
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 60%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sep {
  width: 1px; height: 18px;
  background: rgba(255,255,255,.12);
  flex-shrink: 0;
}

.tagline {
  font-size: .76rem;
  color: #64748b;
  font-weight: 500;
  letter-spacing: .2px;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 7px;
}

.badge {
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: .2px;
}
.badge-green  { background: var(--green-light);  color: var(--green);  }
.badge-blue   { background: var(--blue-light);   color: var(--blue);   }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-gray   { background: #334155; color: #94a3b8; }
.badge-gray:hover { background: #475569; color: var(--white); }

/* ── Layout ─────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  height: 100vh;
  padding-top: var(--header-h);
}

/* ── Map ────────────────────────────────────────────────────────────── */
.map-section {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ── Layer toggle bar ───────────────────────────────────────────────── */
/* ── City mode toggle ───────────────────────────────────────────────── */
.city-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1001;
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px);
  border-radius: 20px;
  padding: 4px 6px;
  box-shadow: var(--shadow-md);
}
.city-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--gray-600);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.city-btn:hover  { background: var(--gray-100); }
.city-btn.active { background: var(--blue); color: var(--white); }

.layer-bar {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: none; /* shown by JS once NTA GeoJSON loads */
  gap: 6px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px);
  border-radius: 24px;
  padding: 5px 10px;
  box-shadow: var(--shadow-md);
  overflow-x: auto;
  max-width: calc(100% - 24px);
  scrollbar-width: none;
}
.layer-bar::-webkit-scrollbar { display: none; }

.layer-btn {
  border: none;
  background: transparent;
  padding: 4px 11px;
  border-radius: 16px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.layer-btn:hover  { background: var(--gray-100); }
.layer-btn.active { background: var(--blue); color: var(--white); }

/* ── Choropleth legend ──────────────────────────────────────────────── */
.layer-legend {
  position: absolute;
  bottom: 60px;
  left: 12px;
  z-index: 1000;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(4px);
  border-radius: 8px;
  padding: 7px 10px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .68rem;
  color: var(--gray-700);
}
.legend-gradient {
  width: 80px;
  height: 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.legend-label {
  font-weight: 600;
  color: var(--gray-500);
  margin-left: 2px;
}

#map {
  width: 100%;
  height: 100%;
}

.map-hint {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, .82);
  color: var(--white);
  padding: 8px 18px;
  border-radius: 24px;
  font-size: .82rem;
  font-weight: 500;
  pointer-events: none;
  backdrop-filter: blur(4px);
  transition: opacity .4s;
  white-space: nowrap;
  z-index: 900;
}
.map-hint.hidden { opacity: 0; }

/* ── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100%;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: linear-gradient(180deg, #f0f5ff 0%, #f8fafc 40%);
  border-left: 1px solid #dde4f0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Sidebar hero strip ──────────────────────────────────────────────── */
.sidebar-hero {
  background: linear-gradient(135deg, #0f1629 0%, #1e2d4d 100%);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(99,102,241,.2);
  box-shadow: 0 4px 20px rgba(15,22,41,.25);
}
.sidebar-hero-name {
  font-size: 1rem;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.3px;
}
.sidebar-hero-sub {
  font-size: .7rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 2px;
}
.sidebar-hero-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.hero-badge {
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.hero-badge-blue { background: rgba(59,130,246,.15); color: #60a5fa; border: 1px solid rgba(59,130,246,.2); }
.hero-badge-green { background: rgba(52,211,153,.12); color: #34d399; border: 1px solid rgba(52,211,153,.2); }

/* thin scrollbar */
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  border: 1px solid #e2e8f0;
  transition: box-shadow .2s;
}
.card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,.09), 0 2px 6px rgba(0,0,0,.05);
}
#formCard:hover { box-shadow: 0 1px 4px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04); }

/* accent top border on key cards */
.card-result { border-top: 3px solid var(--blue); }
.card-shap   { border-top: 3px solid var(--indigo); }
.card-market { border-top: 3px solid var(--green); }

/* ── Smooth card reveal (JS-driven: showCard / hideCard) ─────────────── */
.card-animated {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  will-change: opacity, transform;
}
.card-animated.card-in {
  opacity: 1;
  transform: translateY(0);
}

/* Riyadh price hero number — smooth SAR animation */
#riyadhPriceSqm, #riyadhPriceTotal {
  will-change: contents;
}

.card-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.card-subtitle {
  font-size: .72rem;
  font-weight: 400;
  color: var(--gray-500);
}

/* ── How-to card ────────────────────────────────────────────────────── */
.card-howto {
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  border-color: #c7d2fe;
  border-top: 3px solid var(--blue);
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  position: relative;
}
.steps::before {
  content: '';
  position: absolute;
  top: 13px; left: calc(100%/6); right: calc(100%/6);
  height: 2px;
  background: var(--blue-light);
  z-index: 0;
}

.steps li {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  font-size: .78rem;
  color: var(--gray-700);
  position: relative;
  z-index: 1;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  font-size: .7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px var(--blue-light);
}

/* ── Location display ────────────────────────────────────────────────── */
.location-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  padding: 7px 10px;
  margin-bottom: 12px;
}

.location-icon { font-size: 1rem; }
.location-text {
  font-size: .8rem;
  color: var(--gray-500);
  font-family: monospace;
}
.location-text.selected { color: var(--blue); font-weight: 600; }

/* ── Form fields ─────────────────────────────────────────────────────── */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: .4px;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: 7px;
  font-size: .84rem;
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--blue);
  border-left-width: 3px;
  padding-left: 9px;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

input.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220,38,38,.10);
}

input::placeholder { color: var(--gray-300); }

select option { color: var(--gray-900); }
select optgroup { color: var(--gray-500); font-style: normal; }

/* ── Advanced panel ──────────────────────────────────────────────────── */
.advanced-toggle {
  background: none;
  border: none;
  color: var(--blue);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
  transition: color .15s;
}
.advanced-toggle:hover { color: var(--blue-dark); }

#advancedArrow { transition: transform .2s; font-size: .65rem; }
#advancedArrow.open { transform: rotate(90deg); }

.advanced-panel {
  display: none;
  animation: slideDown .2s ease;
}
.advanced-panel.open { display: block; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Predict button ──────────────────────────────────────────────────── */
.btn-predict {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 60%, #7c3aed 100%);
  background-size: 200% 100%;
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: background-position .4s ease, box-shadow .2s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: .3px;
  position: relative;
  overflow: hidden;
}
.btn-predict::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.15), transparent);
  transition: left .5s ease;
}
.btn-predict:hover:not(:disabled)::before { left: 150%; }

.btn-predict:hover:not(:disabled) {
  background-position: 100% 0;
  box-shadow: 0 8px 24px rgba(79,70,229,.45);
  transform: translateY(-1px);
}

.btn-predict:active:not(:disabled) { transform: translateY(0); box-shadow: none; }

.btn-predict:disabled {
  background: var(--gray-300);
  color: var(--gray-500);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn-predict:disabled::before { display: none; }

.spinner {
  display: inline-block;
  animation: spin .8s linear infinite;
  font-size: 1rem;
}

/* ── Loading spinner ─────────────────────────────────────────── */
.btn-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.disclaimer {
  font-size: .72rem;
  color: var(--gray-500);
  text-align: center;
  margin-top: 8px;
  line-height: 1.5;
}

/* ── Result Card ─────────────────────────────────────────────────────── */
.card-result {
  border-color: var(--blue-light);
  background: linear-gradient(145deg, #eff6ff, #ffffff);
  animation: fadeUp .35s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.price-block {
  text-align: center;
  padding: 6px 0 14px;
}

.price-label-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}
.price-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-400);
}
.model-tag {
  font-size: .6rem;
  color: var(--indigo);
  font-weight: 600;
}
.price-main {
  font-size: 2.7rem;
  font-weight: 800;
  background: linear-gradient(135deg, #1d4ed8 0%, #4f46e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -2px;
  line-height: 1.1;
  font-feature-settings: "tnum";
}

.price-range {
  font-size: .82rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.price-context {
  display: inline-block;
  background: var(--blue-light);
  color: var(--blue-dark);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  margin-top: 8px;
}

/* ── Confidence bar ──────────────────────────────────────────────────── */
.confidence-bar-wrap { margin-top: 10px; }

.conf-label {
  display: flex;
  justify-content: space-between;
  font-size: .72rem;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.conf-mid-label {
  color: var(--blue);
  font-weight: 600;
}

.confidence-bar {
  position: relative;
  height: 10px;
  background: var(--gray-200);
  border-radius: 5px;
  overflow: visible;
}

.conf-range-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--blue) 0%, var(--indigo) 100%);
  border-radius: 5px;
  opacity: .55;
}

.conf-marker {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  background: var(--blue);
  border: 2px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--blue);
  transform: translateX(-50%);
}

/* ── SHAP Drivers ────────────────────────────────────────────────────── */
.card-shap { animation: fadeUp .35s ease .1s both; }

.shap-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 6px;
  border-bottom: 1px solid var(--gray-100);
  border-radius: 6px;
}
.shap-label-wrap {
  flex: 0 0 160px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.shap-row:last-child { border-bottom: none; }
.shap-row:hover { background: var(--gray-50); }

.shap-arrow {
  font-size: 1rem;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.shap-label {
  font-size: .78rem;
  color: var(--gray-700);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shap-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.shap-bar-fill {
  height: 100%;
  border-radius: 0 4px 4px 0;
  transition: width .5s ease;
}

.shap-bar-fill.positive { background: linear-gradient(90deg, #6ee7b7, #059669); }
.shap-bar-fill.negative { background: linear-gradient(90deg, #fda4af, #dc2626); }

.shap-impact {
  flex: 0 0 46px;
  font-size: .76rem;
  font-weight: 700;
  text-align: right;
  font-feature-settings: "tnum";
}
.shap-impact.positive { color: var(--green); }
.shap-impact.negative { color: var(--red); }

/* ── Spatial Features Grid ───────────────────────────────────────────── */
.card-spatial { animation: fadeUp .35s ease .2s both; }

.spatial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.spatial-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 7px 8px;
}

.spatial-item-icon {
  font-size: .9rem;
  margin-bottom: 2px;
}

.spatial-item-label {
  font-size: .68rem;
  color: var(--gray-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.spatial-item-value {
  font-size: .84rem;
  font-weight: 700;
  color: var(--gray-900);
  font-feature-settings: "tnum";
}
.spatial-item-value[data-bar]::after {
  content: '';
  display: block;
  height: 2px;
  background: var(--red);
  border-radius: 1px;
  width: var(--bar, 0%);
  margin-top: 3px;
  transition: width .6s ease;
}

.spatial-item-unit {
  font-size: .72rem;
  color: var(--gray-500);
  font-weight: 400;
}

/* ── Map popup custom ─────────────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  font-family: var(--font);
  padding: 0;
}
.leaflet-popup-content {
  margin: 12px 14px;
  font-size: .82rem;
}
.leaflet-popup-tip { background: white; }

.map-popup {
  font-family: var(--font);
  font-size: .82rem;
  color: var(--gray-900);
  text-align: center;
  padding: 2px 4px;
  min-width: 140px;
}

.map-popup strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 3px;
  color: var(--gray-900);
  font-weight: 700;
}

/* ── Leaflet marker pin ──────────────────────────────────────────────── */
.pin-icon {
  font-size: 28px;
  line-height: 1;
  text-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* ── Borough map labels ──────────────────────────────────────────────── */
.borough-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  color: rgba(15,23,42,.45);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  font-family: var(--font);
  text-shadow: 0 0 4px #fff, 0 0 4px #fff, 0 0 4px #fff;
}

/* ── Out-of-bounds popup ─────────────────────────────────────────────── */
.oob-popup .leaflet-popup-content-wrapper {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  padding: 0;
}
.oob-popup .leaflet-popup-content {
  margin: 8px 14px;
  font-size: .82rem;
  font-weight: 600;
  color: #dc2626;
  white-space: nowrap;
}
.oob-popup .leaflet-popup-tip-container { display: none; }

/* ── Borough color pills ─────────────────────────────────────────────── */
.borough-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: .72rem;
  font-weight: 600;
}

/* ── Building class searchable dropdown ─────────────────────────────── */
.bldg-search-wrap {
  position: relative;
  padding-top: 6px;
}

.bldg-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1.5px solid var(--blue);
  border-radius: 7px;
  box-shadow: var(--shadow-md);
  z-index: 500;
  max-height: 220px;
  overflow-y: auto;
}

.bldg-dropdown::-webkit-scrollbar { width: 4px; }
.bldg-dropdown::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid var(--gray-100);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--blue-light); }

.dd-code {
  flex-shrink: 0;
  font-weight: 700;
  font-size: .78rem;
  color: var(--blue-dark);
  min-width: 28px;
}

.dd-desc {
  font-size: .78rem;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── ACRIS link ──────────────────────────────────────────────────────── */
.acris-link {
  display: inline;
  margin-left: 6px;
  font-size: .68rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  letter-spacing: .2px;
}
.acris-link:hover { text-decoration: underline; }

/* ── Price tier badge ────────────────────────────────────────────────── */
.price-row-context {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.price-row-context .price-context { margin-top: 0; }

.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .3px;
}
.tier-entry  { background: #d1fae5; color: #065f46; }
.tier-mid    { background: var(--blue-light); color: var(--blue-dark); }
.tier-upper  { background: var(--purple-light); color: var(--purple); }
.tier-luxury { background: #fef3c7; color: #92400e; }
.tier-ultra  { background: #fee2e2; color: #991b1b; }

/* ── AVM Confidence Grade Badge ─────────────────────────────────────── */
.conf-grade-badge {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; flex-shrink: 0;
}
.conf-grade-A { background: #d1fae5; color: #065f46; }
.conf-grade-B { background: #fef9c3; color: #713f12; }
.conf-grade-C { background: #ffedd5; color: #9a3412; }
.conf-grade-D { background: #fee2e2; color: #991b1b; }

/* ── AVM QC Row ──────────────────────────────────────────────────────── */
.avm-qc-row {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  padding: 8px 12px; background: var(--gray-50);
  border-radius: var(--radius-sm); border: 1px solid var(--gray-200);
  font-size: .78rem; color: var(--gray-700);
}
.avm-qc-grade-wrap { display: flex; align-items: center; gap: 6px; }
.avm-qc-meta  { flex: 1; line-height: 1.4; }
.avm-qc-comps { font-weight: 600; color: var(--gray-900); }
.avm-qc-flag  {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 10px; font-size: .7rem; font-weight: 600;
  margin-top: 4px; margin-right: 4px;
}
.avm-flag-sparse  { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.avm-flag-luxury  { background: #ede9fe; color: #4c1d95; border: 1px solid #c4b5fd; }
.avm-flag-highunc { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.avm-flag-metro   { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }

/* ── Skeleton loading ───────────────────────────────────────────────── */
.skel {
  background: linear-gradient(90deg, #f1f5f9 0%, #e8edf5 20%, #d5dfe8 50%, #e8edf5 80%, #f1f5f9 100%);
  background-size: 300% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.skel-title  { height: 13px; width: 45%; margin-bottom: 14px; }
.skel-price  { height: 44px; width: 55%; margin: 8px auto 6px; }
.skel-line   { height: 11px; width: 100%; margin: 7px 0; }
.skel-line.medium { width: 68%; }
.skel-line.narrow { width: 38%; }
.skel-bar    { height: 18px; border-radius: 4px; margin: 8px 0; }
.skel-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.skel-block  { height: 64px; border-radius: 8px; }

/* ── Language toggle ────────────────────────────────────────────────── */
.lang-toggle {
  display: flex;
  align-items: center;
  background: #334155;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid #475569;
}
.lang-btn {
  padding: 3px 10px;
  font-size: .72rem;
  font-weight: 600;
  color: #94a3b8;
  background: none;
  border: none;
  cursor: pointer;
  transition: background .15s, color .15s;
  letter-spacing: .3px;
}
.lang-btn.active { background: var(--blue); color: var(--white); border-radius: 20px; }

/* ── Market Intelligence card ───────────────────────────────────────── */
.card-market { animation: fadeUp .35s ease .3s both; }

.market-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 12px;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 3px;
}
.market-tab {
  flex: 1;
  padding: 6px 8px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.market-tab.active {
  background: var(--white);
  color: var(--gray-900);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.market-tab:hover:not(.active) { color: var(--gray-700); }

/* ── Nearby sales card ──────────────────────────────────────────────── */
.card-nearby { animation: fadeUp .35s ease .3s both; }

.nearby-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}
.nearby-item:last-child { border-bottom: none; }

.nearby-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--green-light);
  color: var(--green);
  font-size: .68rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}

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

.nearby-address {
  font-size: .78rem; font-weight: 600; color: var(--gray-700);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.nearby-meta { font-size: .72rem; color: var(--gray-500); margin-top: 2px; }

.nearby-price {
  font-size: .88rem; font-weight: 700; color: var(--green);
  text-align: right; flex-shrink: 0; font-feature-settings: "tnum";
}

.nearby-dist { font-size: .68rem; color: var(--gray-500); text-align: right; margin-top: 2px; }

.nearby-right { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.nearby-price-row { display: flex; align-items: center; gap: 5px; }
.nearby-dist-row  { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.nearby-psf { font-size: .65rem; color: var(--gray-400); font-feature-settings: "tnum"; }

/* ── Comparables summary ────────────────────────────────────────────── */
#nearbyCompareSummary {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.comps-summary {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}
.comps-stat { text-align: center; flex: 1; }
.comps-stat-label { font-size: .65rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .03em; }
.comps-stat-value { font-size: .82rem; font-weight: 700; color: var(--gray-700); font-feature-settings: "tnum"; margin-top: 2px; }
.comps-stat-est .comps-stat-value { color: var(--blue); }
.comps-range-text { font-size: .72rem !important; }

.comps-bar-wrap { margin-top: 4px; }
.comps-bar-track {
  position: relative;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  margin-bottom: 4px;
}
.comps-bar-median {
  position: absolute; top: -3px;
  width: 4px; height: 12px;
  background: var(--gray-500);
  border-radius: 2px;
  transform: translateX(-50%);
}
.comps-bar-pred {
  position: absolute; top: -5px;
  width: 4px; height: 16px;
  background: var(--blue);
  border-radius: 2px;
  transform: translateX(-50%);
}
.comps-bar-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .62rem;
  color: var(--gray-400);
}

/* ── Delta badges ───────────────────────────────────────────────────── */
.delta-badge {
  display: inline-block;
  font-size: .62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  font-feature-settings: "tnum";
}
.delta-above   { background: #fef2f2; color: #dc2626; }
.delta-below   { background: #f0fdf4; color: #16a34a; }
.delta-neutral { background: var(--gray-100); color: var(--gray-500); }

/* ── comps loading indicator ─────────────────────────────────────────── */
.comps-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px;
  color: var(--gray-500);
  font-size: .78rem;
}
.comps-spinner {
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: comps-spin .7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes comps-spin { to { transform: rotate(360deg); } }

/* ── Market comps result panel ───────────────────────────────────────── */
#compsInner {
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  overflow: hidden;
  font-size: .8rem;
}
.comps-header {
  padding: 10px 12px;
  background: #f5f3ff;
  border-bottom: 1px solid #ddd6fe;
}
.comps-summary-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.comps-stat { display: flex; flex-direction: column; gap: 2px; }
.comps-stat-label { font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-500); }
.comps-stat-val   { font-size: .92rem; font-weight: 700; color: #5b21b6; font-feature-settings:"tnum"; }
.comps-period { font-size: .65rem; color: var(--gray-500); margin-top: 4px; }
.comps-list { padding: 4px 0; }
.comp-row {
  padding: 7px 12px;
  border-bottom: 1px solid var(--gray-100);
  transition: background .12s, border-left .12s, padding-left .12s;
}
.comp-row:last-child { border-bottom: none; }
.comp-row:hover { background: var(--gray-50); border-left: 3px solid var(--blue); padding-left: 9px; }
.comp-addr  { font-weight: 600; color: var(--gray-700); font-size: .76rem; }
.comp-meta  { display: flex; gap: 10px; margin-top: 2px; flex-wrap: wrap; align-items: center; }
.comp-price { color: #5b21b6; font-weight: 700; font-size: .8rem; font-feature-settings:"tnum"; }
.comp-psf   { font-size: .7rem; color: var(--gray-500); }
.comp-date  { font-size: .68rem; color: var(--gray-400); margin-left: auto; }
.comps-credit {
  padding: 5px 12px;
  font-size: .65rem;
  color: var(--gray-400);
  text-align: right;
  border-top: 1px solid var(--gray-100);
}
.comps-credit a { color: #7c3aed; text-decoration: none; }
.comps-unavail {
  padding: 12px;
  color: var(--gray-500);
  font-size: .78rem;
  text-align: center;
}

/* ── RTL overrides (Arabic) ─────────────────────────────────────────── */
[dir="rtl"] body { font-family: 'Segoe UI', Arial, 'Tahoma', sans-serif; }
[dir="rtl"] .sidebar { border-left: none; border-right: 1px solid var(--gray-200); }
[dir="rtl"] .header-left { flex-direction: row-reverse; }
[dir="rtl"] .field-row { direction: rtl; }
[dir="rtl"] .steps li { flex-direction: row-reverse; }
[dir="rtl"] .location-display { flex-direction: row-reverse; }
[dir="rtl"] .nearby-price, [dir="rtl"] .nearby-dist { text-align: left; }
[dir="rtl"] label { text-align: right; }
[dir="rtl"] .shap-row { flex-direction: row-reverse; }
[dir="rtl"] .shap-impact { text-align: left; }
[dir="rtl"] .conf-label { flex-direction: row-reverse; }
[dir="rtl"] .bldgtype-grid { direction: rtl; }
[dir="rtl"] .map-ctrl-btn  { right: auto; left: 10px; }

/* ── Sale price bubble markers ───────────────────────────────────────── */
.sale-bubble {
  padding: 3px 8px; border-radius: 12px;
  font-size: .67rem; font-weight: 700; color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.28); border: 1.5px solid rgba(255,255,255,.5);
  white-space: nowrap; cursor: pointer; font-feature-settings: "tnum"; line-height: 1;
  transition: transform .1s;
}
.sale-bubble:hover { transform: scale(1.12); }
.cluster-bubble {
  width: 36px; height: 36px; border-radius: 50%; background: #4b6bfb;
  border: 2.5px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.22); color: #fff;
  font-size: .75rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.sale-popup strong { font-size: .95rem; color: var(--gray-900); display: block; }
.sale-popup-addr { font-size: .76rem; color: var(--gray-700); margin-top: 3px; }
.sale-popup-meta { font-size: .7rem; color: var(--gray-500); margin-top: 2px; }
.sale-popup-date { font-size: .65rem; color: var(--gray-400); margin-top: 2px; }

/* ── Building type card grid ─────────────────────────────────────────── */
.field-full { grid-column: 1 / -1; width: 100%; }
/* ── Building type grid & cards ──────────────────────────────────────── */
.bldgtype-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 10px;
}
.bldgtype-grid.invalid .bldgtype-card:not(.selected) {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}
.bldgtype-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px; padding: 11px 4px 9px;
  border: 1.5px solid var(--gray-200); border-radius: 10px;
  background: var(--white); cursor: pointer; min-height: 72px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  transition: border-color .18s, background .18s, transform .18s, box-shadow .18s;
  font-family: var(--font);
}
.bldgtype-card:hover {
  border-color: var(--blue); background: #f5f8ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37,99,235,.13), 0 2px 4px rgba(0,0,0,.06);
}
.bldgtype-card.selected {
  border-color: var(--blue); background: var(--blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37,99,235,.35), 0 2px 6px rgba(0,0,0,.1);
}
.bldgtype-card.selected .btl { color: #fff; }
.bldgtype-card.selected .bti { color: rgba(255,255,255,.95); }

.bti {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-600); pointer-events: none; flex-shrink: 0;
}
.bti svg { width: 100%; height: 100%; }

.btl {
  font-size: .6rem; font-weight: 700; color: var(--gray-600);
  text-align: center; text-transform: uppercase;
  letter-spacing: .03em; line-height: 1.25; pointer-events: none;
}

/* ── Building type label + (i) info button ───────────────────────────── */
.label-with-info {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.label-with-info label { margin-bottom: 0; }

.bldg-info-btn {
  position: relative;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--gray-300); background: transparent;
  color: var(--gray-500); cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s, background .15s;
  padding: 0;
}
.bldg-info-btn svg { width: 11px; height: 11px; }
.bldg-info-btn:hover  { border-color: var(--blue); color: var(--blue); background: #eff6ff; }
.bldg-info-btn:focus  { outline: 2px solid rgba(37,99,235,.4); outline-offset: 2px; }

/* Floating tooltip */
.bldg-info-btn::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 9px); left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--gray-900); color: #fff;
  font-size: .68rem; font-weight: 500; font-family: var(--font);
  padding: 5px 9px; border-radius: 6px;
  opacity: 0; pointer-events: none;
  transition: opacity .15s .05s;
  z-index: 20;
}
.bldg-info-btn::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px); left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--gray-900);
  opacity: 0; pointer-events: none;
  transition: opacity .15s .05s;
}
.bldg-info-btn:hover::before,
.bldg-info-btn:hover::after,
.bldg-info-btn:focus::before,
.bldg-info-btn:focus::after { opacity: 1; }

/* Overlay backdrop */
.bldg-info-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  z-index: 1100; backdrop-filter: blur(2px);
}

/* Popup card */
.bldg-info-popup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 1101; width: min(420px, 94vw); max-height: 82vh;
  display: flex; flex-direction: column;
  background: var(--white); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  padding: 20px 20px 16px; animation: popIn .18s ease;
}
@keyframes popIn {
  from { opacity:0; transform: translate(-50%,-48%) scale(.95); }
  to   { opacity:1; transform: translate(-50%,-50%) scale(1); }
}
.bldg-info-close {
  position: absolute; top: 12px; right: 12px;
  background: var(--gray-100); border: none; border-radius: 50%;
  width: 26px; height: 26px; cursor: pointer; font-size: .8rem;
  color: var(--gray-500); display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.bldg-info-close:hover { background: var(--gray-200); color: var(--gray-900); }
.bldg-info-popup-title {
  font-size: 1rem; font-weight: 700; color: var(--gray-900);
  margin-bottom: 14px; padding-right: 30px;
}
.bldg-info-list {
  overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
}
.bldg-info-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--gray-200); background: var(--gray-50);
}
.bldg-info-row-icon { font-size: 1.5rem; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.bldg-info-row-body { flex: 1; min-width: 0; }
.bldg-info-row-head {
  display: flex; align-items: center; gap: 7px; margin-bottom: 4px; flex-wrap: wrap;
}
.bldg-info-row-title { font-size: .85rem; font-weight: 700; color: var(--gray-900); }
.bldg-info-row-code  {
  font-size: .65rem; font-weight: 700; color: var(--blue);
  background: #eff6ff; border-radius: 4px; padding: 1px 6px;
}
.bldg-info-row-median {
  font-size: .65rem; font-weight: 600; color: var(--gray-500);
  margin-left: auto;
}
.bldg-info-row-desc { font-size: .77rem; color: var(--gray-600); line-height: 1.5; }

/* ── Advanced toggle & animated panel ───────────────────────────────── */
.adv-toggle {
  display: flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 500; font-family: var(--font);
  color: var(--gray-500); background: none; border: none;
  cursor: pointer; padding: 4px 0; margin-bottom: 2px;
  text-align: left; transition: color .15s;
}
.adv-toggle:hover  { color: var(--blue); }
.adv-toggle.open   { color: var(--blue); }

.toggle-chevron {
  flex-shrink: 0;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.adv-toggle.open .toggle-chevron { transform: rotate(180deg); }

/* grid-template-rows trick for zero-height → full-height with no JS measurement */
.adv-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .28s cubic-bezier(.4,0,.2,1);
  margin-top: 2px;
}
.adv-panel.open { grid-template-rows: 1fr; }
.adv-panel-inner { overflow: hidden; }

/* ── Advanced search input with icon ────────────────────────────────── */
.bldg-search-icon {
  position: absolute;
  left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--gray-400); pointer-events: none;
}
#bldgSearchInput { padding-left: 32px; }

/* RTL mirrors */
[dir=rtl] .adv-toggle            { text-align: right; }
[dir=rtl] .bldg-search-icon      { left: auto; right: 10px; }
[dir=rtl] #bldgSearchInput       { padding-left: 12px; padding-right: 32px; }
[dir=rtl] .bldg-info-btn::before { left: auto; right: 50%; transform: translateX(50%); }
[dir=rtl] .bldg-info-btn::after  { left: auto; right: 50%; transform: translateX(50%); }

/* ── Pin drop + pulse animations ────────────────────────────────────── */
@keyframes pinDrop {
  0%   { opacity: 0; transform: translateY(-24px) scale(.7); }
  60%  { transform: translateY(4px) scale(1.05); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pinPulse {
  0%   { filter: drop-shadow(0 2px 4px rgba(37,99,235,.5)); }
  50%  { filter: drop-shadow(0 0 14px rgba(37,99,235,.9)); }
  100% { filter: drop-shadow(0 2px 4px rgba(37,99,235,.5)); }
}
.pin-drop { animation: pinDrop .4s cubic-bezier(.34,1.56,.64,1) forwards; }
.pin-icon  { animation: pinPulse 1.4s ease-in-out .4s 3; }

/* ── Price reveal animation ──────────────────────────────────────────── */
@keyframes priceReveal {
  from { opacity: 0; transform: translateY(8px) scale(.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.price-reveal { animation: priceReveal .4s cubic-bezier(.34,1.2,.64,1) both; }

/* ── Geolocation button ──────────────────────────────────────────────── */
.map-ctrl-btn {
  position: absolute; bottom: 80px; right: 10px; z-index: 1000;
  background: var(--white); border: 1.5px solid var(--gray-200); border-radius: 8px;
  padding: 6px 11px; font-size: .74rem; font-weight: 600; color: var(--gray-700);
  cursor: pointer; box-shadow: var(--shadow-sm); transition: background .15s, box-shadow .15s;
}
.map-ctrl-btn:hover { background: #eff6ff; border-color: var(--blue); color: var(--blue-dark); box-shadow: var(--shadow-md); }

/* ── Responsive tweaks ───────────────────────────────────────────────── */
/* ── Mobile: bottom-drawer layout (≤768px) ──────────────────────── */
@media (max-width: 768px) {
  :root { --drawer-peek: 72px; }

  /* Map fills full viewport behind drawer */
  .layout { display: block; position: relative; }
  .map-section {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    height: calc(100dvh - var(--header-h));
  }
  #map { height: 100%; }

  /* Drawer: slides up from bottom */
  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: 88dvh;
    border-radius: 18px 18px 0 0;
    border-top: none;
    box-shadow: 0 -6px 40px rgba(0,0,0,.18);
    transform: translateY(calc(100% - var(--drawer-peek)));
    transition: transform .32s cubic-bezier(.32,.72,0,1);
    will-change: transform;
    z-index: 500;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.drawer-open { transform: translateY(0); }

  /* Drag handle — always visible at peek */
  .drawer-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0 6px;
    cursor: pointer;
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--white);
    border-radius: 18px 18px 0 0;
  }
  .drawer-pill {
    width: 40px; height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
  }

  /* Dismiss overlay when drawer open */
  .drawer-backdrop {
    display: none;
    position: fixed; inset: 0; z-index: 499;
    background: rgba(0,0,0,.15);
  }
  .drawer-backdrop.visible { display: block; }

  /* Nav/header compress */
  .tagline { display: none; }
  .header-badges .badge:not(.badge-blue):not(.lang-toggle) { display: none; }
  .header-badges .lang-toggle { display: flex; }

  /* Layer bar: scrollable, no scrollbar */
  .layer-bar { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .layer-bar::-webkit-scrollbar { display: none; }

  /* Touch targets */
  .btn-predict { padding: 14px; font-size: 1rem; min-height: 52px; }
  .addr-btn    { min-height: 42px; min-width: 42px; }

  /* Building type grid: horizontal scroll on mobile */
  .bldgtype-grid {
    display: flex; overflow-x: auto; gap: 6px;
    padding-bottom: 4px; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .bldgtype-grid::-webkit-scrollbar { display: none; }
  .bldgtype-card { flex: 0 0 72px; min-width: 72px; }

  /* Sticky predict button */
  .predict-sticky {
    position: sticky; bottom: 0;
    background: var(--bg);
    padding: 10px 0 6px;
    border-top: 1px solid var(--gray-200);
    z-index: 10;
  }

  /* Map hint: show above drawer peek */
  .map-hint { bottom: calc(var(--drawer-peek) + 12px); }
  #geolocBtn { bottom: calc(var(--drawer-peek) + 52px); }
}

@media (max-width: 480px) {
  .bldgtype-card { padding: 8px 2px; }
  .field-row { grid-template-columns: 1fr; }
}

/* ── Address Search ──────────────────────────────────────────────────── */
.addr-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  position: relative;
}
.addr-search-wrap input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  transition: border-color .2s, box-shadow .2s;
}
.addr-search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.addr-btn {
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
.addr-btn:hover  { background: var(--accent-dark, #2563eb); }
.addr-btn:active { transform: scale(.96); }
.addr-btn.loading { opacity: .6; pointer-events: none; }
.addr-error {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 3px;
  background: #fef2f2;
  color: #dc2626;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #fecaca;
  z-index: 10;
}
[dir="rtl"] .addr-search-wrap { flex-direction: row-reverse; }

/* ── Share / Export Actions ──────────────────────────────────────────── */
.share-actions {
  display: flex; gap: 8px; margin-top: 12px;
}
.share-btn {
  flex: 1; padding: 7px 10px;
  background: var(--white); border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: .75rem; font-weight: 600; font-family: inherit;
  color: var(--gray-700); transition: background .15s, border-color .15s, color .15s;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.share-btn:hover {
  background: var(--indigo-light, #eef2ff); border-color: var(--indigo, #6366f1);
  color: var(--indigo, #6366f1);
}

/* ── Toast Notification ──────────────────────────────────────────────── */
.toast-notification {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--gray-900); color: var(--white);
  padding: 10px 20px; border-radius: 20px;
  font-size: .82rem; font-weight: 600; font-family: inherit;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; z-index: 9999;
  transition: opacity .22s ease, transform .22s ease;
  white-space: nowrap;
}
.toast-notification.visible {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ── Property Comparison Modal ───────────────────────────────────────── */
.compare-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15,23,42,0.65); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 32px 16px 48px; overflow-y: auto;
}
.compare-modal {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 100%; max-width: 920px;
  display: flex; flex-direction: column;
  animation: compareIn 0.22s ease;
}
@keyframes compareIn {
  from { opacity:0; transform: translateY(-14px) scale(0.98); }
  to   { opacity:1; transform: translateY(0)     scale(1);    }
}
.compare-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
}
.compare-header h2 {
  font-size: 1rem; font-weight: 700; color: var(--gray-900); margin: 0;
}
.compare-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.15rem; color: var(--gray-500); padding: 4px 8px;
  border-radius: 6px; line-height: 1; transition: background .15s, color .15s;
}
.compare-close:hover { background: var(--gray-100); color: var(--gray-900); }

/* Delta banner */
.compare-delta-banner {
  margin: 12px 20px 0;
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600; text-align: center;
}
.compare-delta-higher { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.compare-delta-lower  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.compare-delta-equal  { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }

/* Two-col grid */
.compare-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  padding: 16px 20px 24px;
}
@media (max-width: 640px) { .compare-grid { grid-template-columns: 1fr; } }

/* Each column */
.compare-col {
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 14px; background: var(--gray-50);
}
.compare-col-header { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.compare-col-label {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--gray-500);
}
.compare-col-label-A { color: #1d4ed8; }
.compare-col-label-B { color: #7c3aed; }

/* Address search row */
.compare-addr-row { display: flex; gap: 6px; }
.compare-addr-input {
  flex: 1; padding: 7px 10px; border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); font-size: .8rem;
  font-family: inherit; background: var(--white);
  transition: border-color .15s;
}
.compare-addr-input:focus { outline: none; border-color: var(--blue); }
.compare-addr-btn {
  padding: 7px 11px; background: var(--blue); color: white;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
  transition: background .15s;
}
.compare-addr-btn:hover:not(:disabled) { background: var(--blue-dark); }
.compare-addr-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Mini form grid */
.compare-mini-form { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.compare-field label {
  display: block; font-size: .67rem; font-weight: 600; color: var(--gray-500);
  margin-bottom: 3px; text-transform: uppercase; letter-spacing: .04em;
}
.compare-field select,
.compare-field input[type="number"] {
  width: 100%; padding: 6px 8px; border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); font-size: .8rem;
  font-family: inherit; background: var(--white); box-sizing: border-box;
  transition: border-color .15s;
}
.compare-field select:focus,
.compare-field input[type="number"]:focus { outline: none; border-color: var(--blue); }

/* Error / success line */
.compare-error {
  font-size: .73rem; padding: 3px 0;
  color: var(--red); display: none;
}

/* Estimate button */
.compare-estimate-btn {
  width: 100%; padding: 9px; background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white; border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-size: .83rem; font-weight: 700; font-family: inherit;
  transition: opacity .15s; display: flex; align-items: center;
  justify-content: center; gap: 6px;
}
.compare-estimate-btn:hover:not(:disabled) { opacity: .88; }
.compare-estimate-btn:disabled { opacity: .55; cursor: not-allowed; }

/* Result box */
.compare-result {
  display: none; flex-direction: column; gap: 5px;
  padding: 10px 12px; background: var(--white);
  border-radius: var(--radius-sm); border: 1px solid var(--gray-200);
}
.compare-result.visible { display: flex; }

.compare-result-price {
  font-size: 1.45rem; font-weight: 800; color: var(--gray-900); letter-spacing: -1px;
}
.compare-result-range { font-size: .72rem; color: var(--gray-500); }
.compare-result-meta  { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: 2px 0; }
.compare-psf-badge {
  font-size: .68rem; background: var(--blue-light); color: var(--blue-dark);
  padding: 2px 7px; border-radius: 10px; font-weight: 600;
}

/* Top-3 drivers */
.compare-result-drivers { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.compare-driver-row { display: flex; align-items: center; gap: 6px; font-size: .71rem; }
.compare-driver-arrow { font-size: .8rem; font-weight: 800; flex-shrink: 0; }
.compare-driver-label  { flex: 1; color: var(--gray-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compare-driver-bar-wrap {
  width: 44px; height: 4px; background: var(--gray-200);
  border-radius: 3px; overflow: hidden; flex-shrink: 0;
}
.compare-driver-bar { height: 100%; border-radius: 3px; }
.compare-driver-bar.positive { background: var(--green); }
.compare-driver-bar.negative { background: var(--red); }
.compare-driver-impact {
  font-weight: 600; width: 46px; text-align: right; flex-shrink: 0; font-size: .7rem;
}
.compare-driver-impact.positive { color: var(--green); }
.compare-driver-impact.negative { color: var(--red); }

/* ── Price trend chart ───────────────────────────────────────────────── */
#trendChart {
  margin-top: 12px;
  padding: 10px 0 0;
  border-top: 1px solid var(--gray-200);
}
.trend-header {
  font-size: .7rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
#trendCanvas { max-height: 160px; }

/* ══════════════════════════════════════════════════════════════════
   RTL / ARABIC SUPPORT
   ══════════════════════════════════════════════════════════════════ */
[dir=rtl] {
  font-family: var(--font-ar);
}
[dir=rtl] .header-left   { flex-direction: row-reverse; }
[dir=rtl] .shap-arrow    { transform: scaleX(-1); }
[dir=rtl] .shap-bar-wrap { direction: rtl; }
[dir=rtl] .shap-row      { flex-direction: row-reverse; }
[dir=rtl] .shap-impact   { margin-right: 0; margin-left: 0; }
[dir=rtl] .avm-qc-row    { flex-direction: row-reverse; }
[dir=rtl] .conf-bar-wrap { direction: rtl; }
[dir=rtl] .card-title    { flex-direction: row-reverse; }
[dir=rtl] .spatial-item  { flex-direction: row-reverse; text-align: right; }
[dir=rtl] .nearby-row    { flex-direction: row-reverse; }
[dir=rtl] .addr-search-wrap { flex-direction: row-reverse; }
[dir=rtl] .waterfall-wrap { direction: rtl; }
[dir=rtl] .label-with-info { flex-direction: row-reverse; }
/* Mirror back-arrow in breadcrumbs / progress */
[dir=rtl] .nav-arrow,
[dir=rtl] .progress-arrow { transform: scaleX(-1); display: inline-block; }

/* ══════════════════════════════════════════════════════════════════
   SHAP WATERFALL CHART
   ══════════════════════════════════════════════════════════════════ */
#waterfallCard {
  margin-top: 10px;
}
.waterfall-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
}
#waterfallCanvas { max-height: 260px; width: 100% !important; }
.waterfall-toggle {
  display: flex; gap: 6px; margin-bottom: 8px;
}
.waterfall-toggle button {
  font-size: .7rem; padding: 3px 10px; border-radius: 20px;
  border: 1px solid var(--gray-200); background: var(--gray-50);
  color: var(--gray-700); cursor: pointer; font-weight: 600;
  transition: background .15s, color .15s;
}
.waterfall-toggle button.active {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.shap-nl-tip {
  font-size: .72rem; color: var(--gray-500); margin-top: 2px;
  font-style: italic; line-height: 1.4;
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE — THUMB ZONE OPTIMISATION
   ══════════════════════════════════════════════════════════════════ */
/* (mobile rules consolidated above) */

/* ── Riyadh mobile fixes ────────────────────────────────────────── */
@media (max-width: 480px) {
  .riyadh-spatial-grid { grid-template-columns: 1fr; }
  .riyadh-price-main { font-size: 1.8rem; }
  #riyadhAddrSearchWrap input { font-size: 13px; }
}

/* ── Global mobile layout fixes (≤480px) ────────────────────────── */
@media (max-width: 480px) {
  /* NYC form: 2-col fields → single column */
  .field-row { grid-template-columns: 1fr; }

  /* Spatial cards: 3-col → 2-col */
  .spatial-grid { grid-template-columns: repeat(2, 1fr); }

  /* Steps wizard: shrink text, keep 3-col but compact */
  .steps { gap: 4px; }
  .steps li { font-size: .70rem; }
  .step-num { width: 22px; height: 22px; font-size: .65rem; }

  /* Compare tool mini-form: 2-col → 1-col */
  .compare-mini-form { grid-template-columns: 1fr; }

  /* Share buttons: wrap gracefully */
  .share-actions { flex-wrap: wrap; }
  .share-btn { flex: 1 1 45%; }

  /* Confidence bar labels: shrink font */
  .conf-label { font-size: .72rem; }

  /* AVM QC grade row: stack vertically */
  .avm-qc-row { flex-direction: column; gap: 6px; }
}

/* ── Tablet range (481–768px) extra fixes ────────────────────────── */
@media (min-width: 481px) and (max-width: 768px) {
  /* Spatial grid: keep 3-col at tablet width */
  .spatial-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Riyadh form & results ──────────────────────────────────────── */
.riyadh-results {
  margin-top: 16px;
  border-top: 2px solid var(--blue);
  padding-top: 14px;
}
.riyadh-price-hero {
  text-align: center;
  background: linear-gradient(135deg, #064e3b 0%, #065f46 50%, #047857 100%);
  border-radius: 14px;
  padding: 22px 16px;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 8px 28px rgba(6,78,59,.3);
  position: relative;
  overflow: hidden;
}
.riyadh-price-hero::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}
.riyadh-price-label {
  font-size: .72rem;
  opacity: .75;
  margin-bottom: 6px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.riyadh-price-main {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
}
.riyadh-price-unit {
  font-size: 1rem;
  font-weight: 400;
  opacity: .85;
  margin-left: 4px;
}
.riyadh-price-total {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 6px;
  opacity: .92;
}
.riyadh-total-label {
  font-weight: 400;
  font-size: .85rem;
  opacity: .7;
  margin-right: 2px;
}
.riyadh-confidence {
  font-size: .76rem;
  opacity: .75;
  margin-top: 4px;
}
/* ── Asking-price overlay (Bayut / Redfin) ─────────────────────────── */
.asking-overlay {
  margin: 10px 0 4px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fbbf24;
  border-radius: 10px;
  padding: 10px 14px 8px;
}
.asking-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.asking-label {
  font-size: .73rem;
  font-weight: 600;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.asking-val {
  font-size: 1rem;
  font-weight: 700;
  color: #78350f;
}
.asking-spread-badge {
  margin-top: 5px;
  font-size: .72rem;
  color: #92400e;
  line-height: 1.35;
}
.asking-spread-badge.spread-up   { color: #b45309; }
.asking-spread-badge.spread-down { color: #065f46; }

/* !! weerate Jun 2026 multi-source benchmark row */
.riyadh-benchmark-row {
  font-size: 11px;
  color: var(--gray-500);
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: 6px;
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.bench-title { font-weight: 600; color: var(--gray-700); margin-right: 4px; }
.bench-src   { background: var(--white); border: 1px solid var(--gray-200); border-radius: 4px; padding: 2px 7px; }
.bench-above { color: var(--orange); font-weight: 700; }
.bench-below { color: var(--green);  font-weight: 700; }

.riyadh-spatial-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.riyadh-spatial-item {
  background: var(--gray-50, #f7f8fa);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: .78rem;
}
.riyadh-spatial-item .rs-label {
  color: var(--gray-500, #6b7280);
  display: block;
  margin-bottom: 2px;
}
.riyadh-spatial-item .rs-val {
  font-weight: 600;
  font-size: .88rem;
}

/* ── Riyadh property type cards ───────────────────────────────────── */
.riyadh-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.riyadh-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s, transform .12s;
  font-family: var(--font);
  line-height: 1.2;
}
.riyadh-type-card:hover {
  border-color: var(--blue);
  background: #eff6ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37,99,235,.12);
}
.riyadh-type-card.selected {
  border-color: var(--blue);
  background: #eff6ff;
  box-shadow: 0 0 0 2px var(--blue), 0 4px 14px rgba(37,99,235,.18);
  transform: translateY(-1px);
}
.riyadh-type-grid.invalid .riyadh-type-card {
  border-color: var(--red);
}
.riyadh-type-card .rti {
  font-size: 1.4rem;
  line-height: 1;
}
.riyadh-type-card .rtl-en {
  font-size: .68rem;
  font-weight: 600;
  color: var(--gray-700);
}
.riyadh-type-card .rtl-ar {
  font-size: .65rem;
  color: var(--gray-500);
  font-family: var(--font-ar);
}

/* ── NYC per-sqft / per-sqm secondary price row ─────────────────────── */
.price-psf-row {
  font-size: .78rem;
  color: var(--gray-500);
  margin: 1px 0 5px;
  font-weight: 500;
  letter-spacing: .01em;
}
.price-psf-row span {
  font-weight: 700;
  color: var(--gray-700);
}

/* ── City Comparison Modal ─────────────────────────────────────────── */
.cc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.cc-modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px 13px;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.cc-modal-header h2 {
  font-size: .98rem;
  font-weight: 700;
  color: var(--gray-900);
}
.cc-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  color: var(--gray-500);
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1;
}
.cc-close:hover { background: var(--gray-100); color: var(--gray-900); }

/* grid: label | NYC | Riyadh */
.cc-table {
  overflow-y: auto;
  display: grid;
  grid-template-columns: 175px 1fr 1fr;
}

/* sticky column headers */
.cc-thead { display: contents; }
.cc-thead .cc-cell {
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 2;
  padding: 10px 16px 10px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 2px solid var(--gray-200);
}
.cc-head-nyc { color: var(--blue-dark); }
.cc-head-riy { color: var(--green); }

/* section divider */
.cc-section {
  grid-column: 1 / -1;
  padding: 9px 16px 7px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}

/* data rows */
.cc-row { display: contents; }
.cc-row .cc-cell {
  padding: 7px 16px;
  font-size: .8rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.cc-row .cc-cell.cc-label {
  font-size: .75rem;
  font-weight: 500;
  color: var(--gray-500);
}

/* bar rows */
.cc-bar-row .cc-cell { flex-direction: column; align-items: flex-start; gap: 3px; padding-bottom: 9px; }
.cc-bar-wrap { width: 100%; height: 5px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.cc-bar { height: 100%; border-radius: 3px; }
.cc-bar-nyc  { background: var(--blue); }
.cc-bar-riy  { background: var(--green); }
.cc-bar-warn { background: var(--orange); }

/* value highlights */
.cc-num { font-weight: 700; font-size: .88rem; }
.cc-num-nyc  { color: var(--blue-dark); }
.cc-num-riy  { color: var(--green); }
.cc-num-warn { color: var(--orange); }
.cc-num-good { color: var(--green); }

.cc-strong { font-weight: 700; color: var(--gray-900); }
.cc-chip {
  display: inline-block;
  background: var(--gray-100);
  color: var(--gray-500);
  font-size: .63rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
}
.cc-yes { color: var(--green); font-weight: 700; }
.cc-no  { color: var(--gray-300); }

@media (max-width: 580px) {
  .cc-table { grid-template-columns: 100px 1fr 1fr; }
  .cc-row .cc-cell { font-size: .72rem; padding: 6px 10px; }
  .cc-modal-header h2 { font-size: .85rem; }
}

/* ── UI Polish ─────────────────────────────────────────────────────────
   Targeted visual improvements: icon accent colours, premium price
   block, custom scrollbar, AVM grade colours, hover micro-animations.
   ─────────────────────────────────────────────────────────────────── */

/* Building type cards — per-category icon accent colours */
.bldgtype-grid .bldgtype-card:nth-child(1) .bti { color: #f59e0b; } /* Single Family  */
.bldgtype-grid .bldgtype-card:nth-child(2) .bti { color: #f97316; } /* 2-Family       */
.bldgtype-grid .bldgtype-card:nth-child(3) .bti { color: #ef4444; } /* 3-Family       */
.bldgtype-grid .bldgtype-card:nth-child(4) .bti { color: #b45309; } /* Row House      */
.bldgtype-grid .bldgtype-card:nth-child(5) .bti { color: #8b5cf6; } /* Condo         */
.bldgtype-grid .bldgtype-card:nth-child(6) .bti { color: #2563eb; } /* Elevator Apt  */
.bldgtype-grid .bldgtype-card:nth-child(7) .bti { color: #0d9488; } /* Walk-up Apt   */
.bldgtype-grid .bldgtype-card:nth-child(8) .bti { color: #6366f1; } /* Co-op         */
.bldgtype-grid .bldgtype-card:nth-child(9) .bti { color: #10b981; } /* Mixed Use     */

/* Hover: darken the accent instead of losing it */
.bldgtype-card:nth-child(1):hover .bti { color: #d97706; }
.bldgtype-card:nth-child(2):hover .bti { color: #ea580c; }
.bldgtype-card:nth-child(3):hover .bti { color: #dc2626; }
.bldgtype-card:nth-child(4):hover .bti { color: #92400e; }
.bldgtype-card:nth-child(5):hover .bti { color: #7c3aed; }
.bldgtype-card:nth-child(6):hover .bti { color: #1d4ed8; }
.bldgtype-card:nth-child(7):hover .bti { color: #0f766e; }
.bldgtype-card:nth-child(8):hover .bti { color: #4f46e5; }
.bldgtype-card:nth-child(9):hover .bti { color: #059669; }

/* Selected: icon stays white (already defined), add coloured bottom border */
.bldgtype-card:nth-child(1).selected { border-color: #f59e0b; background: linear-gradient(145deg,#f59e0b,#d97706); }
.bldgtype-card:nth-child(2).selected { border-color: #f97316; background: linear-gradient(145deg,#f97316,#ea580c); }
.bldgtype-card:nth-child(3).selected { border-color: #ef4444; background: linear-gradient(145deg,#ef4444,#dc2626); }
.bldgtype-card:nth-child(4).selected { border-color: #b45309; background: linear-gradient(145deg,#b45309,#92400e); }
.bldgtype-card:nth-child(5).selected { border-color: #8b5cf6; background: linear-gradient(145deg,#8b5cf6,#7c3aed); }
.bldgtype-card:nth-child(6).selected { border-color: #2563eb; background: linear-gradient(145deg,#2563eb,#1d4ed8); }
.bldgtype-card:nth-child(7).selected { border-color: #0d9488; background: linear-gradient(145deg,#0d9488,#0f766e); }
.bldgtype-card:nth-child(8).selected { border-color: #6366f1; background: linear-gradient(145deg,#6366f1,#4f46e5); }
.bldgtype-card:nth-child(9).selected { border-color: #10b981; background: linear-gradient(145deg,#10b981,#059669); }

/* Price block — larger, more premium */
.price-main {
  font-size: 3.1rem !important;
  letter-spacing: -2.5px !important;
  background: linear-gradient(135deg, #1e40af 0%, #4f46e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 1px 2px rgba(37,99,235,.15));
}

/* Result card — richer background */
.card-result {
  background: linear-gradient(160deg, #eff6ff 0%, #f5f3ff 50%, #ffffff 100%) !important;
  border-color: rgba(99,102,241,.2) !important;
  box-shadow: 0 4px 24px rgba(37,99,235,.08), 0 1px 4px rgba(0,0,0,.04) !important;
}

/* AVM confidence grade — colour-coded (enhances existing conf-grade-X classes) */
.conf-grade-A { background: #dcfce7 !important; color: #166534 !important; border: 1px solid #86efac; }
.conf-grade-B { background: #dbeafe !important; color: #1e40af !important; border: 1px solid #93c5fd; }
.conf-grade-C { background: #fef9c3 !important; color: #854d0e !important; border: 1px solid #fde047; }
.conf-grade-D { background: #fee2e2 !important; color: #991b1b !important; border: 1px solid #fca5a5; }

/* Sidebar custom scrollbar */
.sidebar::-webkit-scrollbar          { width: 4px; }
.sidebar::-webkit-scrollbar-track    { background: transparent; }
.sidebar::-webkit-scrollbar-thumb    { background: var(--gray-300); border-radius: 2px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
.sidebar { scrollbar-width: thin; scrollbar-color: var(--gray-300) transparent; }

/* Input focus glow — more prominent */
.form-input:focus,
.addr-search-wrap input:focus,
input[type=number]:focus,
select:focus {
  box-shadow: 0 0 0 3px rgba(99,102,241,.18), 0 1px 3px rgba(0,0,0,.06) !important;
  border-color: #6366f1 !important;
}

/* Submit button — stronger gradient */
.btn-predict:not(:disabled) {
  background: linear-gradient(135deg, #2563eb 0%, #6366f1 100%) !important;
}
.btn-predict:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8 0%, #4f46e5 100%) !important;
  box-shadow: 0 8px 24px rgba(99,102,241,.4) !important;
}

/* Location hint pulse */
@keyframes hintPulse {
  0%,100% { opacity: .75; }
  50%      { opacity: 1; }
}
.location-text { animation: hintPulse 2.8s ease-in-out infinite; }

/* SHAP bar — thicker, rounded both ends */
.shap-bar-fill {
  border-radius: 4px !important;
  min-width: 3px;
}
.shap-bar-fill.positive { background: linear-gradient(90deg, #a7f3d0, #059669) !important; }
.shap-bar-fill.negative { background: linear-gradient(90deg, #fecaca, #dc2626) !important; }
