/*
 * Concept A — "EU Civic Blue" Design Override
 * Overlays on design-system.css for MEPscore visual update
 * Fonts: Sora (headings), Inter (body), JetBrains Mono (data)
 * Primary: #003399, Gold accent: #FFCC00
 */

/* ===============================================
   Flag Emoji Polyfill — Twemoji Country Flags
   Ensures flag emojis render as images on Windows
   =============================================== */
@font-face {
  font-family: "Twemoji Country Flags";
  src: url("https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1/dist/TwemojiCountryFlags.woff2") format("woff2");
  unicode-range: U+1F1E6-1F1FF;
  font-display: swap;
}

/* ===============================================
   Concept A Design Tokens
   =============================================== */
:root {
  --ca-primary: #003399;
  --ca-primary-dark: #1e40af;
  --ca-primary-light: #dbeafe;
  --ca-primary-50: #f0f4ff;
  --ca-gold: #FFCC00;

  /* Semantic status tokens (canonical, 2026-07 revision) — use these for
     every status green/amber/red instead of ad-hoc hex values. Values match
     the design-manual status badges. */
  --ca-success: #16a34a;
  --ca-warning: #a16207;
  --ca-error: #dc2626;

  /* Override design-system primary palette */
  --color-primary-500: #003399;
  --color-primary-600: #003399;
  --color-primary-700: #002b80;
  --color-primary-800: #1e40af;
  --color-primary-900: #1e3a8a;

  /* Font families */
  --font-family-heading: 'Sora', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* ===============================================
   NAV — Concept A
   =============================================== */
.ca-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--color-gray-200);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.ca-nav-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.ca-nav-logo {
  height: 48px;
  width: auto;
}

.ca-nav-links {
  display: flex;
  gap: 1.5rem;
}

.ca-nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-gray-600);
  text-decoration: none;
  padding: 0.5rem 0;
  transition: color 150ms;
}

.ca-nav-links a.active {
  color: var(--ca-primary);
  font-weight: 600;
}

.ca-nav-links a:hover {
  color: var(--ca-primary);
}

/* Main sections (Home, Vote Match, Votes) stand out from secondary links */
.ca-nav-links a.nav-main {
  color: var(--ca-primary, #003399);
  font-weight: 600;
}

.ca-nav-links a.nav-main.active {
  color: var(--ca-primary);
  font-weight: 600;
}

/* Subtle gap between the main trio and the secondary links (adds to flex gap) */
.ca-nav-links a.nav-main + a:not(.nav-main) {
  margin-left: 0.75rem;
}

.ca-nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ca-search {
  padding: 0.5rem 0.75rem;
  background: var(--color-gray-50);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--color-gray-200);
  font-size: 0.8125rem;
  color: var(--color-gray-500);
  min-width: 200px;
  outline: none;
  font-family: var(--font-family-base);
}

.ca-search:focus {
  border-color: var(--ca-primary);
  box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.15);
}

/* ===============================================
   HERO — Concept A
   =============================================== */
.ca-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 2rem 1rem;
  background: linear-gradient(135deg, var(--ca-primary) 0%, var(--ca-primary-dark) 100%);
  text-align: center;
}

.ca-hero-term {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--ca-gold);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.625rem;
}

.ca-hero h1 {
  font-family: var(--font-family-heading);
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  margin: 0;
}

.ca-hero-desc {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.75);
  max-width: 520px;
  line-height: 1.5;
  margin-top: 0.5rem;
}

.ca-hero-badges {
  display: flex;
  gap: 0.625rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.ca-hero-badge {
  padding: 0.3rem 0.75rem;
  background: rgba(255,255,255,0.12);
  border-radius: 1rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
}

/* ===============================================
   FLAG BAR — Country quick-filter
   =============================================== */
.ca-flag-bar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1.125rem;
  flex-wrap: wrap;
  justify-content: center;
  padding-bottom: 0.5rem;
}

.ca-flag-item {
  padding: 0.2rem 0.5rem;
  background: rgba(255,255,255,0.06);
  border-radius: 0.3rem;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  cursor: pointer;
  transition: background 150ms;
  border: 1px solid transparent;
  text-decoration: none;
  font-size: 0;
}

.ca-flag-item:hover {
  background: rgba(255,255,255,0.15);
}

.ca-flag-item.active {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.3);
}

.ca-flag-item.all {
  background: rgba(255,255,255,0.12);
}

