/* Content styles for the public "Spisak adresa" page (address_voter_counts.html). Since that page
   moved into the app shell, this file no longer defines design tokens or a body reset —
   app.css owns those (its public-page bridge maps --text/--panel/--accent/… onto the app
   palette). What remains here is the voters master–detail layout + table, all scoped so it
   can't touch the shared #topbar. */

html, body { height: 100%; }
/* The voters page is a full-height flex app (intro header + master/detail below); the
   rail's body padding-left/top (app.css .has-rail) sits outside this column. */
body { display: flex; flex-direction: column; height: 100vh; }

.voters-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
/* On large screens the header splits into columns; the intro takes the lion's share.
   It used to be three equal thirds (intro | coverage stats | download), but the stats
   column is gone and an equal split left the note cramped next to a single link. */
.voters-head > * { flex: 1 1 0; min-width: 0; }
.voters-head #intro { flex: 3 1 0; }
/* Naslov nosi i izbornik opštine (vidi address_voter_counts.html). Flex, da izbornik stoji u istom redu
   i da ne nasledi veličinu/debljinu naslovnog slova; wrap, jer na uskom ekranu naslov i
   izbornik ne staju jedan pored drugog. */
.voters-head h1 {
  font-size: 18px; margin: 0;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
.voters-head h1 #muni-picker { font-size: 13px; font-weight: 400; max-width: 100%; }
/* Ista mera kao uvodni tekst na mapi (#panel .intro u map.css) — dve strane, isti glas. */
.intro p { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 4px 0 0; }

.voters-main { flex: 1 1 auto; display: flex; min-height: 0; }

#sidebar {
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  min-height: 0;
}

.picker-controls { padding: 10px; border-bottom: 1px solid var(--border); }
.picker-controls input[type="search"] {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.settlement-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.settlement-list li {
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.settlement-list li:hover { background: var(--accent-soft); }
.settlement-list li.active { background: var(--accent); color: #fff; }
.settlement-list li.active .count { color: rgba(255, 255, 255, 0.72); }
.settlement-list li .count { font-size: 12px; color: var(--muted); }

#content { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 16px; }

.loading {
  margin: auto;
  color: var(--muted);
  font-size: 15px;
}

#tableView { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.table-header h2 { margin: 0 0 2px; font-size: 17px; }
/* Back-to-list control: desktop keeps the side-by-side picker, so hide it. */
.back-btn {
  display: none;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.back-btn:hover { background: var(--accent-soft); }
.meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; }

/* Download links: subtle button styling, reused in the intro and table header. */
.download-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  margin: 4px 0px;
  text-decoration: none;
  cursor: pointer;
}
.download-link:hover { background: var(--accent-soft); }
.downloads { margin: 6px 0 0; }
.intro .download-link { font-size: 11px; padding: 4px 8px; }
/* Links column of the header: stack the buttons vertically, left-aligned. */
.header-links { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.table-header .download-link { font-size: 13px; margin-bottom: 12px; }

.filters { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.filters input[type="search"] {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  width: 220px;
}
.row-summary { color: var(--muted); font-size: 13px; margin-left: auto; }

.scroller {
  flex: 1 1 auto;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  position: relative;
}

table { border-collapse: collapse; width: 100%; }
thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  border-bottom: 2px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  z-index: 1;
}
thead th:hover { background: var(--accent-soft); }
thead th .arrow { color: var(--accent); }
thead th .arrow .bs-ico { vertical-align: -2px; }
thead th.num { text-align: right; }

tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
}
tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Kolona „Moja lista” ----
   Dugmad stoje u svakom redu, pa moraju da budu tiha: bez ispune, u boji akcenta, i da ne
   podignu visinu reda (virtualizacija računa sa ~29px — vidi state.rowHeight). */
thead th.act { cursor: default; text-align: right; }
thead th.act:hover { background: var(--panel); }
tbody td.act { text-align: right; white-space: nowrap; padding: 2px 10px; }

.act-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--accent);
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
}
/* Ikonica u redu tabele: bez pomeranja na osnovnu liniju (red je visok ~29px — vidi
   state.rowHeight), poravnanje radi flex kontejner. */
