/* ─── ballot.css — Ballot page styles ─────────────────────────────────────── */

/* ── Demo banner ──────────────────────────────────────────────────────────── */
.ballot-demo-banner {
  background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 100%);
  color: #fff;
  text-align: center;
  padding: 10px 20px;
  font-size: 13px;
  letter-spacing: 0.01em;
  margin-bottom: 0;
}

/* ── Masthead ─────────────────────────────────────────────────────────────── */
.ballot-masthead {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.ballot-masthead-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ballot-masthead-icon {
  font-size: 36px;
  line-height: 1;
  flex-shrink: 0;
}

.ballot-masthead-title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 20px;
  font-weight: 900;
  color: #111827;
  margin: 0 0 6px;
  line-height: 1.2;
}

.ballot-masthead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.ballot-meta-chip {
  font-size: 12px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 3px 10px;
  border-radius: 20px;
}

.ballot-masthead-counts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.ballot-count-chip {
  font-size: 13px;
  font-weight: 600;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 5px 14px;
  border-radius: 20px;
  white-space: nowrap;
}

.ballot-count-chip--measure {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

/* ── Polling card ─────────────────────────────────────────────────────────── */
.ballot-polling-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.ballot-polling-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.ballot-polling-info {
  flex: 1;
  min-width: 0;
}

.ballot-polling-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #15803d;
  margin-bottom: 2px;
}

.ballot-polling-name {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.ballot-polling-meta {
  font-size: 13px;
  color: #374151;
  margin-top: 2px;
}

.ballot-polling-notes {
  font-size: 12px;
  color: #6b7280;
  margin-top: 3px;
}

.ballot-polling-dir {
  font-size: 13px;
  font-weight: 600;
  color: #15803d;
  text-decoration: none;
  white-space: nowrap;
  background: #fff;
  border: 1px solid #bbf7d0;
  padding: 7px 14px;
  border-radius: 8px;
  transition: background 0.15s;
}

.ballot-polling-dir:hover { background: #dcfce7; }

/* ── Contest groups ───────────────────────────────────────────────────────── */
.ballot-group {
  margin-bottom: 28px;
}

.ballot-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 12px;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 16px;
}

.ballot-group-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ballot-group-icon {
  font-size: 22px;
  line-height: 1;
}

.ballot-group-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.01em;
}

.ballot-group-sub {
  font-size: 12px;
  color: #6b7280;
  margin-top: 1px;
}

.ballot-group-count {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
}