.ca-flag-emoji {
  font-size: 0.875rem;
  line-height: 1;
  font-family: "Twemoji Country Flags", "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Emoji", sans-serif;
  letter-spacing: -1px;
}

.ca-flag-code {
  /* Hidden — on Windows the emoji already renders as country code */
  display: none;
}

.ca-flag-item.active .ca-flag-code {
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}

.ca-flag-item.all .ca-flag-code {
  font-weight: 500;
  color: rgba(255,255,255,0.6);
}

/* ===============================================
   VIEW TABS — Concept A styled
   =============================================== */
.ca-tabs {
  display: inline-flex;
  background: #fff;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--color-gray-200);
  padding: 3px;
  gap: 2px;
  box-shadow: var(--shadow-sm);
}

.ca-tab {
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 150ms;
  font-family: var(--font-family-base);
  color: var(--color-gray-600);
  background: transparent;
}

.ca-tab:hover {
  background: var(--color-gray-100);
}

.ca-tab.active {
  background: var(--ca-primary);
  color: #fff;
  font-weight: 600;
}

/* ===============================================
   COLUMN SELECTOR — above table
   =============================================== */
.ca-col-selector,
.col-selector {
  background: #fff;
  border-radius: var(--border-radius-xl);
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-gray-200);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.ca-col-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-gray-500);
  margin-right: 0.125rem;
}

.ca-col-pill {
  padding: 0.25rem 0.75rem;
  border-radius: var(--border-radius-full);
  font-size: 0.6875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms;
  border: 1px solid transparent;
  user-select: none;
}

.ca-col-pill.active {
  background: var(--ca-primary);
  color: #fff;
  font-weight: 600;
}

.ca-col-pill.inactive {
  background: var(--color-gray-100);
  color: var(--color-gray-500);
  border-color: var(--color-gray-200);
}

.ca-col-pill:hover {
  opacity: 0.85;
}

/* =====================================================================
   CANONICAL TABLE SYSTEM (2026-07 revision) — THE single table
   definition for update.mepscore.eu, per the design-manual "Tables
   (unified style)": headers uppercase 0.6875rem / weight 600 /
   letter-spacing 0.5px / gray-500; data rows 0.8125rem / 0.5rem
   padding; hover primary-50; numbers in JetBrains Mono.
   Canonical choices where the manual is silent (documented here):
   header bg #f8fafc, zebra ON (#f8fafc even rows), numerics
   right-aligned via .ca-num, missing values shown as "&ndash;".
   Applies to .ca-table AND .data-table; pages must NOT re-declare
   these properties locally.
   ===================================================================== */
.ca-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.ca-table thead th,
.data-table thead th {
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--color-gray-200, #e5e7eb);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-gray-500, #6b7280);
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
  max-width: none;
}

.ca-table tbody tr,
.data-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
}

