/* ---------- Tisza Párt brand palette ---------- */
:root {
  --navy-1: #0b1e3f;   /* hero background */
  --navy-2: #0e2a56;   /* card background */
  --navy-3: #162f5b;   /* bar track */
  --navy-4: #1b3a6b;   /* border / divider */
  --gold:   #f0c24b;   /* accent */
  --red:    #e94e4e;   /* Tisza red */
  --green:  #3bd892;   /* Tisza green */
  --white:  #ffffff;
  --muted:  #a9b9d6;
  --tisza-bar: linear-gradient(90deg, #e94e4e 0%, #e94e4e 48%, #ffffff 48%, #ffffff 52%, #3bd892 52%, #3bd892 100%);
}

/* Party row colours — one per relevant jlcs_nev. */
.party-tisza        { --row-color: #ffffff; --row-accent: var(--green); }
.party-fidesz       { --row-color: #ff7a00; }
.party-dk           { --row-color: #1b80c4; }
.party-jobbik       { --row-color: #8a1f2b; }
.party-mihazank     { --row-color: #7a1a1a; }
.party-mkkp         { --row-color: #ff69b4; }
.party-neem         { --row-color: #6b7280; }
.party-fuggetlen    { --row-color: #9aa6c0; }
.party-memo         { --row-color: #4a3a78; }
.party-normalis     { --row-color: #ffc800; }
.party-other        { --row-color: #5d6b87; }

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--navy-1);
  color: var(--white);
  font-family: system-ui, -apple-system, "Segoe UI", "Inter", "Noto Sans", Arial, sans-serif;
  font-feature-settings: "tnum" 1;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* subtle ribbon flourish in the background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(1200px 800px at 80% -10%, rgba(59,216,146,.10), transparent 60%),
              radial-gradient(900px 600px at -10% 110%, rgba(233,78,78,.10), transparent 65%);
  pointer-events: none;
}

#app {
  position: relative;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: clamp(8px, 1.2vh, 16px);
  padding: clamp(10px, 1.8vh, 22px) clamp(14px, 2.2vw, 28px);
}

/* ---------- top header ---------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
}
.logo {
  width: clamp(44px, 5.5vw, 76px);
  height: auto;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.35));
}
.brand-text .kicker {
  font-size: clamp(.75rem, 1.1vw, 1rem);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.brand-text .title {
  font-size: clamp(1.2rem, 2.1vw, 2rem);
  font-weight: 800;
  line-height: 1.05;
}
.clock {
  text-align: right;
}
#clock-time {
  font-size: clamp(1.3rem, 2.3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: .02em;
}
.meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .6em;
  font-size: clamp(.7rem, 1vw, .9rem);
  color: var(--muted);
}
.badge {
  background: var(--red);
  color: white;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .72em;
}
.badge.demo { background: var(--gold); color: #3b2b00; }

/* ---------- progress section ---------- */
.progress-wrap {
  background: var(--navy-2);
  border: 1px solid var(--navy-4);
  border-radius: 14px;
  padding: clamp(10px, 1.4vh, 16px) clamp(14px, 1.8vw, 22px);
}
.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 600;
  font-size: clamp(.85rem, 1.2vw, 1.05rem);
  margin-bottom: 6px;
}
.progress-label.small {
  font-size: clamp(.75rem, 1vw, .9rem);
  color: var(--muted);
  margin-top: 8px;
  margin-bottom: 0;
}
#feldar-num { font-size: clamp(1rem, 1.6vw, 1.4rem); font-weight: 800; }
.bar-track {
  position: relative;
  height: clamp(10px, 1.6vh, 16px);
  background: var(--navy-3);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--red), var(--white) 50%, var(--green));
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(.3,.8,.3,1);
}

/* ---------- view stage ---------- */
.view-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  border-radius: 14px;
  padding: clamp(8px, 1.2vh, 14px) clamp(10px, 1.2vw, 16px) clamp(6px, 1vh, 10px);
}
/* Primary (OEVK-összesítés) view: tisza-brand kiemelés. A kártya bal oldala
   piros, a jobb zöld — mint a logó szalagja. A secondary nézetek direkt
   plainerek, hogy visszatérve az OEVK mindig erősebbnek látsszon.
   A gradient háttér pseudo-element-en ül, hogy az állapotváltás smoothly
   opacity-fade-el, ne ugorjon. */
.view-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(90deg,
      rgba(233,78,78,.14)  0%,
      rgba(233,78,78,.04)  35%,
      rgba(59,216,146,.04) 65%,
      rgba(59,216,146,.14) 100%);
  border: 1px solid rgba(59,216,146,.45);
  box-shadow:
    0 0 0 1px rgba(59,216,146,.10) inset,
    0 0 24px rgba(59,216,146,.14),
    0 0 24px rgba(233,78,78,.10);
  opacity: 0;
  transition: opacity .7s ease;
  z-index: 0;
}
.view-stage.primary::before { opacity: 1; }
.view-stage > * { position: relative; z-index: 1; }
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: clamp(6px, 1vh, 12px);
}
.view-titles { min-width: 0; }
.view-kicker {
  font-size: clamp(.65rem, .95vw, .8rem);
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 2px;
  /* ribbon gradient szöveg — a primary/secondary közti különbséget nem
     gradient-cserével, hanem opacity-vel oldjuk, hogy fade-elődjön */
  background: linear-gradient(90deg, var(--red), var(--white) 50%, var(--green));
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
  opacity: .55;
  transition: opacity .7s ease;
}
.view-stage.primary .view-kicker { opacity: 1; }
.view-header h2 {
  margin: 0;
  font-size: clamp(1.05rem, 1.9vw, 1.7rem);
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--muted);
  /* match the shadow count of the primary state so browsers interpolate
     smoothly between them instead of snapping */
  text-shadow: 0 0 0 rgba(59,216,146,0), 0 0 0 rgba(233,78,78,0);
  transition: color .7s ease, text-shadow .7s ease;
}
/* Don't change font-size between primary and secondary — that reflows the
   view-header height and pushes the candidates list, which reads as a jump.
   Emphasis comes from the color + glow pseudo + text-shadow only. */
.view-stage.primary .view-header h2 {
  color: var(--white);
  text-shadow: 0 0 14px rgba(59,216,146,.28), 0 0 14px rgba(233,78,78,.18);
}
.view-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.view-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--navy-4);
  transition: background .3s, transform .3s;
}
.view-dots .dot.primary {
  width: 14px;
  border-radius: 3px;    /* a wider pill marks the headline slots */
  background: linear-gradient(90deg, var(--red), var(--green));
  opacity: .5;
}
.view-dots .dot.active {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(59,216,146,.18);
}
.view-dots .dot.primary.active {
  background: linear-gradient(90deg, var(--red), var(--green));
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(59,216,146,.22), 0 0 0 3px rgba(233,78,78,.10);
}

