:root {
  /* BIOSORA Clean Vibe Variables */
  --bg: #f4f3f0;
  --surface: #ffffff;
  --border: #e8e6df;
  --primary: #c26953; /* Copper/Terracotta accent */
  --primary-hover: #a85845;
  --text: #171717;
  --text-muted: #8a8885;
  --success: #6ba375;
  --warning: #d99a5a;
  
  --radius: 32px;
  --radius-sm: 16px;
  --shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.05);
  
  --font-primary: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body[data-theme="dark"] {
  --bg: #151413;
  --surface: #1e1d1c;
  --border: #2c2a28;
  --primary: #d67a63;
  --primary-hover: #e88d76;
  --text: #f0f0f0;
  --text-muted: #9e9c98;
  --shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-primary);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}

.app-shell { max-width: 1440px; margin: 0 auto; padding: 24px 5%; }

/* Typography Scale */
h1, h2, h3, strong { font-weight: 800; letter-spacing: -0.02em; }

/* Topbar & Nav (Pill style) */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 48px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark { width: 48px; height: 48px; background: var(--text); color: var(--surface); display: flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 800; font-size: 1.2rem; }
.brand div { display: flex; flex-direction: column; }
.brand strong { font-size: 1.2rem; letter-spacing: -0.03em; }
.brand small { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }

.site-nav { background: #e8e6df; border-radius: 999px; padding: 6px; display: inline-flex; gap: 4px; }
body[data-theme="dark"] .site-nav { background: #111; }
.nav-link { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 24px; border-radius: 999px; color: var(--text-muted); text-decoration: none; font-weight: 700; font-size: 0.95rem; transition: 0.2s; }
.nav-link.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.nav-link:hover:not(.active) { color: var(--text); }

.top-actions { display: flex; gap: 8px; }
.ghost-button { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: flex; align-items: center; justify-content: center; font-weight: 700; cursor: pointer; transition: 0.2s; }
.ghost-button:hover { background: var(--bg); border-color: var(--text-muted); }

/* Cards */
.glass-card, .sidebar-card, .dialog-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
  border: none;
}

/* Hero */
.hero { margin-bottom: 40px; }
.card-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; }
.eyebrow { font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); margin-bottom: 16px; display: block; }
.hero-copy h1 { font-size: clamp(2.5rem, 4.5vw, 4rem); letter-spacing: -0.04em; line-height: 1.1; margin-bottom: 24px; }
.hero-copy p { font-size: 1.15rem; color: var(--text-muted); max-width: 90%; margin-bottom: 48px; font-weight: 500; line-height: 1.6; }

/* Massive Numbers / Stats (Biosora style) */
.hero-stats { display: flex; gap: 48px; flex-wrap: wrap; }
.hero-stats article { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 3.5rem; font-weight: 800; letter-spacing: -0.05em; color: var(--text); line-height: 1; margin-bottom: 8px; }
.hero-stats span { font-size: 0.95rem; color: var(--text-muted); font-weight: 600; text-transform: capitalize; }

/* Pills & Badges */
.panel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.panel-heading h2, .panel-heading h3 { font-size: 1.5rem; }
.badge { padding: 8px 16px; border-radius: 999px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; background: var(--bg); color: var(--text); }
.badge.success { background: var(--success); color: white; }
.badge.warning { background: var(--warning); color: white; }

.quick-pills { display: flex; flex-wrap: wrap; gap: 12px; }
.quick-pill { padding: 14px 24px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text); font-weight: 700; cursor: pointer; transition: 0.2s; font-size: 0.95rem; }
.quick-pill:hover { border-color: var(--primary); color: var(--primary); background: var(--bg); }

