/* VoteTwin Unified Modern Stylesheet */
:root {
  --primary: #1e293b;
  --primary-hover: #0f172a;
  --dem-blue: #2563eb;
  --dem-bg: #eff6ff;
  --dem-border: #bfdbfe;
  --gop-red: #dc2626;
  --gop-bg: #fef2f2;
  --gop-border: #fecaca;
  --accent-green: #10b981;
  --surface: #ffffff;
  --bg: #f8fafc;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 20px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Master Card Container */
.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.04), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
}

/* Brand Header */
.hero-header {
  text-align: center;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.hero-header a { text-decoration: none; display: inline-block; }
.hero-header h1 { font-size: 2.2rem; font-weight: 900; letter-spacing: -0.5px; margin: 0 0 8px 0; color: #0f172a; }
.hero-header p.tagline { font-size: 1.15rem; font-weight: 600; color: var(--dem-blue); margin: 0; }

/* Chamber Navigation */
.chamber-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 15px 0 25px 0;
  flex-wrap: wrap;
}
.chamber-nav a {
  text-decoration: none;
  padding: 10px 22px;
  border-radius: 24px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-muted);
  background: #f1f5f9;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  white-space: nowrap;
}
.chamber-nav a:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: translateY(-1px);
}
.chamber-nav a.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.2);
}

/* Leadership Banner */
.leadership-banner {
  background: #f8fafc;
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 25px;
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.leader-badge {
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid transparent;
  display: inline-block;
}
.leader-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.06);
}
.leader-rep { background: var(--gop-bg); color: var(--gop-red); border-color: var(--gop-border); }
.leader-dem { background: var(--dem-bg); color: var(--dem-blue); border-color: var(--dem-border); }

