/* The UA page (/ua, Components/Pages/Ua.razor). Palette tokens of app.css only, plus two shades of ember for the
   "opened players" series, chosen with the dataviz validator against both themes' panels: dark #4C86EA (cobalt tint)
   + #E35500 (ember shade) and light #0A4FC2 + #C24700 pass the lightness band, CVD separation and 3:1 contrast. */

:root {
  --ua-installs: var(--cobalt-tint);
  --ua-opened: #E35500;
  --ua-spend: var(--gold);
  --ua-fresh: var(--moss-tint);
  --ua-stale: var(--red-tint);
}

:root[data-theme="light"] {
  --ua-installs: #0A4FC2;
  --ua-opened: #C24700;
  --ua-spend: var(--copper);
  --ua-fresh: var(--forest);
  --ua-stale: var(--red-danger);
}

.ua-header { align-items: flex-end; }
.ua-range { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; }
.ua-range input[type="date"] {
  padding: 0.45rem 0.6rem; border-radius: 4px; border: 2px solid var(--rim-shadow);
  background: var(--input-bg); color: var(--text); font: inherit; font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--keyline); color-scheme: inherit;
}

.ua-freshness { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; }
.ua-fresh {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--ua-fresh); color: var(--ua-fresh); background: var(--panel-recess); font-size: 0.85rem; white-space: nowrap;
}
.ua-fresh.stale { border: 2px solid var(--ua-stale); color: var(--ua-stale); }

.ua-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; margin: 0 0 1.1rem; }
.ua-tile { padding: 0.75rem 0.85rem; min-width: 0; }
.ua-tile .value { font-size: 1.3rem; line-height: 1.2; overflow-wrap: anywhere; }
.ua-tile .hint { line-height: 1.35; overflow-wrap: anywhere; }

/* table.data (app.css) sets its cells' padding and header type at 0,1,2; these rules name it too so they win. */
table.data.ua-table { font-size: 0.8rem; }
/* 17 campaign columns (three of them AppsFlyer's) fit the 1440 px page's panel with this padding and header sub-line. */
table.data.ua-table th, table.data.ua-table td { padding: 0.36rem 0.3rem; }
table.data.ua-table th { white-space: normal; vertical-align: bottom; font-size: 0.64rem; letter-spacing: 0.02em; }
.ua-line { display: block; white-space: nowrap; }
table.data.ua-table th .ua-sub { text-transform: none; letter-spacing: 0; font-family: var(--font-text); font-size: 0.66rem; }
table.data.ua-table td { white-space: nowrap; }
table.data.ua-table td.ua-campaign { white-space: normal; min-width: 10rem; max-width: 15rem; }
.ua-table .chip { font-size: 0.7rem; padding: 0.05rem 0.45rem; }
table.data.ua-table td.ua-country { white-space: normal; min-width: 8rem; max-width: 13rem; }
.ua-sub { display: block; font-size: 0.74rem; color: var(--text-muted); font-weight: 600; white-space: normal; }
.ua-table tr.ua-dim td { color: var(--text-muted); }
.ua-table tr.ua-dim td strong { color: var(--text); }
.ua-pace { color: var(--text-muted); white-space: nowrap; }
.ua-pace.over { color: var(--ua-stale); }

.ua-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.ua-chart { margin: 0; min-width: 0; }
.ua-chart figcaption { font-family: var(--font-display); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--heading); margin-bottom: 0.35rem; }
.ua-svg { width: 100%; height: auto; display: block; overflow: visible; }
.ua-svg .grid { stroke: var(--stone-edge); stroke-width: 1; }
.ua-svg .axis { stroke: var(--text-muted); stroke-width: 1; }
.ua-svg .tick { fill: var(--text-muted); font-family: var(--font-text); font-size: 11px; font-weight: 600; }
.ua-svg .end-label { fill: var(--text); font-family: var(--font-text); font-size: 11px; font-weight: 700; }
.ua-svg .bar { fill: var(--ua-spend); }
.ua-svg .hit { fill: transparent; }
.ua-svg .day:hover .hit { fill: var(--stone-hover); }
.ua-svg .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ua-svg .series.installs { stroke: var(--ua-installs); }
.ua-svg .series.opened { stroke: var(--ua-opened); }
.ua-svg .marker { stroke: var(--panel); stroke-width: 2; }
.ua-svg .marker.installs { fill: var(--ua-installs); }
.ua-svg .marker.opened { fill: var(--ua-opened); }
.ua-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.ua-legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.ua-legend .key.installs { background: var(--ua-installs); }
.ua-legend .key.opened { background: var(--ua-opened); margin-left: 0.6rem; }
.ua-daily { margin-top: 0.75rem; }

/* AppsFlyer's attributed columns sit on the panel's recess so they read apart from the blended ones. */
table.data.ua-table th.ua-af, table.data.ua-table td.ua-af { background: var(--panel-recess); }
.ua-subhead { font-family: var(--font-display); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--heading); margin: 1rem 0 0.4rem; }
/* Where AppsFlyer's numbers start: said once above the AppsFlyer table and under the campaign table. */
.ua-af-start { margin: 0 0 0.6rem; font-size: 0.88rem; font-weight: 600; color: var(--text); }
p.help.ua-af-start { margin-top: 0.35rem; }

.ua-unity { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.ua-unity .value.small { font-size: 1rem; word-break: normal; }

.ua-notes { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; font-size: 0.88rem; }
.ua-notes strong { color: var(--heading); }

@media (max-width: 700px) {
  .ua-range { width: 100%; }
  .ua-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ua-charts { grid-template-columns: 1fr; }
}
