/* =========================================
   THEME TOKENS
   - default: LIGHT
   - dark: [data-theme="dark"]
========================================= */

:root{
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --text: #0f172a;
  --muted: #64748b;

  --border: #e5e7eb;
  --shadow: 0 10px 28px rgba(15, 23, 42, .08);

  --blue: #1e3a8a;
  --blue2: #2563eb;

  --green: #16a34a;
  --red: #dc2626;

  --btn-bg: #ffffff;
  --btn-text: #0f172a;
  --btn-hover: #f1f5f9;

  --topbar-bg: #ffffff;
  --topbar-border: #e5e7eb;
}

html[data-theme="dark"]{
  --bg: #070b18;
  --card-bg: rgba(255,255,255,.04);
  --text: #eaf0ff;
  --muted: rgba(234,240,255,.75);

  --border: rgba(255,255,255,.10);
  --shadow: 0 18px 42px rgba(0,0,0,.45);

  --btn-bg: rgba(255,255,255,.06);
  --btn-text: #eaf0ff;
  --btn-hover: rgba(255,255,255,.10);

  --topbar-bg: rgba(8,12,26,.85);
  --topbar-border: rgba(255,255,255,.10);
}

/* =========================================
   BASE
========================================= */

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background: var(--bg);
  color: var(--text);
}

a{ color: var(--blue2); text-decoration:none; }
a:hover{ text-decoration:underline; }

.container{
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.muted{ color: var(--muted); font-size:14px; }

/* =========================================
   TOPBAR / NAV
========================================= */

.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  backdrop-filter: blur(10px);
}

.topbar__inner{
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 16px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 240px;
}
.brand__logo{
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--blue);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 800;
  letter-spacing:.5px;
}
.brand__title{
  display:flex;
  flex-direction:column;
  line-height:1.15;
}
.brand__title b{ font-size:16px; }
.brand__title span{ font-size:13px; color: var(--muted); }

.nav{
  display:flex;
  align-items:center;
  gap: 12px;
  flex-wrap:wrap;
}

/* =========================================
   CARDS / GRID
========================================= */

