/* ==========================================================================
   ISSUE TRACKER — Shared styles for /issues and /issues/archive
   Both pages link to this file so they stay visually consistent.
   ========================================================================== */

body {
  background: var(--dark-bg);
}

:root {
  --card-bg: #132d44;
  --card-border: #1a3a52;
  --text-gray: #a0b4c8;
  --text-dim: #6889a6;
  --status-introduced: #3b82f6;
  --status-committee: #f59e0b;
  --status-passed-committee: #f97316;
  --status-passed-chamber: #ef4444;
  --status-senate: #dc2626;
  --status-law: #991b1b;
  --status-dead: #6b7280;
}

/* ---------- Hero ---------- */
.tracker-hero {
  padding-top: calc(var(--nav-height) + 48px);
  padding-bottom: 48px;
  text-align: center;
  background: var(--dark-bg);
}
.tracker-hero .breadcrumb {
  font-family: "Montserrat", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}
.tracker-hero .breadcrumb a {
  color: var(--text-gray);
  text-decoration: none;
}
.tracker-hero .breadcrumb a:hover { color: var(--text-white); }
.tracker-hero h1 {
  font-family: "Montserrat", sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-white);
  margin-bottom: 0.5rem;
}
.tracker-hero p {
  color: var(--text-light);
  font-size: 1.1rem;
  max-width: 720px;
  margin: 0 auto;
}

.tracker-body {
  background: var(--dark-bg);
  padding-bottom: 4rem;
}