.act-btn .bs-ico, .act-on .bs-ico { vertical-align: 0; }
.act-btn + .act-btn { margin-left: 4px; }
.act-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.act-btn:disabled { opacity: .5; cursor: default; }
/* „+ ulica” je grupna radnja — vizuelno slabija od „+”, da se ne klikne uzgred. */
.act-btn-ghost { color: var(--muted); font-weight: 500; }
.act-btn-ghost:hover { color: var(--accent); }

.act-on { display: inline-flex; align-items: center; vertical-align: middle; color: var(--ok); }
.act-note { color: var(--muted); }

/* Ishod dodavanja / poziv na prijavu, iznad tabele. */
.list-notice {
  margin: 0 0 10px; padding: 8px 10px; border-radius: 6px;
  font-size: 13px; border: 1px solid var(--border); background: var(--panel);
}
.list-notice a { color: inherit; font-weight: 600; }
.list-notice.ok { background: var(--ok-tint); border-color: var(--ok-border); color: var(--ok); }
/* „info” je ovde poziv na prijavu, a ne stanje podatka — zato mirna, mastiljava traka, bez
   plavog tona. Boje (zelena/žuta/crvena) nose ishod dodavanja i ostaju. */
.list-notice.info { background: var(--surface); border-color: var(--border); color: var(--text); }
.list-notice.warn { background: var(--warn-tint); border-color: var(--warn-border); color: var(--warn); }
.list-notice.err { background: var(--bad-tint); border-color: var(--bad-border); color: var(--bad); }
tbody tr:nth-child(even) td { background: var(--row-alt); }
/* Red označen dubokim linkom iz izveštaja */
tbody tr.hl-row td { background: var(--warn-tint) !important; box-shadow: inset 0 0 0 1px var(--warn); }

/* ---- Mobile / narrow screens ---- */
@media (max-width: 768px) {
  /* Stack the settlement picker above the table; both keep their own internal
     scroll so the virtualized table container stays bounded. */
  .voters-main { flex-direction: column; }

  .voters-head {
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 10px 14px;
  }
  .voters-head > * { flex: 1 1 100%; }

  #sidebar {
    flex: 0 0 auto;
    width: 100%;
    max-height: 38vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  /* Master–detail on mobile: once a settlement is picked, hide the picker
     entirely and give the whole viewport to the address table. The back
     button returns to the list. */
  body.has-selection #sidebar { display: none; }
  body.has-selection .back-btn { display: inline-flex; }

  /* Hide the intro blurb (keep the title) once browsing a settlement
     to free vertical space. */
  body.has-selection #intro p { display: none; }

  #content { padding: 12px; }

  .settlement-list li { padding: 10px 12px; }

  /* Full-width filters; 16px font avoids iOS zoom-on-focus */
  .picker-controls input[type="search"],
  .filters input[type="search"] { font-size: 16px; }

  .filters input[type="search"] { width: 100%; flex: 1 1 140px; }
  .row-summary { margin-left: 0; }

  /* Let the wide table scroll sideways with momentum on iOS */
  .scroller {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Sedam kolona ne staje u telefon, pa tabela ide u stranu — a „Moja lista” je upravo ono
     zbog čega se ova strana otvara na terenu. Zato se kolona akcija zakači za desnu ivicu i
     ostaje pod prstom bez bočnog skrolovanja. Zaglavlje je lepljivo u oba pravca (gore od
     `thead th`, desno odavde), pa mu treba viši sloj od ćelija. */
  thead th.act, tbody td.act {
    position: sticky;
    right: 0;
    background: var(--panel);
    box-shadow: inset 1px 0 0 var(--border);
  }
  tbody td.act { z-index: 1; }
  thead th.act { z-index: 2; }
  /* Zebra mora da se ponovi na lepljivoj ćeliji: `tr:nth-child(even) td` je iscrtava, ali
     ovde je pregazi neprozirna pozadina iznad. */
  tbody tr:nth-child(even) td.act { background: var(--row-alt); }
}