.ca-table tbody tr:nth-child(even),
.data-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.ca-table tbody tr:hover,
.data-table tbody tr:hover,
.data-table tbody tr:hover td {
  background: var(--ca-primary-50, #f0f4ff);
}

.ca-table tbody td,
.data-table tbody td {
  padding: 0.5rem;
  font-size: 0.8125rem;
  color: #334155;
  vertical-align: middle;
}

/* Numeric cells/headers: right-aligned, tabular digits; data cells (not
   headers) additionally use JetBrains Mono per the design-manual */
.ca-table .ca-num,
.data-table .ca-num,
td[data-activity] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ca-table td.ca-num,
.data-table td.ca-num,
td[data-activity] {
  font-family: var(--font-family-mono, 'JetBrains Mono', monospace);
}

/* Sortable headers (js/sortable-table.js + explorer) */
.ca-table thead th[data-col],
.data-table thead th[data-column-id] {
  cursor: pointer;
}

.ca-table thead th[data-col]:focus-visible,
.data-table thead th[data-column-id]:focus-visible {
  outline: 2px solid var(--ca-primary, #003399);
  outline-offset: -2px;
}

/* --- Explorer-specific table layout (index.html) --- */
.data-table thead th.metric,
.data-table thead th.activity-col {
  color: var(--ca-primary);
}

/* Rank column — wide enough for 3 digits */
.data-table th:first-child,
.data-table td:first-child {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
}

/* Compact name cell */
.data-table .name-cell {
  min-width: 200px;
  max-width: 300px;
}

.data-table .mep-photo {
  width: 28px;
  height: 28px;
}

/* Score column — hide completely */
.data-table th.score-col,
.data-table td[data-column-id="score"] {
  display: none;
}

/* Remove sticky/blue score styling from last column (was score, now
   meetings). Headers keep the canonical weight 600; the column separator
   is Explorer-specific and scoped below so it never leaks into other
   .data-table surfaces (vote-match had to fight it with !important). */
.data-table td:last-child,
.data-table th:last-child {
  position: static;
  right: auto;
  z-index: auto;
  box-shadow: none;
}

#explorer-results .data-table td:last-child,
#explorer-results .data-table th:last-child {
  border-left: 1px solid #e5e7eb;
}

/* Nat. Party — hidden by default (not in mockup) */
.data-table th[data-column-id="national_party"],
.data-table .national-party-cell {
  display: none;
}

/* =====================================================================
   CANONICAL CARD (2026-07 revision) — THE single .ca-card definition:
   white bg, 1px #e5e7eb border, 0.75rem radius, 1.5rem padding,
   NO box-shadow, NO hover transform. Pages must not re-declare it.
   ===================================================================== */
.ca-card {
  background: #fff;
  border: 1px solid var(--color-gray-200, #e5e7eb);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

/* =====================================================================
   CANONICAL EMPTY STATE + table caption/footnote (2026-07 revision).
   Three canonical texts, rendered by caEmptyState() in js/utilities.js:
     filter-no-match: "No results match your filters."
     no-data:         "No data available for this view."
     load-error:      "Could not load data. Try again later."
   ===================================================================== */
.ca-empty-state {
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--color-gray-500, #6b7280);
}

/* Shared muted small-print note under tables (captions, data notes) */
.ca-table-note {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--color-gray-500, #6b7280);
  line-height: 1.5;
}

/* ===============================================
   SIDEBAR OVERRIDES — Concept A
   =============================================== */
.sidebar h2,
.sidebar .filter-label {
  font-family: var(--font-family-heading);
}

.filter-input:focus {
  border-color: var(--ca-primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.1) !important;
}

/* Active filter highlight */
.filter-input.active-filter {
  background-color: var(--ca-primary-50);
  border: 1.5px solid var(--ca-primary);
  color: var(--ca-primary);
  font-weight: 600;
}

/* Quick Stats card */
.ca-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
}

.ca-stat-label {
  font-size: 0.75rem;
  color: var(--color-gray-500);
}

.ca-stat-value {
  font-family: var(--font-family-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  color: #0f172a;
}

/* ===============================================
   CARD & LAYOUT OVERRIDES
   =============================================== */
.card {
  border-radius: var(--border-radius-xl) !important;
}

.card-header {
  font-family: var(--font-family-heading);
}

/* ===============================================
   FOOTER — Concept A
   =============================================== */
.ca-footer {
  background: #0f172a;
  color: rgba(255,255,255,0.7);
  padding: 3rem 2rem 1.5rem;
  margin-top: 4rem;
}

.ca-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .ca-footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.ca-footer-brand {
  font-family: var(--font-family-heading);
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
}

.ca-footer-desc {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.5);
  max-width: 360px;
}

.ca-footer-heading {
  font-family: var(--font-family-heading);
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}

.ca-footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ca-footer-links li {
  margin-bottom: 0.5rem;
}

.ca-footer-links a {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: color 150ms;
}

.ca-footer-links a:hover {
  color: #fff;
}

.ca-footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 2rem;
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.3);
}

/* Social links — intentionally dimmed for now */
.ca-footer-social {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1.5rem;
}
.ca-footer-social a {
  display: inline-flex;
  opacity: 0.3;
  transition: opacity 0.2s ease;
}
.ca-footer-social a:hover {
  opacity: 0.6;
}
.ca-footer-social img {
  width: 20px;
  height: 20px;
  display: block;
}

/* ===============================================
   HEADING OVERRIDES
   =============================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
}

/* ===============================================
   PAGINATION — Concept A
   =============================================== */
.pg-btn {
  padding: 0.25rem 0.625rem;
  border-radius: var(--border-radius-base);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--color-gray-200);
  cursor: pointer;
  transition: all 150ms;
  font-family: var(--font-family-base);
  background: var(--color-gray-50);
  color: var(--color-gray-600);
}

.pg-btn:hover {
  background: var(--color-gray-200);
}

.pg-btn.pg-active {
  background: var(--ca-primary);
  color: #fff;
  font-weight: 600;
  border-color: var(--ca-primary);
}