/* Search & Filters */
.search-wrap { padding: 32px 40px; margin-bottom: 48px; display: flex; flex-direction: column; gap: 32px; }
.search-main input { width: 100%; font-size: 1.8rem; padding: 20px 0; border: none; background: transparent; color: var(--text); font-weight: 800; border-bottom: 2px solid var(--border); border-radius: 0; outline: none; transition: 0.3s; letter-spacing: -0.02em; }
.search-main input:focus { border-bottom-color: var(--primary); }
.search-main input::placeholder { color: #d0cpc7; font-weight: 600; }
body[data-theme="dark"] .search-main input::placeholder { color: #444; }

.filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; }
label { display: flex; flex-direction: column; gap: 12px; }
label span { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
select { appearance: none; padding: 16px 20px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-weight: 700; font-size: 1rem; outline: none; cursor: pointer; }

/* Layout */
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; }
.section-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.section-header h2 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 8px; }
.section-header p { color: var(--text-muted); font-size: 1.05rem; font-weight: 500; }

/* Listing Grid */
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 32px; }
.listing-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.3s ease, box-shadow 0.3s ease; border: 1px solid transparent; }
.listing-card:hover { transform: translateY(-6px); box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.08); border-color: var(--border); }
.listing-media { min-height: 260px; padding: 24px; display: flex; align-items: flex-end; position: relative; background-color: #e8e6df; background-size: cover; background-position: center; }
.listing-media::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.85)); }
.media-label, .media-price { position: relative; z-index: 1; }
.media-price { margin-top: auto; font-size: 2.2rem; font-weight: 800; color: white; letter-spacing: -0.03em; text-shadow: 0 4px 12px rgba(0,0,0,0.3); }

.listing-body { padding: 32px; display: flex; flex-direction: column; flex: 1; }
.meta-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tag-chip { padding: 6px 12px; border-radius: 8px; background: var(--bg); color: var(--text-muted); font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.listing-body h3 { font-size: 1.3rem; line-height: 1.4; margin-bottom: 12px; }
.listing-body p { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 24px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 500; }

.spec-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.spec-chip { font-size: 0.95rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.spec-chip::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }

.listing-actions { display: flex; gap: 12px; margin-top: auto; }
.primary-button, .secondary-button { flex: 1; border-radius: 999px; min-height: 52px; font-size: 0.95rem; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; text-decoration: none; border: none; transition: 0.2s; letter-spacing: 0.02em; }
.primary-button { background: var(--text); color: var(--surface); }
.primary-button:hover { background: var(--primary); color: white; }
.secondary-button { background: transparent; border: 2px solid var(--border); color: var(--text); }
.secondary-button:hover { border-color: var(--text); }
button:disabled { opacity: 0.3; cursor: not-allowed; }

/* Sidebars */
.sidebar-card { margin-bottom: 32px; }
.sidebar-card p { color: var(--text-muted); font-weight: 500; margin-bottom: 24px; line-height: 1.6; }
.source-list { display: flex; flex-direction: column; gap: 20px; }
.source-item { padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.source-item:last-child { border-bottom: none; padding-bottom: 0; }
.source-item strong { display: block; font-size: 1.1rem; margin-bottom: 6px; font-weight: 800; }
.source-item p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 12px; font-weight: 500; }
.source-meta { display: flex; gap: 8px; flex-wrap: wrap; }

.insight-list { list-style: none; display: flex; flex-direction: column; gap: 20px; }
.insight-list li { display: flex; flex-direction: column; gap: 6px; }
.insight-list strong { font-size: 1rem; color: var(--text); }
.insight-list p { font-size: 0.9rem; color: var(--text-muted); margin: 0; }

/* Dialog */
.listing-dialog { margin: auto; border: none; border-radius: var(--radius); background: transparent; padding: 24px; max-width: 680px; width: 100%; }
.listing-dialog::backdrop { background: rgba(0,0,0,0.4); backdrop-filter: blur(8px); }
.dialog-card { position: relative; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: 0 32px 64px rgba(0,0,0,0.15); }
.dialog-close { position: absolute; top: 24px; right: 24px; z-index: 10; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); border: none; font-size: 1.8rem; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); box-shadow: 0 4px 12px rgba(0,0,0,0.08); transition: 0.2s; }
.dialog-close:hover { background: var(--bg); color: var(--primary); }
body[dir="rtl"] .dialog-close { right: auto; left: 24px; }

