/* ─────────────────────────────────────────────────────────────
   insights-hotlist.css — Insights · Rayon/Regio dashboard (Hot-list)
   Ported from the Claude Design handoff (2026-06-19-rayon-dashboard).
   Global stylesheet (linked from Web/App.razor) because the hot-list
   spans several components (page, filter bar, widget, sparkline,
   skeleton) with cross-component selectors (e.g. .hot-list__row--top
   .sparkline) that scoped CSS can't express without ::deep.

   Tokens only — every value references css/tokens.css. The .btn /
   .btn--primary primitive comes from css/components.css; the shimmer
   .skeleton base + keyframe is shared with insights-panel.css.

   Class map (semantic, mechanical to port):
     .hot-list-page            → Pages/RayonRegioDashboard.razor
     .hot-list-filter-bar      → HotList/HotListFilterBar.razor
     .pest-toggle / .pest-chip → └ pest-type multi-select
     .hot-list                 → HotList/HotListWidget.razor
     .hot-list__period         → └ 7/14/30-dagen segmented control
     .hot-list__row            → └ ranked location row (a link)
     .hot-list__delta          → └ signed delta badge
     .sparkline                → HotList/Sparkline.razor
   ───────────────────────────────────────────────────────────── */

/* ════════ PAGE — sits in the app-shell content column, on --page-bg.
   Reflows by its own column width, not the viewport — so it adapts
   whether the sidebar is expanded, a rail, or absent on mobile. ════════ */
.hot-list-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  container-type: inline-size;
  container-name: page;
}

.hot-list-page__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-base);
  flex-wrap: wrap;
}
.hot-list-page__title-block { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hot-list-page__title {
  font-size: var(--text-30);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.hot-list-page__subtitle {
  font-size: var(--text-13);
  color: var(--text-secondary);
}

/* ════════ FILTER TOOLBAR — one compact bar, not a stack of controls ════════ */
.hot-list-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md) var(--space-lg);
  flex-wrap: wrap;
  padding: var(--space-md) var(--space-base);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.hot-list-filter-bar__group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}
.hot-list-filter-bar__group--grow { flex: 1; align-items: flex-start; }
.hot-list-filter-bar__label {
  font-size: var(--text-12);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
  padding-top: 6px;   /* baseline-aligns with wrapping chips */
}
.hot-list-filter-bar__divider {
  align-self: stretch;
  width: 1px;
  background: var(--border-subtle);
}
@container page (max-width: 640px) {
  .hot-list-filter-bar__divider { display: none; }
  .hot-list-filter-bar__group { width: 100%; }
}

/* Customer select — styled dropdown (appearance reset + token chevron).
   The chevron is a masked pseudo-element so its colour resolves to a token
   (--text-tertiary); the mask SVG carries shape only, no rendered colour. */
.hot-list-filter-bar__select-wrap { position: relative; display: inline-flex; }
.hot-list-filter-bar__select-wrap::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  background-color: var(--text-tertiary);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center / 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center / 16px no-repeat;
  pointer-events: none;
}
.hot-list-filter-bar__select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 34px 8px 12px;
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-14);
  font-weight: 600;
  cursor: pointer;
  min-width: 170px;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.hot-list-filter-bar__select:hover { border-color: var(--text-tertiary); }
.hot-list-filter-bar__select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Pest-type toggle chips (multi-select) */
.pest-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}
.pest-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--text-13);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.pest-chip:hover { border-color: var(--text-tertiary); color: var(--text-primary); }
.pest-chip__check {
  width: 0; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0;
  margin-left: -4px;
  transition: opacity var(--dur-fast) var(--ease-out),
              width var(--dur-fast) var(--ease-out),
              margin var(--dur-fast) var(--ease-out);
}
.pest-chip.is-active {
  background: var(--surface-soft);
  border-color: var(--primary);
  color: var(--primary);
}
.pest-chip.is-active .pest-chip__check { opacity: 1; width: 13px; margin-left: 0; }
.pest-chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }

/* ════════ HOT-LIST WIDGET — bounded, scannable ranked list ════════ */
.hot-list {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  container-type: inline-size;
  container-name: list;
}