/* ===============================================
   MOBILE CARD OVERRIDES
   =============================================== */
.mobile-score-value {
  font-family: var(--font-family-heading) !important;
}

.mobile-mep-name {
  font-family: var(--font-family-heading) !important;
}

/* ===============================================
   BUTTON COLOR OVERRIDES
   =============================================== */
.btn-primary,
.bg-blue-600 {
  background-color: var(--ca-primary) !important;
}

.btn-primary:hover:not(:disabled),
.hover\:bg-blue-700:hover {
  background-color: var(--color-primary-700) !important;
}

.text-blue-600 {
  color: var(--ca-primary) !important;
}

/* Tab active state override */
#tab-explorer.bg-blue-600,
#tab-alignment.bg-blue-600,
#tab-vote-explorer.bg-blue-600,
#tab-top-amendments.bg-blue-600,
#tab-amendment-db.bg-blue-600,
#tab-data-updates.bg-blue-600 {
  background-color: var(--ca-primary) !important;
}

/* ===============================================
   VOTE EXPLORER & VOTING ALIGNMENT — Concept A
   =============================================== */

/* Cards — clean, no shadow */
#vote-explorer-view .bg-white,
#alignment-view .bg-white,
#vote-comparison-panel {
  border-radius: 0.75rem !important;
  box-shadow: none !important;
  border: 1px solid var(--color-gray-200) !important;
}

/* Section headings — Sora, compact, with icon */
#vote-explorer-view h3,
#alignment-view h3 {
  font-family: var(--font-family-heading) !important;
  font-size: 0.875rem !important;
  font-weight: 700 !important;
  color: var(--color-gray-800, #1e293b) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

#vote-explorer-view h3 i,
#alignment-view h3 i {
  color: var(--ca-primary) !important;
}

/* Sub-labels — uppercase small */
#vote-explorer-view label,
#alignment-view label {
  font-family: var(--font-family-base) !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  color: var(--color-gray-500) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

/* Description text */
#vote-explorer-view p,
#alignment-view p {
  font-size: 0.8125rem !important;
  color: var(--color-gray-500) !important;
}

/* Input + Select styling */
#vote-explorer-view input,
#vote-explorer-view select,
#alignment-view input,
#alignment-view select {
  border-radius: 0.5rem !important;
  font-size: 0.8125rem !important;
  border: 1px solid var(--color-gray-200) !important;
}

#vote-explorer-view input:focus,
#vote-explorer-view select:focus,
#alignment-view input:focus,
#alignment-view select:focus {
  border-color: var(--ca-primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.1) !important;
}

/* Table — unified style matching explorer table */
#alignment-view table {
  font-size: 0.8125rem !important;
}

#alignment-view thead tr {
  background-color: var(--color-gray-50) !important;
}

#alignment-view thead th {
  font-family: var(--font-family-base) !important;
  font-size: 0.6875rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  color: var(--color-gray-500) !important;
  padding: 0.625rem 1rem !important;
}

#alignment-view tbody td {
  padding: 0.5rem 1rem !important;
  font-size: 0.8125rem !important;
}

#alignment-view tbody tr:hover {
  background-color: var(--ca-primary-50) !important;
}

/* Alignment percentage — monospace */
#alignment-view td:nth-child(5) {
  font-family: var(--font-family-mono) !important;
  font-weight: 700 !important;
}

/* Alignment bar fill */
#alignment-view .bg-blue-500 {
  background-color: var(--ca-primary) !important;
}

/* Category pills */
#alignment-view .bg-blue-600 {
  background-color: var(--ca-primary) !important;
  color: #fff !important;
}

/* Cohesion cards */
#alignment-view details summary {
  font-family: var(--font-family-heading) !important;
}

/* Vote explorer vote list items */
#ve-vote-list > div {
  transition: background 150ms !important;
}

#ve-vote-list > div:hover {
  background-color: var(--ca-primary-50) !important;
}

/* Load more / action buttons */
#ve-load-more {
  border-color: var(--ca-primary) !important;
  color: var(--ca-primary) !important;
  border-radius: 0.5rem !important;
  font-family: var(--font-family-base) !important;
  font-weight: 500 !important;
}

#ve-load-more:hover {
  background-color: var(--ca-primary-50) !important;
}

/* Reference summary badge */
#ref-summary {
  background: var(--ca-primary-50) !important;
  border: 1px solid var(--ca-primary-light) !important;
  color: var(--ca-primary) !important;
  border-radius: 0.5rem !important;
}