/* Forms & Selects */
.form-grid, .filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 120px auto;
  gap: 12px;
  align-items: end;
}
.filter-grid { margin-bottom: 6px; }
label { display: block; font-weight: 700; margin-bottom: 4px; font-size: 0.85rem; color: #334155; }
select, input[type="text"], input[type="email"], textarea {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
select:focus, input:focus, textarea:focus {
  border-color: var(--dem-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
select.filter-select { padding: 7px 10px; font-size: 0.85rem; background: #f8fafc; color: var(--text-muted); }

/* Buttons */
button.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  width: auto;
  transition: background 0.2s;
}
button.btn-primary:hover { background: var(--primary-hover); }

button.btn-action {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  transition: all 0.15s;
}
button.btn-action:hover { background: #e2e8f0; color: #0f172a; }
.btn-action svg { width: 15px; height: 15px; fill: currentColor; }
.btn-x { background: #000000; color: #ffffff; border: none; }
.btn-x:hover { background: #1e293b; color: #ffffff; }
.btn-fb { background: #1877f2; color: #ffffff; border: none; }
.btn-fb:hover { background: #0c63d4; color: #ffffff; }
.btn-li { background: #0a66c2; color: #ffffff; border: none; }
.btn-li:hover { background: #084e96; color: #ffffff; }
.btn-print { background: #0284c7; color: #ffffff; border: none; }
.btn-print:hover { background: #0369a1; color: #ffffff; }
.btn-email { background: var(--accent-green); color: #ffffff; border: none; }
.btn-email:hover { background: #059669; color: #ffffff; }

/* Loading Spinner */
.spinner {
  display: none;
  margin: 30px auto;
  border: 4px solid #f1f5f9;
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Comparison Layout */
.results-layout { display: flex; gap: 20px; align-items: flex-start; margin-top: 20px; }
.center-col { flex: 1; min-width: 0; order: 1; }
.right-col { flex: 0 0 310px; order: 2; display: flex; flex-direction: column; gap: 15px; }

/* Action Toolbar */
.top-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 15px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.social-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Stat Cards */
.stat-card {
  background: var(--dem-bg);
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--dem-border);
}
.stat-card .percent { font-size: 3.8rem; font-weight: 900; color: #1e40af; line-height: 1; margin-bottom: 6px; }
.stat-card .label { font-size: 1.1rem; color: #334155; font-weight: 800; margin-bottom: 4px; }
.stat-card .sub-label { font-size: 0.85rem; color: var(--text-muted); }

.state-card {
  background: #f8fafc;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.state-card h4 { margin: 0 0 10px 0; color: #0f172a; border-bottom: 2px solid #e2e8f0; padding-bottom: 5px; }
.state-card p { margin: 5px 0; font-size: 0.85rem; color: #475569; display: flex; justify-content: space-between; }
.state-card p strong { color: #0f172a; }

/* Tabbed Tables */
.tabs-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 10px 0;
  border-bottom: 2px solid var(--border);
}
.tabs { display: flex; gap: 8px; overflow-x: auto; }
.tab-btn {
  padding: 10px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab-btn.active { color: #0f172a; border-bottom-color: var(--dem-blue); }
.tab-btn:hover { color: #0f172a; }

.table-responsive { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; min-width: 600px; }
th, td { border: 1px solid var(--border); padding: 12px 10px; text-align: left; font-size: 0.9rem; }
th { background: #f8fafc; position: sticky; top: 0; white-space: nowrap; font-weight: 700; }
.badge-no { color: var(--gop-red); font-weight: 800; }
.badge-aye { color: #16a34a; font-weight: 800; }
.badge-absent { color: var(--text-muted); font-style: italic; }
.bill-link { color: var(--dem-blue); text-decoration: none; font-weight: 700; }
.bill-link:hover { text-decoration: underline; }

/* Bill Detail Styles */
.bill-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  border-radius: 6px;
  text-transform: uppercase;
}
.tally-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin: 20px 0;
  text-align: center;
}
.tally-box { padding: 18px; border-radius: 10px; border: 1px solid transparent; }
.tally-yea { background: #f0fdf4; border-color: #bbf7d0; }
.tally-yea .num { font-size: 2.5rem; font-weight: 900; color: #15803d; line-height: 1; }
.tally-nay { background: var(--gop-bg); border-color: var(--gop-border); }
.tally-nay .num { font-size: 2.5rem; font-weight: 900; color: var(--gop-red); line-height: 1; }
.tally-other { background: #f8fafc; border-color: var(--border); }
.tally-other .num { font-size: 2.5rem; font-weight: 900; color: var(--text-muted); line-height: 1; }
.roster-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.roster-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.roster-box h3 { margin-top: 0; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 1.05rem; }
.roster-list { max-height: 380px; overflow-y: auto; list-style: none; padding: 0; margin: 0; font-size: 0.85rem; }
.roster-list li { padding: 6px 0; border-bottom: 1px solid #f1f5f9; }

/* Modal Window */
.modal {
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-content {
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
  position: relative;
}
.modal-close {
  position: absolute;
  right: 16px;
  top: 12px;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-close:hover { color: #0f172a; }

/* Mobile Responsiveness */
@media (max-width: 900px) {
  .form-grid, .filter-grid, .tally-grid, .roster-grid { grid-template-columns: 1fr; }
  .leadership-banner { flex-direction: column; gap: 15px; text-align: center; }
  .results-layout { flex-direction: column; }
  .right-col { order: 1; width: 100%; }
  .center-col { order: 2; width: 100%; }
  .top-action-bar { flex-direction: column; align-items: stretch; gap: 15px; }
  .social-group { justify-content: center; }
}

/* STRICT PRINT-ONLY RULE: Percentage Box and Differ Table ONLY */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 15px !important;
    padding: 0 !important;
  }
  .chamber-nav,
  .hero-header,
  .leadership-banner,
  .filter-grid,
  .form-grid,
  .top-action-bar,
  .links-bar,
  #statLinks,
  .spinner,
  .modal,
  .tabs-bar,
  .state-card,
  #tableMatch,
  #tablePassage,
  #ogTemplate {
    display: none !important;
  }
  .card {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  #results { display: block !important; }
  .results-layout { display: flex !important; flex-direction: column !important; }
  .right-col { order: 1 !important; width: 100% !important; margin-bottom: 20px !important; }
  .center-col { order: 2 !important; width: 100% !important; }
  .stat-card {
    border: 2px solid #1e293b !important;
    background: #ffffff !important;
    color: #000000 !important;
    padding: 16px !important;
    page-break-inside: avoid !important;
  }
  .stat-card .percent { color: #0f172a !important; font-size: 3rem !important; }
  #displayTitle {
    display: block !important;
    font-size: 1.6rem !important;
    margin-bottom: 15px !important;
    color: #000000 !important;
  }
  #tableDiff {
    display: table !important;
    width: 100% !important;
    font-size: 9pt !important;
    border-collapse: collapse !important;
  }
  #tableDiff th,
  #tableDiff td {
    border: 1px solid #94a3b8 !important;
    padding: 6px 8px !important;
    color: #000000 !important;
  }
  #tableDiff tr { page-break-inside: avoid !important; }
}

/* Hidden Open Graph Template (1200x630) */
#ogTemplate {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1200px;
  height: 630px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 48px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.og-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #334155; padding-bottom: 20px; }
.og-tag { font-size: 1.1rem; text-transform: uppercase; letter-spacing: 2px; color: #60a5fa; font-weight: 800; }
.og-year { background: #334155; padding: 6px 16px; border-radius: 20px; font-size: 1.1rem; font-weight: 700; color: #f8fafc; }
.og-members { text-align: center; margin: 15px 0; }
.og-names { font-size: 2.8rem; font-weight: 900; letter-spacing: -0.5px; }
.og-sub { font-size: 1.3rem; color: #94a3b8; margin-top: 6px; }
.og-stats { display: flex; justify-content: center; gap: 30px; }
.og-stat-card { background: rgba(255, 255, 255, 0.05); border: 1px solid #334155; border-radius: 16px; padding: 24px 60px; text-align: center; }
.og-stat-pct { font-size: 5.5rem; font-weight: 900; color: #60a5fa; line-height: 1; }
.og-stat-label { font-size: 1.5rem; font-weight: 700; color: #f1f5f9; margin-top: 8px; }
.og-stat-sub { font-size: 1rem; color: #94a3b8; margin-top: 4px; }
.og-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #334155; padding-top: 16px; font-size: 0.95rem; color: #64748b; }