.hot-list__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-base);
  padding: var(--space-md) var(--space-base) var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.hot-list__head-caption {
  font-size: var(--text-13);
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ── Period toggle (segmented control) ── */
.hot-list__period {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}
.hot-list__period-item {
  background: transparent;
  border: none;
  font: inherit;
  font-size: var(--text-13);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.hot-list__period-item:hover { color: var(--text-primary); }
.hot-list__period-item.is-active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.hot-list__period-item:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }

/* ── Rows ── */
.hot-list__rows { display: flex; flex-direction: column; list-style: none; margin: 0; padding: 0; }

.hot-list__row {
  display: flex;
  align-items: center;
  gap: var(--space-base);
  padding: var(--space-md) var(--space-lg);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.hot-list__row + .hot-list__row { border-top: 1px solid var(--border-subtle); }
.hot-list__row:hover { background: var(--surface-hover); }
.hot-list__row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--primary); }

/* Rank — #1 stands out */
.hot-list__rank {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text-tertiary);
  font-size: var(--text-14);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.hot-list__row--top .hot-list__rank {
  background: var(--surface-accent);
  color: var(--primary);
}

/* Location (grows) */
.hot-list__loc { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hot-list__name {
  font-size: var(--text-15);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hot-list__customer {
  font-size: var(--text-13);
  color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Metrics — compact right-aligned cluster */
.hot-list__metrics {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}
.hot-list__count {
  font-size: var(--text-20);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  min-width: 1.5ch;
  text-align: right;
}
.hot-list__row--zero .hot-list__count { color: var(--text-tertiary); }

/* Delta badge — DOWN = good = green, UP = bad = red, FLAT = neutral */
.hot-list__delta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 22px;
  min-width: 54px;
  padding: 0 9px 0 7px;
  border-radius: var(--radius-pill);
  font-size: var(--text-12);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hot-list__delta svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.hot-list__delta--good    { background: var(--status-green-soft); color: var(--status-green); }
.hot-list__delta--bad     { background: var(--status-red-soft);   color: var(--status-red); }
.hot-list__delta--neutral { background: var(--surface-2);         color: var(--text-secondary); }

/* Sparkline — currentColor; quiet by default, reads in both themes */
.hot-list .sparkline {
  flex-shrink: 0;
  width: 96px; height: 28px;
  color: var(--text-tertiary);
  overflow: visible;
}
.hot-list__row--top .sparkline { color: var(--primary); }
.hot-list .sparkline polyline { vector-effect: non-scaling-stroke; }

/* ── Empty state ── */
.hot-list__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  color: var(--text-tertiary);
}
.hot-list__empty-icon {
  width: 32px; height: 32px;
  stroke: currentColor; fill: none;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.7;
}
.hot-list__empty-title { font-size: var(--text-15); font-weight: 600; color: var(--text-secondary); }
.hot-list__empty-hint { font-size: var(--text-13); color: var(--text-tertiary); }

/* ════════ SKELETON / LOADING (base .skeleton + shimmer from insights-panel.css) ════════ */
.hot-list__row--skeleton { cursor: default; }
.hot-list__row--skeleton:hover { background: transparent; }
.skeleton--rank { width: 28px; height: 28px; border-radius: var(--radius-md); flex-shrink: 0; }
.skeleton--name { height: 13px; width: 62%; }
.skeleton--sub  { height: 11px; width: 38%; margin-top: 6px; }
.skeleton--count { width: 20px; height: 20px; }
.skeleton--delta { width: 54px; height: 22px; border-radius: var(--radius-pill); }
.skeleton--spark { width: 96px; height: 16px; }
.hot-list__row--skeleton .hot-list__loc { gap: 0; }

/* ════════ RESPONSIVE — row collapse on narrow columns ════════ */

/* Sparkline is the first thing to go when space is tight. */
@container list (max-width: 560px) {
  .hot-list .sparkline, .skeleton--spark { display: none; }
  .hot-list__metrics { gap: var(--space-md); }
}

/* Below ~440px the metrics drop under the location name so nothing
   crowds or overflows; rank + name stay on the top line. */
@container list (max-width: 440px) {
  .hot-list__row { flex-wrap: wrap; row-gap: var(--space-xs); }
  .hot-list__loc { flex-basis: calc(100% - 28px - var(--space-base)); }
  .hot-list__metrics {
    width: 100%;
    padding-left: calc(28px + var(--space-base));
    justify-content: flex-start;
    gap: var(--space-base);
  }
  .hot-list__count { min-width: 0; text-align: left; }
  .hot-list__head { gap: var(--space-sm); }
}