/* Vote comparison panel */
#vote-comparison-panel h3 i {
  color: var(--ca-primary) !important;
}

/* ===============================================
   PHASE 5 — JS-rendered DOM overrides
   Voting Alignment + Vote Explorer + Vote Comparison
   =============================================== */

/* --- Shared bar colors (Tailwind -> Concept A palette) --- */
#alignment-view .bg-green-500,
#vote-explorer-view .bg-green-500,
#vote-comparison-panel .bg-green-500,
#alignment-details-modal .bg-green-500 {
  background-color: #16a34a !important;
}
#alignment-view .bg-red-400,
#vote-explorer-view .bg-red-400,
#vote-comparison-panel .bg-red-400,
#alignment-details-modal .bg-red-400 {
  background-color: #ef4444 !important;
}
#alignment-view .bg-yellow-400,
#vote-explorer-view .bg-yellow-400,
#vote-comparison-panel .bg-yellow-400,
#alignment-details-modal .bg-yellow-400 {
  background-color: #f59e0b !important;
}
#alignment-view .bg-blue-400,
#vote-comparison-panel .bg-blue-400 {
  background-color: var(--ca-primary) !important;
}
#alignment-view .bg-gray-100,
#vote-explorer-view .bg-gray-100,
#vote-comparison-panel .bg-gray-100,
#alignment-details-modal .bg-gray-100 {
  background-color: #f3f4f6 !important;
}
#alignment-view .bg-gray-200,
#vote-explorer-view .bg-gray-200 {
  background-color: #e5e7eb !important;
}

/* --- Text color refinements --- */
#alignment-view .text-green-600,
#vote-explorer-view .text-green-600,
#vote-comparison-panel .text-green-600,
#alignment-details-modal .text-green-600 { color: #16a34a !important; }
#alignment-view .text-red-500,
#vote-explorer-view .text-red-500,
#vote-comparison-panel .text-red-500,
#alignment-details-modal .text-red-500 { color: #ef4444 !important; }
#alignment-view .text-red-600,
#vote-comparison-panel .text-red-600 { color: #dc2626 !important; }
#alignment-view .text-yellow-600,
#vote-explorer-view .text-yellow-600,
#vote-comparison-panel .text-yellow-600 { color: #b45309 !important; }

/* --- Alignment view: detail button (bg-blue-50 pill showing %) --- */
.alignment-detail-btn {
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
  color: var(--ca-primary) !important;
  background-color: #f0f4ff !important;
  border: 1px solid var(--ca-primary-light, #dbeafe) !important;
  border-radius: 0.5rem !important;
  padding: 0.25rem 0.6rem !important;
  transition: background-color .15s, color .15s !important;
}
.alignment-detail-btn:hover {
  background-color: var(--ca-primary) !important;
  color: #fff !important;
}
.alignment-detail-btn i { color: inherit !important; opacity: .75 !important; }

/* --- Alignment view: compare button --- */
.compare-btn {
  font-family: 'Inter', system-ui, sans-serif !important;
  color: var(--ca-primary) !important;
  background-color: #fff !important;
  border: 1px solid var(--ca-primary-light, #dbeafe) !important;
  border-radius: 0.5rem !important;
  padding: 0.25rem 0.6rem !important;
  transition: all .15s !important;
}
.compare-btn:hover {
  background-color: var(--ca-primary) !important;
  color: var(--ca-gold, #FFCC00) !important;
  border-color: var(--ca-primary) !important;
}

/* --- Alignment MEP rows --- */
#alignment-view tbody tr {
  border-bottom: 1px solid #f1f5f9 !important;
}
#alignment-view tbody tr:hover {
  background-color: #f8fafc !important;
}
#alignment-view .font-medium,
#vote-explorer-view .font-semibold,
#vote-explorer-view .font-medium { font-family: 'Inter', system-ui, sans-serif !important; }

/* --- Alignment: category pills rendered via JS --- */
#alignment-view .cat-pill {
  font-family: 'Inter', system-ui, sans-serif !important;
  border-radius: 999px !important;
  border: 1px solid #e5e7eb !important;
  background: #fff !important;
  color: #374151 !important;
  transition: all .15s !important;
}
#alignment-view .cat-pill.active,
#alignment-view .cat-pill.bg-purple-600,
#alignment-view .cat-pill.bg-blue-600 {
  background: var(--ca-primary) !important;
  color: #fff !important;
  border-color: var(--ca-primary) !important;
}