.dialog-hero { padding: 48px 40px 40px; background: var(--bg); border-bottom: 1px solid var(--border); }
.dialog-hero h2 { font-size: 2rem; font-weight: 800; line-height: 1.2; margin: 20px 0 12px; letter-spacing: -0.03em; }
.dialog-hero .media-price { color: var(--text); text-shadow: none; font-size: 2.8rem; margin-top: 0; letter-spacing: -0.04em; }

.dialog-body { display: flex; flex-direction: column; }
.dialog-top { padding: 24px 40px; display: flex; gap: 32px; background: var(--surface); border-bottom: 1px solid var(--border); }
.dialog-meta { display: flex; flex-direction: column; gap: 4px; }
.dialog-meta strong { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.dialog-meta span { font-size: 1.05rem; font-weight: 700; }

.dialog-section { padding: 32px 40px; border-bottom: 1px solid var(--border); }
.dialog-section:last-child { border-bottom: none; }
.dialog-section h4 { font-size: 0.9rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 24px; }
.dialog-specs { display: flex; flex-wrap: wrap; gap: 20px; }
.dialog-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.dialog-section p { font-size: 1.1rem; color: var(--text); line-height: 1.7; font-weight: 500; }

.chart-footnote { font-size: 0.9rem; color: var(--text-muted); margin-top: 16px; font-weight: 500; }

/* Official Analytics & Maps overrides */
.official-charts-grid,
.official-sources-grid,
.status-grid {
  display: grid;
  gap: 24px;
  min-width: 0;
}
.official-charts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.official-sources-grid,
.status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.chart-card,
.source-ref-card,
.status-card,
.official-card {
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(250,248,244,0.96) 100%);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(23, 23, 23, 0.05);
}
body[data-theme="dark"] .chart-card,
body[data-theme="dark"] .source-ref-card,
body[data-theme="dark"] .status-card,
body[data-theme="dark"] .official-card {
  background: linear-gradient(180deg, rgba(30,29,28,0.98) 0%, rgba(24,23,22,0.98) 100%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}

.chart-card,
.source-ref-card,
.status-card { padding: 28px; }
.official-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}
.official-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.official-card span {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.official-card strong {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 0.95;
  overflow-wrap: anywhere;
}
.official-card small {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 220px;
  margin-top: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 4px 10px;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.trend-bars::-webkit-scrollbar { display: none; }
.trend-bar {
  flex: 0 0 auto;
  min-width: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.trend-column {
  width: 100%;
  background: color-mix(in srgb, var(--primary) 14%, var(--bg));
  border-radius: 999px 999px 8px 8px;
  position: relative;
  overflow: hidden;
  min-height: 10px;
}
.trend-column::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 72%, white) 0%, var(--primary) 100%);
  border-radius: inherit;
}
.chart-legend {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  text-align: center;
  max-width: 58px;
  overflow-wrap: anywhere;
}
.trend-bar small {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.bar-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.bar-row { display: flex; flex-direction: column; gap: 8px; }
.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.92rem;
  font-weight: 700;
}
.bar-meta strong,
.bar-meta span { overflow-wrap: anywhere; }
.bar-meta span { color: var(--primary); text-align: end; }
.bar-track {
  height: 12px;
  background: color-mix(in srgb, var(--primary) 10%, var(--bg));
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 60%, white) 100%);
  border-radius: 999px;
}

.map-layout { display: grid; grid-template-columns: 1fr 400px; gap: 32px; }
.map-canvas { width: 100%; min-height: 700px; border-radius: var(--radius); background: var(--bg); overflow: hidden; z-index: 1; box-shadow: var(--shadow); }

@media (max-width: 1200px) {
  .official-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .card-grid, .content-grid, .map-layout { grid-template-columns: 1fr; }
  .official-charts-grid, .official-sources-grid, .status-grid { grid-template-columns: 1fr; }
  .sidebar-column { order: -1; }
  .hero-stats { flex-wrap: wrap; gap: 32px; }
  .map-canvas { min-height: 500px; }
}

