/* The app's colors: navy and mint from the icon, and the status colors of the cards
   (statusColors in ui/theme/Theme.kt). */
:root {
  --navy: #1B1F3B;
  --mint: #7CE0C3;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --text: #1a1d2e;
  --muted: #5b6075;
  --border: #e1e4ee;
  --accent: #127a5e;
  --head-bg: #f6f7fb;
  --yes: #1E8E5A;
  --likely: #2F6FB5;
  --no: #C0392B;
  --unknown: #6B6B75;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11142a;
    --surface: #1B1F3B;
    --text: #e9ebf5;
    --muted: #a5aac4;
    --border: #2c3156;
    --accent: #7CE0C3;
    --head-bg: #20254a;
    --yes: #6FD8A0;
    --likely: #9CCBFF;
    --no: #FF9A8F;
    --unknown: #B8B8C0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Header in the app icon's navy */
.site-header {
  background: var(--navy);
  color: #fff;
  padding: 22px 0 26px;
  border-bottom: 4px solid var(--mint);
}
.header-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 44px; height: 34px; flex: none;
  fill: none; stroke: var(--mint); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round;
}
.site-header h1, .site-title { margin: 0; font-size: 1.7rem; line-height: 1.2; font-weight: 700; }
a.brand { color: inherit; text-decoration: none; }

/* Section menu under the title (home page), centered; the open section is underlined in mint */
.site-header.with-tabs { padding-bottom: 0; border-bottom-width: 1px; border-bottom-color: #2c3156; }
.tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin-top: 16px; }
.tab {
  font: inherit; font-size: 1rem; cursor: pointer; color: #a5aac4;
  background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 16px;
}
.tab:hover, .tab:focus-visible { color: #fff; }
.tab[aria-selected="true"] { color: #fff; font-weight: 600; border-bottom-color: var(--mint); }

/* Last row of the footer: Ad Swap ad on the left and language selector on the right.
   On mobile, both centered: the selector first and the ad below it. */
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px;
}
.ad-swap { border: 0; width: 260px; height: 50px; max-width: 100%; display: block; }
.lang { display: block; }
.lang select {
  font: inherit; font-size: 0.9rem;
  padding: 6px 10px; border-radius: 8px; cursor: pointer;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}

main { padding-bottom: 24px; }

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 22px 18px;
  margin-top: 20px;
}
section h2 {
  font-size: 1.15rem; margin: 18px 0 4px;
  padding-left: 10px; border-left: 4px solid var(--mint);
}
section p { margin: 4px 0 10px; }

.muted { color: var(--muted); }

/* Reported Phones uses the whole width of the page (16px margins) so the columns have room */
main.wrap:has(> #panel-phones:not([hidden])) { max-width: none; }
/* Search box above the table (right corner) and page navigator under it (right corner) */
.table-tools { display: flex; justify-content: flex-end; margin-top: 10px; }
.search {
  font: inherit; font-size: 0.9rem; width: min(100%, 280px);
  padding: 7px 12px; border-radius: 8px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pager { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.pager:empty { display: none; }
.pager button {
  font: inherit; font-size: 0.9rem; min-width: 34px; height: 34px; padding: 0 8px; cursor: pointer;
  border-radius: 8px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.pager button[aria-current="page"] {
  background: var(--accent); color: var(--surface); border-color: var(--accent); font-weight: 600;
}
.pager button:disabled { opacity: 0.4; cursor: default; }
.pager .gap { padding: 0 4px; color: var(--muted); }
.table-scroll { overflow-x: auto; margin-top: 10px; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { background: var(--head-bg); font-weight: 600; color: var(--muted); vertical-align: bottom; }
td.phone { font-weight: 600; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.date { white-space: nowrap; }

/* Column headers: buttons to sort the table; the sorted column is highlighted */
.sort-button {
  font: inherit; color: inherit; font-weight: 600; text-align: inherit; cursor: pointer;
  background: none; border: 0; padding: 0;
}
.sort-button:hover, .sort-button:focus-visible, .sort-button.active { color: var(--accent); }
.sort-arrow { font-size: 0.8em; opacity: 0.6; }
.sort-button.active .sort-arrow { opacity: 1; }

/* Like the app's cards: background in the status color at 15% and text in that color */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; white-space: nowrap;
}
.badge.yes { color: var(--yes); background: color-mix(in srgb, var(--yes) 15%, transparent); }
.badge.likely { color: var(--likely); background: color-mix(in srgb, var(--likely) 15%, transparent); }
.badge.no { color: var(--no); background: color-mix(in srgb, var(--no) 15%, transparent); }
.badge.unknown { color: var(--unknown); background: color-mix(in srgb, var(--unknown) 15%, transparent); }

/* "DACs Tested" cell with several DACs ("+N"), and its dialog */
.dacs-button {
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  background: none; border: 0; padding: 0;
}
.dacs-button .more {
  display: inline-block; margin-left: 2px; padding: 0 8px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap;
  color: var(--accent); border: 1px solid var(--accent);
}
.dacs-button:hover .more, .dacs-button:focus-visible .more { background: var(--accent); color: var(--surface); }
.dacs-dialog {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 64px);
  padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text);
}
.dacs-dialog::backdrop { background: rgba(10, 12, 30, 0.55); }
.dacs-dialog h2 { margin: 0 0 6px; font-size: 1.15rem; }
.dacs-dialog form { text-align: right; margin-top: 14px; }
.table-note { margin: 12px 0 0; font-size: 0.85rem; }

/* Supported Apps: one row per app, with how many phones reported it */
.apps-list { list-style: none; margin: 10px 0 0; padding: 0; }
.apps-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.apps-list li:last-child { border-bottom: 0; }
.apps-list .app-name { font-weight: 600; }
.apps-list a { color: var(--accent); }
.apps-list .muted { font-size: 0.9rem; white-space: nowrap; }
.dialog-close {
  font: inherit; font-weight: 600; cursor: pointer; padding: 6px 18px; border-radius: 8px;
  border: 0; background: var(--accent); color: var(--surface);
}

.footer { padding-top: 4px; padding-bottom: 28px; font-size: 0.85rem; text-align: center; }
.footer p { margin: 0 0 4px; }
/* Wide screens: one row with the ad on the left, the links in the middle and the language on the right */
@media (min-width: 821px) {
  .footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
  .footer-bottom { display: contents; }
  .ad-swap { grid-column: 1; grid-row: 1; justify-self: start; }
  .footer-links { grid-column: 2; grid-row: 1; }
  .lang { grid-column: 3; grid-row: 1; justify-self: end; }
}
.footer a, .back a, .legal a, .help a, .phones td a { color: var(--accent); }

/* Privacy policy and terms */
.back { margin: 16px 0 0; }
.legal { padding-bottom: 22px; }
.legal h1 { font-size: 1.6rem; margin: 18px 0 2px; }
.legal p { max-width: 75ch; }

/* Mobile: language selector above the ad; the three tabs share one row (long names wrap) */
@media (max-width: 600px) {
  .tabs { flex-wrap: nowrap; gap: 0; }
  .tab { flex: 1 1 0; padding: 10px 6px; font-size: 0.92rem; line-height: 1.25; }
  .footer-bottom { flex-direction: column-reverse; }
}