/* --- Alignment Details Modal --- */
#alignment-details-modal .bg-white {
  border-radius: 0.75rem !important;
  border: 1px solid #e5e7eb !important;
}
#alignment-details-modal h3,
#alignment-details-modal #ad-modal-title {
  font-family: 'Sora', 'Inter', sans-serif !important;
  color: var(--ca-primary) !important;
}
#alignment-details-modal .bg-gray-50 { background-color: #f8fafc !important; }
#alignment-details-modal .modal-cat-pill {
  font-family: 'Inter', sans-serif !important;
  border-radius: 999px !important;
  transition: all .15s !important;
}
#alignment-details-modal .modal-cat-pill.bg-blue-100 {
  background-color: var(--ca-primary) !important;
  color: #fff !important;
  border-color: var(--ca-primary) !important;
}
#alignment-details-modal .modal-cat-pill.bg-gray-100 {
  background-color: #fff !important;
  color: #374151 !important;
  border-color: #e5e7eb !important;
}
#alignment-details-modal .dossier-item {
  border-bottom: 1px solid #f1f5f9 !important;
}
#alignment-details-modal .text-blue-500,
#alignment-details-modal .text-blue-600 { color: var(--ca-primary) !important; }

/* --- Vote Explorer: dossier group cards --- */
#vote-explorer-view .ve-doc-group {
  border: 1px solid #e5e7eb !important;
  border-radius: 0.5rem !important;
  margin-bottom: 0.75rem !important;
  overflow: hidden !important;
  background: #fff !important;
}
#vote-explorer-view .ve-final-vote {
  transition: background-color .15s !important;
}
#vote-explorer-view .ve-final-vote:hover,
#vote-explorer-view .hover\:bg-gray-50:hover {
  background-color: #f0f4ff !important;
}
#vote-explorer-view .ve-final-vote .font-semibold {
  font-family: 'Sora', 'Inter', sans-serif !important;
  color: var(--ca-primary) !important;
}

/* Mono doc-ref badges */
#vote-explorer-view .font-mono,
#alignment-details-modal .font-mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
  background: #f3f4f6 !important;
  padding: 0.1rem 0.4rem !important;
  border-radius: 0.25rem !important;
  border: 1px solid #e5e7eb !important;
  color: #374151 !important;
}

/* Category badges (bg-blue-50) */
#vote-explorer-view .bg-blue-50,
#alignment-details-modal .bg-blue-50 {
  background-color: #f0f4ff !important;
  color: var(--ca-primary) !important;
  border: 1px solid var(--ca-primary-light, #dbeafe) !important;
}
#vote-explorer-view .text-blue-600,
#vote-explorer-view .text-blue-500 { color: var(--ca-primary) !important; }

/* Toggle subs button */
#vote-explorer-view .ve-toggle-subs {
  font-family: 'Inter', sans-serif !important;
  color: var(--ca-primary) !important;
  background: transparent !important;
  border: none !important;
  padding: 0.25rem 0 !important;
}
#vote-explorer-view .ve-toggle-subs:hover {
  text-decoration: underline !important;
  color: var(--ca-primary-dark, #002266) !important;
}

/* Sub-votes container */
#vote-explorer-view .ve-sub-votes {
  background-color: #f8fafc !important;
  border-top: 1px solid #e5e7eb !important;
}
#vote-explorer-view .ve-sub-vote:hover { background-color: #f0f4ff !important; }

/* Vote detail expansion panel */
#vote-explorer-view .ve-vote-detail {
  background-color: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 0.5rem !important;
  margin-top: 0.5rem !important;
}
#vote-explorer-view .ve-vote-detail h4 {
  font-family: 'Sora', 'Inter', sans-serif !important;
  color: var(--ca-primary) !important;
}
#vote-explorer-view .ve-vote-detail h5 {
  font-family: 'Sora', 'Inter', sans-serif !important;
  color: #1f2937 !important;
}