.grid{ display:grid; gap: 16px; }
.grid--2{ grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid--3{ grid-template-columns: repeat(3, minmax(0,1fr)); }

.card{
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.card__title{
  margin:0 0 10px;
  font-size:18px;
  font-weight:700;
}

/* =========================================
   BUTTONS
========================================= */

.btn{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor:pointer;
  font-weight: 600;
  text-decoration:none;
  user-select:none;
}
.btn:hover{ background: var(--btn-hover); text-decoration:none; }
.btn:disabled{ opacity:.55; cursor:not-allowed; }

.btn--primary{
  background: var(--blue);
  border-color: var(--blue);
  color:#fff;
}
.btn--primary:hover{ background: var(--blue2); border-color: var(--blue2); }

.btn--danger{
  background: transparent;
  border-color: rgba(220,38,38,.55);
  color: var(--red);
}
.btn--danger:hover{ background: rgba(220,38,38,.10); }

.btn--ghost{ background: transparent; }

/* =========================================
   INPUTS
========================================= */

.label{ font-size:13px; color: var(--muted); margin-bottom: 6px; }
.input{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
}
.input:focus{ outline:none; border-color: rgba(37,99,235,.6); }

/* =========================================
   BADGES / ALERTS
========================================= */

.badge{
  display:inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: rgba(15,23,42,.04);
}
html[data-theme="dark"] .badge{ background: rgba(255,255,255,.06); }

.alert{
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.alert--ok{
  background: rgba(22,163,74,.12);
  border-color: rgba(22,163,74,.28);
  color: var(--text);
}
.alert--err{
  background: rgba(220,38,38,.12);
  border-color: rgba(220,38,38,.28);
  color: var(--text);
}

/* =========================================
   TABLE
========================================= */

.table{ width:100%; border-collapse:collapse; }
.table th, .table td{
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align:left;
  vertical-align:top;
}
.table th{ font-size:13px; color: var(--muted); }

/* =========================================
   FOOTER
========================================= */

.footer{
  margin-top: 26px;
  padding: 18px 0;
  color: var(--muted);
  font-size: 13px;
}
/* =========================
   FIX: spacing + container + nav pills + responsive
   (drop-in patch)
========================= */

/* по-приятен ритъм */
.container{
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 22px;
}

/* топбарът да не е като "текстови линкове" */
.topbar__inner{
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 18px;
}

/* brand да не бута всичко */
.brand{ min-width: unset; }
.brand__title b{ font-size: 16px; }
.brand__title span{ margin-top: 2px; }

/* NAV: pill buttons */
.nav{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ако менюто ти са <a> без клас .btn -> стил като pill */
.nav a{
  display:inline-flex;
  align-items:center;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-weight: 600;
  text-decoration:none;
}

.nav a:hover{
  background: var(--btn-hover);
  text-decoration:none;
}

/* активна страница (ако си сложил class="active" на линка) */
.nav a.active{
  border-color: rgba(37,99,235,.35);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* бутонът за тема да е като другите */
#themeToggle{
  border-radius: 999px;
  padding: 9px 14px;
}

/* да не изглежда "разтеглено" – картите да имат еднакъв въздух */
.grid{ gap: 18px; }
.card{ padding: 20px; }
.card__title{ margin-bottom: 12px; }

/* cards да не стават прекалено ниски/високи */
.card p{ margin: 0; }
.card .muted{ line-height: 1.45; }

/* responsive: 3->2->1 */
@media (max-width: 1100px){
  .grid--3{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 780px){
  .grid--2, .grid--3{ grid-template-columns: 1fr; }
  .topbar__inner{ flex-direction: column; align-items: stretch; }
  .nav{ justify-content: flex-start; }
}

/* dark mode: nav pills да не се губят */
html[data-theme="dark"] .nav a{
  background: rgba(255,255,255,.06);
}
html[data-theme="dark"] .nav a:hover{
  background: rgba(255,255,255,.10);
}
/* =========================
   FOOTER – fixed, centered, clean
========================= */

.footer{
  margin-top: 48px;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  background: transparent;
}

.footer__inner{
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.footer__inner div{
  font-size: 13px;
  color: var(--muted);
}

.footer__inner a{
  color: var(--blue2);
  text-decoration: none;
  font-weight: 500;
}

.footer__inner a:hover{
  text-decoration: underline;
}
/* =========================
   FIX: cards not stretched edge-to-edge
========================= */

/* 1) стягаме страницата */
.container{
  max-width: 1040px;     /* беше прекалено широко */
  margin: 0 auto;
  padding: 28px 18px;
}

/* 2) grid-овете да имат нормален “ритъм” */
.grid{
  gap: 18px;
}

/* 3) вместо фиксирани 3 колони, правим адаптивни с минимум ширина */
.grid--3{
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* 4) за 2 колони пак адаптивно */
.grid--2{
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

/* 5) картите да не изглеждат като огромни плочи */
.card{
  padding: 20px;
}

.card__title{
  font-size: 18px;
  margin-bottom: 10px;
}
/* =========================
   FIX: wrap width + cards stretching
========================= */

/* твоя layout ползва .wrap, не .container */
.wrap{
  max-width: 1040px;     /* стегнато, не "банери" */
  margin: 0 auto;
  padding: 28px 18px;
}

/* topbar да НЕ взима padding-а на main */
.topbar .wrap{
  padding-top: 14px;
  padding-bottom: 14px;
}

/* grid да е адаптивен, не фиксиран 3 колони на всяка цена */
.grid{
  gap: 18px;
}

.grid--3{
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid--2{
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

/* картите да не изглеждат "разтеглени" */
.card{
  padding: 20px;
}

.card__title{
  margin: 0 0 10px;
  font-size: 18px;
}
.nav__link{
  display:inline-flex;
  align-items:center;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-weight: 600;
  text-decoration:none;
}

.nav__link:hover{
  background: var(--btn-hover);
  text-decoration:none;
}

.nav__link--danger{
  border-color: rgba(220,38,38,.45);
  color: #dc2626;
}

.nav__link--danger:hover{
  background: rgba(220,38,38,.10);
}
.stat__num { font-size: 26px; font-weight: 800; }

.stat--for .stat__num { color: #16a34a; }
.stat--against .stat__num { color: #dc2626; }
.stat--abstain .stat__num { color: #475569; }

.cell--for { color:#16a34a; font-weight:700; }      /* зелено */
.cell--against { color:#dc2626; font-weight:700; }  /* червено */
.cell--abstain { color:#475569; font-weight:700; }  /* неутрално */