/* ---------- candidates list ---------- */
.candidates {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(4px, .9vh, 10px);
  overflow: hidden;
}
.row {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  background: var(--navy-2);
  border: 1px solid var(--navy-4);
  border-radius: 12px;
  padding: clamp(6px, .9vh, 10px) clamp(10px, 1.2vw, 16px);
  overflow: hidden;
  transition: opacity .7s ease, border-color .7s ease, background .7s ease;
}
.row.leader {
  background: linear-gradient(90deg, rgba(59,216,146,.18), var(--navy-2) 55%);
  border-color: rgba(59,216,146,.55);
}
/* In primary (headline) view the leader gets a stronger red→green ribbon
   overlay echoing the Tisza logo. Rendered as a pseudo-element so it fades
   in/out smoothly instead of snapping when the view type changes. */
.row.leader::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(90deg,
    rgba(233,78,78,.22) 0%,
    rgba(255,255,255,.08) 45%,
    rgba(59,216,146,.22) 100%);
  border: 1px solid rgba(59,216,146,.60);
  box-shadow: 0 0 28px rgba(59,216,146,.16), 0 0 28px rgba(233,78,78,.10);
  opacity: 0;
  transition: opacity .7s ease;
  z-index: 0;
}
.view-stage.primary .row.leader::after { opacity: 1; }
.row > * { position: relative; z-index: 1; }
/* Secondary views are rendered a touch dimmer so the eye registers them as
   supporting context, not the main number. */
.view-stage:not(.primary) .row {
  opacity: .88;
}
.row::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--row-color, var(--navy-4));
  z-index: 2;   /* stay above the primary-leader ::after overlay */
}
.photo {
  width: clamp(38px, 4.2vw, 62px);
  height: clamp(38px, 4.2vw, 62px);
  border-radius: 50%;
  background: var(--navy-3);
  object-fit: cover;
  border: 2px solid var(--row-color, var(--navy-4));
  flex-shrink: 0;
}
.photo.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: clamp(.8rem, 1.2vw, 1.1rem);
  color: var(--muted);
}
.info {
  min-width: 0;
}
.info .name {
  font-size: clamp(.95rem, 1.4vw, 1.25rem);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.info .party {
  font-size: clamp(.7rem, 1vw, .9rem);
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.info .rowbar {
  margin-top: 5px;
  height: clamp(5px, .9vh, 8px);
  background: var(--navy-3);
  border-radius: 999px;
  overflow: hidden;
}
.info .rowbar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--row-color, var(--green));
  border-radius: 999px;
  transition: width .8s cubic-bezier(.3,.8,.3,1);
}
.score {
  text-align: right;
  min-width: clamp(56px, 7vw, 92px);
}
.score .pct {
  font-size: clamp(1.1rem, 1.9vw, 1.6rem);
  font-weight: 800;
  line-height: 1;
}
.score .votes {
  font-size: clamp(.65rem, .95vw, .82rem);
  color: var(--muted);
  margin-top: 2px;
}
.score .pct.empty { color: var(--muted); font-weight: 600; }

/* ---------- footer ---------- */
.bottom {
  display: flex;
  justify-content: space-between;
  font-size: clamp(.65rem, .95vw, .82rem);
  color: var(--muted);
  border-top: 1px solid var(--navy-4);
  padding-top: clamp(4px, .7vh, 8px);
}

/* ---------- loading / transitions ---------- */
#app.loading .candidates,
#app.loading .progress-wrap { opacity: .35; }
/* Plain opacity fade for view crossfades — no translate, so nothing shifts. */
.candidates { transition: opacity .35s ease; }
.fade-out { opacity: 0; }

/* ---------- tiny screens / very narrow ---------- */
@media (max-width: 640px) {
  .top { flex-direction: column; align-items: flex-start; gap: 4px; }
  .clock { text-align: left; }
  .meta { justify-content: flex-start; }
  .info .party { display: none; }
}