/* Filter inputs in detail panel */
#vote-explorer-view .ve-detail-search,
#vote-explorer-view .ve-detail-group,
#vote-explorer-view .ve-detail-country,
#vote-explorer-view .ve-detail-direction {
  border: 1px solid #e5e7eb !important;
  border-radius: 0.5rem !important;
  font-family: 'Inter', sans-serif !important;
}
#vote-explorer-view .ve-detail-search:focus,
#vote-explorer-view .ve-detail-group:focus,
#vote-explorer-view .ve-detail-country:focus,
#vote-explorer-view .ve-detail-direction:focus {
  outline: none !important;
  border-color: var(--ca-primary) !important;
  box-shadow: 0 0 0 2px rgba(0, 51, 153, 0.15) !important;
}

/* Group breakdown table */
#vote-explorer-view .ve-vote-detail table {
  border: 1px solid #e5e7eb !important;
  border-radius: 0.5rem !important;
  overflow: hidden !important;
}
#vote-explorer-view .ve-vote-detail thead {
  background-color: #f8fafc !important;
}
#vote-explorer-view .ve-vote-detail thead th {
  font-family: 'Sora', 'Inter', sans-serif !important;
  color: var(--ca-primary) !important;
  text-transform: uppercase !important;
  font-size: 0.7rem !important;
  letter-spacing: 0.03em !important;
}

/* Numeric counters */
#vote-explorer-view td.text-center,
#alignment-view td.text-right,
#vote-comparison-panel .text-2xl,
#vote-comparison-panel .text-3xl {
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
}

/* --- Vote Comparison: cohesion cards --- */
#vote-comparison-panel .rounded-lg.border {
  border-radius: 0.75rem !important;
  border: 1px solid #e5e7eb !important;
  background: #fff !important;
  padding: 0.85rem !important;
}
#vote-comparison-panel h3 {
  font-family: 'Sora', 'Inter', sans-serif !important;
  color: var(--ca-primary) !important;
}
#vote-comparison-panel .text-2xl,
#vote-comparison-panel .text-3xl {
  color: var(--ca-primary) !important;
}
#vote-comparison-panel details {
  border: 1px solid #e5e7eb !important;
  border-radius: 0.5rem !important;
  background: #fff !important;
}
#vote-comparison-panel details summary:hover { background-color: #f0f4ff !important; }
#vote-comparison-panel details[open] summary .fa-chevron-down,
#alignment-details-modal details[open] summary .fa-chevron-down { transform: rotate(180deg); }

/* ===============================================
   RESPONSIVE — Mobile
   =============================================== */

/* Hamburger toggle button — hidden on desktop */
.ca-nav-toggle {
  display: none;
}

@media (max-width: 1023px) {
  /* Mobile containment: prevent flex children from overflowing viewport */
  .main-content {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .table-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Touch targets for flag chips and pagination */
  .flag-item {
    min-height: 44px;
    min-width: 44px;
    padding: 0.35rem 0.6rem;
    box-sizing: border-box;
  }
  .pg-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0.375rem 0.75rem;
  }

  /* Hide inline nav links; shown via dropdown when nav-open */
  .ca-nav-links {
    display: none;
  }

  /* Show hamburger button */
  .ca-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ca-primary, #003399);
    font-size: 1.5rem;
    line-height: 1;
    margin-left: auto;
    padding: 0;
    flex-shrink: 0;
  }

  .ca-nav-toggle:focus {
    outline: 2px solid var(--ca-primary, #003399);
    outline-offset: 2px;
    border-radius: 4px;
  }

  /* Mobile dropdown: appears below 64px nav bar when nav-open */
  .ca-nav.nav-open .ca-nav-links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 2px solid var(--ca-primary, #003399);
    padding: 0.5rem 0;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.10);
  }

  .ca-nav.nav-open .ca-nav-links a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--ca-primary, #003399);
    text-decoration: none;
    border-bottom: 1px solid #f0f2f5;
  }

  .ca-nav.nav-open .ca-nav-links a:last-child {
    border-bottom: none;
  }

  /* In the stacked mobile menu, drop the desktop main/secondary gap */
  .ca-nav.nav-open .ca-nav-links a.nav-main + a:not(.nav-main) {
    margin-left: 0;
  }

  .ca-nav.nav-open .ca-nav-links a:hover,
  .ca-nav.nav-open .ca-nav-links a.active {
    background: #f0f4ff;
    color: var(--ca-primary, #003399);
  }

  /* Ensure nav bar uses position:relative so dropdown is anchored */
  .ca-nav {
    position: relative;
  }

  .ca-hero {
    padding: 1.5rem 1rem 0.75rem;
  }

  .ca-hero h1 {
    font-size: 1.5rem;
  }

  .ca-footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .ca-col-selector,
  .col-selector {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}