@media (max-width: 600px) {
  .filters-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hero-stats strong { font-size: 2.8rem; }
  .hero-copy h1 { font-size: 2.5rem; }
  .section-header h2 { font-size: 1.8rem; }
  .app-shell { padding: 16px; overflow-x: clip; }
  .glass-card, .sidebar-card, .dialog-card { padding: 20px; margin-bottom: 24px; }
  .dialog-top { flex-direction: column; gap: 16px; padding: 24px; }
  .dialog-hero { padding: 40px 24px 24px; }
  .dialog-section { padding: 24px; }
  .listing-actions { flex-direction: column; }
  .topbar { gap: 16px; margin-bottom: 24px; }
  .site-nav { width: 100%; order: 3; overflow-x: auto; white-space: nowrap; justify-content: flex-start; padding-bottom: 8px; }
  .search-wrap { padding: 24px 20px; gap: 20px; }
  .search-main input { font-size: 1.3rem; padding: 12px 0; }
  label { gap: 6px; }
  label span { font-size: 0.75rem; }

  .official-stats-grid { grid-template-columns: 1fr; gap: 14px; margin-bottom: 20px; }
  .chart-card, .source-ref-card, .status-card { padding: 18px; border-radius: 20px; }
  .official-card { padding: 18px; border-radius: 20px; }
  .official-card strong { font-size: 2rem; }
  .official-card small { font-size: 0.78rem; }
  .official-charts-grid, .official-sources-grid, .status-grid { gap: 14px; }
  .official-header { flex-direction: column; align-items: stretch; }
  .official-header .secondary-button { width: 100%; justify-content: center; }
  .trend-bars { height: 172px; gap: 10px; margin-top: 14px; }
  .trend-bar { min-width: 28px; gap: 7px; }
  .chart-legend { display: none; }
  .trend-bar small { font-size: 0.68rem; }
  .bar-meta { flex-direction: column; }
  .bar-meta span { text-align: start; }
}

/* Fullscreen Map Styles */
body.fullscreen-map {
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  display: flex;
}

.map-fullscreen-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.map-ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.map-floating-header {
  pointer-events: auto;
  margin: 24px;
  padding: 16px 24px;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.map-floating-sidebar {
  pointer-events: auto;
  position: absolute;
  top: 110px;
  right: 24px;
  width: 380px;
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

body[dir="rtl"] .map-floating-sidebar {
  right: auto;
  left: 24px;
}

.map-floating-card {
  padding: 24px;
  margin: 0;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  box-shadow: 0 16px 40px rgba(0,0,0,0.15);
}

.map-scrollable-list {
  overflow-y: auto;
  flex: 1;
  padding-right: 12px; /* Scrollbar spacing */
}
body[dir="rtl"] .map-scrollable-list {
  padding-right: 0;
  padding-left: 12px;
}

.map-floating-meta {
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.map-floating-meta strong {
  font-size: 1rem;
}
.map-floating-meta p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .map-floating-header {
    margin: 16px;
    padding: 12px 16px;
    flex-wrap: wrap;
    border-radius: var(--radius);
  }
  .brand-text-desktop small {
    display: none;
  }
  .map-floating-nav {
    order: 3;
    width: 100%;
    margin-top: 12px;
    justify-content: center;
  }
  .map-floating-sidebar {
    top: auto;
    bottom: 24px;
    left: 16px !important;
    right: 16px !important;
    width: auto;
    max-height: 40vh;
  }
  .map-floating-meta {
    display: none; /* Hide on mobile to save space */
  }
  .leaflet-control-zoom {
    display: none; /* Usually better to hide default zoom controls on mobile */
  }
}

/* Custom Map Markers & Popups */
.custom-map-marker {
  background: transparent;
  border: none;
}
.map-pin-icon {
  width: 40px;
  height: 40px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  border: 2px solid var(--primary);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.map-pin-icon:hover {
  transform: scale(1.1) translateY(-4px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  background: var(--primary);
  color: white;
}
.map-pin-icon svg {
  width: 20px;
  height: 20px;
}

/* Overriding Leaflet Popup for custom beautiful cards */
.leaflet-popup-content-wrapper {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow) !important;
  padding: 0 !important;
  overflow: hidden;
}
.leaflet-popup-content {
  margin: 0 !important;
  width: 280px !important;
}
.leaflet-popup-tip-container {
  overflow: visible !important;
}
.leaflet-popup-tip {
  background: var(--surface) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}

.map-popup-card {
  display: flex;
  flex-direction: column;
}
.map-popup-hero {
  height: 120px;
  background: var(--bg);
  background-size: cover;
  background-position: center;
  position: relative;
}
.map-popup-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}
.map-popup-price {
  position: absolute;
  bottom: 12px;
  left: 16px;
  right: 16px;
  z-index: 2;
  color: white;
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.map-popup-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.map-popup-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.map-popup-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
}
.map-popup-btn {
  margin-top: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: 0.2s;
  width: 100%;
}
.map-popup-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Fullscreen Listing Dialog Overrides (Map context) */
.map-fullscreen-dialog-open .map-ui-overlay {
  display: none !important;
}


/* Hide Hotspots Sidebar per user request */
.map-floating-sidebar { display: none !important; }

/* Image Slider Styles */
.slider-container {
  position: relative;
  width: 100%;
  height: 300px; /* Or 100% of dialog-hero */
  overflow: hidden;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.slider-track {
  display: flex;
  height: 100%;
  transition: transform 0.3s ease-in-out;
  touch-action: pan-y;
}
.slider-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  position: relative;
}
.slider-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}
.slider-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px;
  color: white;
  z-index: 2;
  pointer-events: none;
}
.slider-content h2 { color: white; text-shadow: 0 2px 12px rgba(0,0,0,0.5); }
.slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(4px);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background 0.2s;
}
.slider-nav:hover { background: rgba(255,255,255,0.4); }
.slider-prev { left: 16px; }
.slider-next { right: 16px; }
body[dir="rtl"] .slider-prev { right: 16px; left: auto; }
body[dir="rtl"] .slider-next { left: 16px; right: auto; }
.slider-dots {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 3;
}
.slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: background 0.2s;
}
.slider-dot.active { background: white; }


