/* Serbian Election Roll Monitor - Clean Modern Stylesheet */
:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-header: #0f172a;
  --border-color: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-header: #f8fafc;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;

  /* Severity colors */
  --sev-extreme-bg: #fee2e2;
  --sev-extreme-text: #991b1b;
  --sev-extreme-border: #fca5a5;

  --sev-high-bg: #ffedd5;
  --sev-high-text: #9a3412;
  --sev-high-border: #fdba74;

  --sev-watch-bg: #fef9c3;
  --sev-watch-text: #854d0e;
  --sev-watch-border: #fde047;

  --sev-normal-bg: #f1f5f9;
  --sev-normal-text: #475569;
  --sev-normal-border: #cbd5e1;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 15px;
}

/* Header & Nav */
header {
  background-color: var(--bg-header);
  color: var(--text-header);
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #334155;
}

.nav-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand span {
  font-size: 0.75rem;
  font-weight: 500;
  background: #334155;
  padding: 2px 6px;
  border-radius: 4px;
  color: #94a3b8;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 0.5rem;
  flex-wrap: wrap;
}

nav a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}

nav a:hover, nav a.active {
  background-color: #1e293b;
  color: #fff;
}

/* Layout */
main {
  max-width: 1440px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* Cards & Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 0.25rem;
}

.stat-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Content Container */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  margin-bottom: 1.5rem;
}

.card-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
}

/* Responsive Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
  background: transparent;
}

.table-responsive::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
  min-width: 860px;
}

th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

th a {
  color: inherit;
  text-decoration: none;
}

th a:hover {
  color: var(--accent);
}

td {
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

tr:hover td {
  background-color: #f8fafc;
}

/* Table Column Controls */
.col-mun {
  min-width: 140px;
  max-width: 220px;
  white-space: normal;
  word-break: break-word;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.score-col {
  min-width: 70px;
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}

.sev-col {
  min-width: 95px;
  text-align: center;
  white-space: nowrap;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-extreme {
  background-color: var(--sev-extreme-bg);
  color: var(--sev-extreme-text);
  border: 1px solid var(--sev-extreme-border);
}

.badge-high {
  background-color: var(--sev-high-bg);
  color: var(--sev-high-text);
  border: 1px solid var(--sev-high-border);
}

.badge-watch {
  background-color: var(--sev-watch-bg);
  color: var(--sev-watch-text);
  border: 1px solid var(--sev-watch-border);
}

.badge-normal {
  background-color: var(--sev-normal-bg);
  color: var(--sev-normal-text);
  border: 1px solid var(--sev-normal-border);
}

.badge-info {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* Alerts / Notices */
.alert {
  padding: 0.85rem 1.15rem;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.alert-info {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.alert-warning {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

/* Filters */
.filters-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}

.filter-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

.filter-btn.active, .filter-btn:hover {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
}

/* Media Queries for Responsive Screens */
@media (max-width: 1024px) {
  main {
    padding: 0 0.75rem;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .page-title {
    font-size: 1.3rem;
  }
}
