/* Styles for the Signal Shopper page itself. The two components carry their own styles. */

:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --text: #1b1b1a;
  --muted: #66655f;
  --line: rgba(0, 0, 0, 0.12);
  --soft: rgba(0, 0, 0, 0.05);
  --danger: #b8322f;
  --warn-bg: #fbeed0;
  --warn-text: #6b4a00;
  --focus: #2b6fd6;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --card: #1c1c1b;
    --text: #ecebe6;
    --muted: #a3a29b;
    --line: rgba(255, 255, 255, 0.14);
    --soft: rgba(255, 255, 255, 0.07);
    --danger: #f08a86;
    --warn-bg: #43330c;
    --warn-text: #f3d48a;
    --focus: #7fb0f5;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0 auto;
  padding: 8px 14px;
  max-width: 1500px;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
h1 { font-size: 18px; margin: 0; font-weight: 650; }
h2 { font-size: 16px; margin: 0; font-weight: 600; }
h3 { font-size: 14px; margin: 14px 0 0; font-weight: 600; }
a { color: inherit; }
.grow { flex: 1; }
.bar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.bar label, .pick label { color: var(--muted); font-size: 13px; }
/* A label and its picker wrap as one piece. */
.pick { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.pick select { min-width: 0; }
.badge { background: var(--warn-bg); color: var(--warn-text); font-size: 12px; padding: 2px 10px; border-radius: 8px; }
.page-error { color: var(--danger); }

select, input, button {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px;
}
select { max-width: 100%; }
button { cursor: pointer; }
button:hover { background: var(--soft); }
button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
button.primary:hover { opacity: 0.88; background: var(--text); }
button[disabled] { opacity: 0.6; cursor: progress; }
select:focus-visible, input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

signal-top10, signal-heatmap, signal-profile { --ss-bg: var(--card); padding: 8px 16px; }
signal-profile { flex: none; }
footer { color: var(--muted); font-size: 12px; }

/* On a screen with room, the whole page is one view: nothing scrolls, and the heat map takes the height that is left. */
@media (min-width: 900px) and (min-height: 700px) {
  body { height: 100dvh; overflow: hidden; }
  signal-top10 { flex: none; }
  signal-heatmap { flex: 1; }
}
/* A provider with a profile shows three views, which is more than one window: that page scrolls. */
@media (min-width: 900px) and (min-height: 700px) {
  body.has-profile { height: auto; min-height: 100dvh; overflow: visible; }
  body.has-profile signal-heatmap { flex: 1 0 auto; min-height: 460px; }
}
/* Smaller screens scroll. The heat map still takes any height left over (a tablet held upright),
   and never drops below a readable height. On a phone it is as tall as its rows. */
@media not ((min-width: 900px) and (min-height: 700px)) {
  body { min-height: 100dvh; }
  signal-heatmap { flex: 1 0 auto; }
}
@media (min-width: 701px) and (max-width: 899.98px), (min-width: 701px) and (max-height: 699.98px) {
  signal-heatmap { min-height: 420px; }
}
@media (max-width: 480px) {
  body { padding: 8px 10px; }
  .pick.wide { flex: 1 1 100%; }
  .pick.wide select { flex: 1; }
}

dialog {
  width: min(620px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.close { border: 0; background: transparent; font-size: 20px; line-height: 1; padding: 2px 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 8px; }
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px;
  background: var(--soft); border-radius: 8px; padding: 10px 12px; margin: 8px 0;
  white-space: pre-wrap; word-break: break-all;
}
.field { margin: 10px 0; }
.field label { display: block; font-size: 13px; margin-bottom: 4px; }
.field input { width: 100%; padding: 6px 10px; }
.err { color: var(--danger); font-size: 13px; margin-top: 4px; }
.err:empty { display: none; }
.err ul { margin: 4px 0 0; padding-left: 18px; }
.actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