/* ---------- Alert banner ---------- */
.alert-banner {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 0 2rem;
}
.alert-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(
    135deg,
    rgba(220, 38, 38, 0.15),
    rgba(239, 68, 68, 0.05)
  );
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-left: 4px solid var(--status-senate);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  flex-wrap: wrap;
}
.alert-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.alert-text { flex: 1; min-width: 200px; }
.alert-text strong {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--text-white);
}
.alert-text span {
  color: var(--text-gray);
  font-size: 0.9rem;
}
.alert-link {
  padding: 0.5rem 1rem;
  background: var(--status-senate);
  color: white;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s;
  text-decoration: none;
}
.alert-link:hover { background: #b91c1c; color: white; }

/* ---------- Sticky stats bar ---------- */
.stats-bar-sticky {
  position: sticky;
  top: var(--nav-height);
  z-index: 90;
  background: rgba(15, 34, 51, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 2rem;
}
.stats-bar {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 0.85rem 2rem;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  text-align: center;
}
.stat-card .stat-num {
  font-family: "Montserrat", sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-white);
  line-height: 1.05;
}
.stat-card .stat-label {
  color: var(--text-gray);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
  font-family: "Montserrat", sans-serif;
}
.stat-card-updated {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.18),
    rgba(168, 85, 247, 0.12) 50%,
    rgba(236, 72, 153, 0.15)
  );
  border-color: rgba(168, 85, 247, 0.35);
}
.stat-card-updated .stat-updated-date {
  font-family: "Montserrat", sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-white);
  line-height: 1.1;
}
.stat-card-updated .stat-updated-time {
  font-family: "Montserrat", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
  margin-top: 0.15rem;
}
.stat-card-updated .stat-label {
  background: linear-gradient(90deg, #60a5fa, #a855f7, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

/* ---------- Filters ---------- */
.filters {
  max-width: 1200px;
  margin: 1.5rem auto 0;
  padding: 0 2rem;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  align-items: center;
}
.filter-label {
  font-family: "Montserrat", sans-serif;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.5rem;
  min-width: 70px;
}
.filter-btn {
  padding: 0.45rem 0.95rem;
  min-height: 36px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--text-gray);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: "Montserrat", sans-serif;
  line-height: 1.2;
}
.filter-btn:hover {
  border-color: var(--text-gray);
  color: var(--text-white);
}
.filter-btn:focus-visible {
  outline: 2px solid var(--color-light-blue, #60a5fa);
  outline-offset: 2px;
}
.filter-btn.active,
.filter-btn[aria-pressed="true"] {
  background: var(--color-blue);
  color: var(--text-white);
  border-color: var(--color-blue);
}

/* Polite live region for filter result announcements. Visible at small font
   so it can also serve as a result count, but kept minimal so it doesn't
   compete with the stats bar. */
.filter-status {
  max-width: 1200px;
  margin: 0 auto 0.75rem;
  padding: 0 2rem;
  font-family: "Montserrat", sans-serif;
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.filter-status:empty { display: none; }
.filter-btn.stance-anti.active { background: #dc2626; border-color: #dc2626; }
.filter-btn.stance-pro.active  { background: #16a34a; border-color: #16a34a; }
.filter-btn.stance-mixed.active { background: #ca8a04; border-color: #ca8a04; }

/* ---------- Archive link (under Category filter row) ---------- */
.archive-link-row {
  max-width: 1200px;
  margin: 0.25rem auto 1.25rem;
  padding: 0 2rem;
  display: flex;
  justify-content: flex-end;
}
.archive-link {
  font-family: "Montserrat", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-gray);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.archive-link:hover {
  color: var(--text-white);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

/* ---------- Section header (per-stance grouping) ---------- */
.stance-section-header {
  max-width: 1200px;
  margin: 0 auto 1rem;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.stance-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.stance-indicator.anti  { background: #dc2626; }
.stance-indicator.pro   { background: #22c55e; }
.stance-indicator.mixed { background: #eab308; }
.stance-section-header h2 {
  font-family: "Montserrat", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-white);
  margin: 0;
}
.stance-section-header .stance-count {
  font-family: "Montserrat", sans-serif;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* ---------- Bill cards (override the light-theme version in style.css) ---------- */
.bills-container {
  max-width: 1200px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.bill-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-left: 1px solid var(--card-border);
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.3s;
  display: block;
  text-decoration: none;
  padding: 0;
}
.bill-card:hover {
  border-color: var(--dark-bg-lighter);
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.bill-card-inner { display: flex; }
.bill-status-bar { width: 5px; flex-shrink: 0; }
.bill-content {
  flex: 1;
  padding: 1.25rem 1.5rem;
}
.bill-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.bill-id {
  font-family: "Montserrat", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-gray);
}
.bill-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-family: "Montserrat", sans-serif;
}
.cat-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid;
  font-family: "Montserrat", sans-serif;
}
.bill-title {
  font-family: "Montserrat", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-white);
}
.bill-title-link {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.3);
}
.bill-subtitle {
  font-size: 0.85rem;
  color: var(--text-gray);
  margin-bottom: 0.5rem;
}
.bill-desc {
  font-size: 0.9rem;
  color: var(--text-gray);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}
.bill-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--card-border);
  padding-top: 0.75rem;
  margin-bottom: 0;
}
.bill-meta strong { color: var(--text-gray); }
.bill-next-date {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  color: #fca5a5;
  font-weight: 600;
}

/* Hide mobile-only elements on desktop */
.bill-expand-btn { display: none; }
.bill-card-cta { display: none; }

/* ---------- Source credit / contact note ---------- */
.source-credit {
  max-width: 1200px;
  margin: 3rem auto 0;
  padding: 0 3rem;
  text-align: center;
}
.source-credit-inner {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  color: var(--text-gray);
  font-size: 0.85rem;
  line-height: 1.6;
}
.source-credit-inner a {
  color: var(--color-light-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.source-credit-inner strong { color: var(--text-white); }

.contact-note {
  max-width: 1200px;
  margin: 1.5rem auto 4rem;
  padding: 0 3rem;
  text-align: center;
}
.contact-note p {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 1.25rem;
  color: var(--text-gray);
  font-size: 0.9rem;
}
.contact-note a { color: var(--color-light-blue); }

/* ---------- Empty state ---------- */
.empty-state {
  max-width: 720px;
  margin: 3rem auto;
  padding: 2.5rem 2rem;
  text-align: center;
  background: var(--card-bg);
  border: 1px dashed var(--card-border);
  border-radius: 12px;
}
.empty-state h3 {
  font-family: "Montserrat", sans-serif;
  color: var(--text-white);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}
.empty-state p { color: var(--text-gray); margin: 0; }

.archive-back-row {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 0 2rem;
}
.archive-back-link {
  font-family: "Montserrat", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-gray);
  text-decoration: none;
}
.archive-back-link:hover { color: var(--text-white); }

/* ==========================================================================
   Tablet (≤768px)
   ========================================================================== */
@media (max-width: 768px) {
  .tracker-hero {
    padding-top: calc(var(--nav-height) + 24px);
    padding-bottom: 24px;
  }
  .tracker-hero h1 { font-size: 1.6rem; }
  .tracker-hero p {
    font-size: 0.95rem;
    padding: 0 1rem;
  }
  .alert-banner { padding: 0 1rem; }
  .alert-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    gap: 0.75rem;
  }
  .alert-link { width: 100%; text-align: center; }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    padding: 0.75rem 1rem;
    gap: 0.6rem;
  }

  .filters { padding: 0 1rem; }
  .filter-row {
    gap: 0.4rem;
    flex-wrap: wrap;
  }
  .filter-btn {
    padding: 0.55rem 0.85rem;
    font-size: 0.78rem;
    min-height: 40px;
  }
  .filter-status { padding: 0 1rem; }

  .archive-link-row { padding: 0 1rem; justify-content: stretch; }
  .archive-link { width: 100%; text-align: center; }

  .bills-container {
    padding: 0 1rem;
    gap: 0.85rem;
  }
  .bill-card { width: 100%; }
  .bill-card-inner { width: 100%; min-width: 0; }
  .bill-content { padding: 1rem; min-width: 0; width: 100%; }
  .bill-header { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .bill-badges { flex-wrap: wrap; }
  .bill-title { font-size: 1.05rem; line-height: 1.3; word-break: break-word; }
  .bill-subtitle { font-size: 0.8rem; word-break: break-word; }
  .bill-desc { font-size: 0.88rem; line-height: 1.55; }
  .bill-meta { flex-direction: column; gap: 0.5rem; font-size: 0.78rem; }
  .bill-meta span { word-break: break-word; }

  .contact-note,
  .source-credit { padding: 0 1rem; }
  .stance-section-header { padding: 0 1rem; }

  /* Collapsible meta details on mobile */
  .bill-card .bill-expandable {
    max-height: 0;
    overflow: hidden;
    transition:
      max-height 0.4s ease,
      opacity 0.3s ease,
      margin 0.3s ease;
    opacity: 0;
    margin-top: 0;
  }
  .bill-card.expanded .bill-expandable {
    max-height: 800px;
    opacity: 1;
    margin-top: 0.25rem;
  }

  .bill-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.7rem 1rem;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 8px;
    font-family: "Montserrat", sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-light-blue);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
  }
  .bill-expand-btn:hover,
  .bill-expand-btn:focus-visible {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.55);
    color: #fff;
    outline: none;
  }
  .bill-expand-btn .expand-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 0.65rem;
  }
  .bill-card.expanded .bill-expand-btn .expand-icon { transform: rotate(180deg); }
  .bill-card.expanded .bill-expand-btn .expand-text { display: none; }
  .bill-card .expand-collapse-text { display: none; }
  .bill-card.expanded .expand-collapse-text { display: inline; }

  .bill-card-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0.55rem 1rem;
    font-family: "Montserrat", sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .bill-card-cta .cta-arrow { transition: transform 0.2s; }
  .bill-card:active .bill-card-cta .cta-arrow { transform: translateX(3px); }
}

/* ==========================================================================
   Phone (≤480px) — fix the cramped 4-up stat strip the user flagged
   Stay 2x2; give each card real breathing room and keep numbers legible.
   ========================================================================== */
@media (max-width: 480px) {
  .tracker-hero h1 { font-size: 1.45rem; }
  .tracker-hero p { font-size: 0.9rem; }

  /* Belt-and-suspenders: prevent any inline content from forcing the
     viewport wider than the screen on 375px-class phones. */
  .tracker-body,
  .tracker-hero,
  .filters,
  .filter-row,
  .bills-container,
  .bill-card,
  .bill-content { max-width: 100%; }
  .filters,
  .alert-banner,
  .archive-link-row { padding-left: 0.85rem; padding-right: 0.85rem; }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.55rem;
    padding: 0.6rem 0.75rem;
  }
  .stat-card {
    padding: 0.7rem 0.6rem;
    min-height: 78px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .stat-card .stat-num { font-size: 1.5rem; }
  .stat-card .stat-label {
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    line-height: 1.2;
    margin-top: 0.2rem;
  }
  .stat-card-updated .stat-updated-date { font-size: 1rem; }
  .stat-card-updated .stat-updated-time { font-size: 0.8rem; }

  .filter-label {
    flex-basis: 100%;
    min-width: 0;
    margin: 0 0 0.25rem;
  }

  .source-credit { padding: 0 1rem; }
  .source-credit-inner { padding: 0.85rem 1rem; font-size: 0.8rem; }
}