/* Group accent colors */
.ballot-group--federal .ballot-group-header { border-color: #1E3A5F; }
.ballot-group--federal .ballot-group-title  { color: #1E3A5F; }
.ballot-group--state .ballot-group-header   { border-color: #166534; }
.ballot-group--state .ballot-group-title    { color: #166534; }
.ballot-group--local .ballot-group-header   { border-color: #5b21b6; }
.ballot-group--local .ballot-group-title    { color: #5b21b6; }
.ballot-group--judges .ballot-group-header  { border-color: #374151; }
.ballot-group--judges .ballot-group-title   { color: #374151; }
.ballot-group--measures .ballot-group-header { border-color: #b45309; }
.ballot-group--measures .ballot-group-title  { color: #b45309; }

.ballot-group-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Contest card ─────────────────────────────────────────────────────────── */
.ballot-contest-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.ballot-contest-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  background: #fafafa;
  border-bottom: 1px solid #f0f0f0;
}

.ballot-contest-office {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}

.ballot-contest-district {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

.ballot-contest-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Level badges */
.ballot-level-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.ballot-level-badge--country         { background: #dbeafe; color: #1E3A5F; }
.ballot-level-badge--administrativeArea1 { background: #dcfce7; color: #166534; }
.ballot-level-badge--administrativeArea2 { background: #f3f4f6; color: #374151; }
.ballot-level-badge--locality         { background: #ede9fe; color: #5b21b6; }

/* Retention / seats notices */
.ballot-retention-notice,
.ballot-seats-notice {
  margin: 10px 18px 0;
  font-size: 12.5px;
  color: #374151;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 7px 12px;
}

/* ── Candidates grid ──────────────────────────────────────────────────────── */
.ballot-candidates-grid {
  display: grid;
  gap: 0;
  padding: 0;
}

.ballot-candidates-grid--1up { grid-template-columns: 1fr; }
.ballot-candidates-grid--2up { grid-template-columns: 1fr 1fr; }
.ballot-candidates-grid--3up { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 640px) {
  .ballot-candidates-grid--2up,
  .ballot-candidates-grid--3up { grid-template-columns: 1fr; }
}

/* ── Candidate card ───────────────────────────────────────────────────────── */
.ballot-candidate-card {
  display: flex;
  position: relative;
  border-right: 1px solid #f0f0f0;
  padding: 16px 18px;
  gap: 0;
}

.ballot-candidate-card:last-child { border-right: none; }

/* Party stripe */
.ballot-candidate-party-stripe {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0;
}

.ballot-candidate-card--dem  .ballot-candidate-party-stripe { background: #1d4ed8; }
.ballot-candidate-card--rep  .ballot-candidate-party-stripe { background: #dc2626; }
.ballot-candidate-card--ind  .ballot-candidate-party-stripe { background: #6b7280; }
.ballot-candidate-card--nonpartisan .ballot-candidate-party-stripe { background: #9ca3af; }
.ballot-candidate-card--other .ballot-candidate-party-stripe { background: #d1d5db; }

.ballot-candidate-inner {
  display: flex;
  gap: 12px;
  padding-left: 10px;
  width: 100%;
}

/* Photo / initials */
.ballot-candidate-photo-wrap { flex-shrink: 0; }

.ballot-candidate-photo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e5e7eb;
}

.ballot-candidate-initials {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #6b7280;
  flex-shrink: 0;
}

.ballot-candidate-card--dem  .ballot-candidate-initials { background: #dbeafe; color: #1d4ed8; }
.ballot-candidate-card--rep  .ballot-candidate-initials { background: #fee2e2; color: #dc2626; }

/* Body */
.ballot-candidate-body {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.ballot-candidate-name {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  margin-bottom: 3px;
}

.ballot-candidate-party {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

.ballot-candidate-card--dem  .ballot-candidate-party { color: #1d4ed8; }
.ballot-candidate-card--rep  .ballot-candidate-party { color: #dc2626; }
.ballot-candidate-card--ind  .ballot-candidate-party { color: #6b7280; }
.ballot-candidate-card--nonpartisan .ballot-candidate-party { color: #6b7280; }

.ballot-incumbent-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 6px;
}

/* Retention yes/no */
.ballot-retention-options {
  display: flex;
  gap: 8px;
  margin: 6px 0;
}

.ballot-ret-yes {
  font-size: 11px;
  font-weight: 600;
  background: #dcfce7;
  color: #15803d;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid #bbf7d0;
}

.ballot-ret-no {
  font-size: 11px;
  font-weight: 600;
  background: #fee2e2;
  color: #b91c1c;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid #fecaca;
}

/* Candidate links */
.ballot-candidate-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.ballot-cand-link {
  font-size: 11px;
  font-weight: 500;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 3px 9px;
  border-radius: 5px;
  text-decoration: none;
  transition: background 0.12s;
}

.ballot-cand-link:hover { background: #dbeafe; }

/* ── Ballot measure card ──────────────────────────────────────────────────── */
.ballot-measure-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.ballot-measure-header {
  display: flex;
  gap: 16px;
  padding: 18px 20px 16px;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  align-items: flex-start;
}

.ballot-measure-title-area { flex: 1; min-width: 0; }

.ballot-measure-title {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 5px;
  line-height: 1.3;
}

.ballot-measure-subtitle {
  font-size: 13px;
  color: #374151;
  line-height: 1.5;
}

.ballot-measure-badge-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.ballot-measure-type-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.ballot-measure-scope-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.ballot-measure-vote-badge {
  font-size: 11px;
  font-weight: 700;
  background: #1E3A5F;
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Full text block */
.ballot-measure-text-block {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
}

.ballot-measure-text-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-bottom: 6px;
}

.ballot-measure-text-preview,
.ballot-measure-text-full {
  font-size: 13px;
  color: #374151;
  line-height: 1.65;
}

.ballot-measure-expand-btn {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1d4ed8;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.ballot-measure-expand-btn:hover { color: #1E3A5F; }

/* AI zone */
.ballot-measure-ai-zone {
  padding: 16px 20px;
  background: #fafafa;
  border-top: 1px solid #f0f0f0;
}

.ballot-measure-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.ballot-measure-ai-btn:hover { opacity: 0.9; }

.ballot-measure-ai-note {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 5px;
}

/* AI loading */
.ballot-ai-loading {
  padding: 20px 0;
  text-align: center;
  font-size: 13px;
  color: #6b7280;
}

/* AI result */
.ballot-ai-result {
  border-top: 1px solid #e5e7eb;
  padding-top: 16px;
}

.ballot-ai-result-header {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ballot-ai-source {
  font-size: 11px;
  font-weight: 400;
  color: #9ca3af;
}

.ballot-ai-block { margin-bottom: 12px; }

.ballot-ai-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 4px;
}

.ballot-ai-para {
  font-size: 13px;
  line-height: 1.6;
  color: #374151;
  margin: 0;
}

/* Pros/cons grid */
.ballot-pros-cons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

@media (max-width: 560px) {
  .ballot-pros-cons-grid { grid-template-columns: 1fr; }
}

.ballot-pros-cons-col {
  border-radius: 8px;
  padding: 14px;
  border: 1px solid transparent;
}

.ballot-pros-cons-col--pass {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.ballot-pros-cons-col--stop {
  background: #fef2f2;
  border-color: #fecaca;
}

.ballot-pros-cons-heading {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.ballot-pros-cons-heading--pass { color: #15803d; }
.ballot-pros-cons-heading--stop { color: #b91c1c; }

.ballot-pros-cons-sub {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin: 8px 0 3px;
}

.ballot-cons-sub-label { margin-top: 12px; }

.ballot-pros-cons-list {
  margin: 0;
  padding-left: 16px;
  list-style: disc;
}

.ballot-pros-cons-list li {
  font-size: 12px;
  line-height: 1.5;
  color: #374151;
  margin-bottom: 4px;
}

.ballot-pros-list li::marker { color: #16a34a; }
.ballot-cons-list li::marker { color: #dc2626; }

.ballot-ai-disclaimer {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}

.ballot-ai-error {
  font-size: 13px;
  color: #dc2626;
  padding: 8px 0;
}

/* ── Footer note ──────────────────────────────────────────────────────────── */
.ballot-footer-note {
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  padding: 20px 0 8px;
  border-top: 1px solid #f0f0f0;
  margin-top: 12px;
}

/* ── Hidden utility ───────────────────────────────────────────────────────── */
.hidden { display: none !important; }