/* Adjust emoji in map pin */
.map-pin-icon { font-size: 20px; line-height: 1; }

/* Year Filters */
.year-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.year-toggle {
  min-height: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.year-toggle:hover {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--text);
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
}
.year-toggle.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(194, 105, 83, 0.24);
}

/* Grouped Trend Bars */
.grouped-trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-width: 0;
  height: 210px;
  margin-top: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 2px 10px;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.grouped-trend-bars::-webkit-scrollbar { display: none; }
.trend-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 42px;
}
.trend-bar-group-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 150px;
}
.grouped-trend-bars .trend-bar {
  min-width: 14px;
}
.grouped-trend-bars .trend-column {
  border-radius: 6px 6px 0 0;
  min-width: 14px;
}

body.analytics-page .page-hero,
body.analytics-page .official-section,
body.analytics-page .status-section {
  border: 1px solid var(--border);
  box-shadow: 0 14px 40px rgba(23, 23, 23, 0.05);
}
body.analytics-page .page-hero {
  background: radial-gradient(circle at top left, rgba(194, 105, 83, 0.12), transparent 34%), var(--surface);
}
body.analytics-page .chart-card h3,
body.analytics-page .source-ref-card h3,
body.analytics-page .status-card h3 {
  font-size: 1.02rem;
  line-height: 1.25;
}
body.analytics-page .chart-note,
body.analytics-page .source-ref-card p,
body.analytics-page .status-card p,
body.analytics-page .chart-footnote {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .year-filters {
    width: 100%;
    justify-content: flex-start;
  }
  .year-toggle {
    min-height: 30px;
    padding: 0 10px;
    font-size: 0.72rem;
  }
  .grouped-trend-bars {
    gap: 8px;
    height: 168px;
    margin-top: 12px;
  }
  .trend-bar-group {
    min-width: 34px;
    gap: 6px;
  }
  .trend-bar-group-bars {
    height: 126px;
    gap: 3px;
  }
  .grouped-trend-bars .trend-column {
    min-width: 10px;
  }
}
