/* ========== BASE LAYOUT ========== */
.caq-quiz-root {
  max-width: 900px;
  margin: 1.5rem auto;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
  font-size: 1rem;
}

.caq-header {
  margin-bottom: 1rem;
}

.caq-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.caq-title {
  margin: 0;
  font-size: 1.4rem;
}

.caq-subtitle {
  margin: 0.4rem 0 0.6rem;
  font-size: 0.95rem;
  color: #444;
}

.caq-header-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ========== LANGUAGE BUTTONS ========== */
.caq-lang-toggle {
  display: inline-flex;
  gap: 0.25rem;
}

.caq-lang-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5f5;
  background: #e5edff;
  cursor: pointer;
  font-size: 0.8rem;
  color: #1f2933;
}

/* Spanish button: darker text when inactive */
.caq-lang-btn[data-lang="es"] {
  color: #111827; /* dark gray/near black */
}

.caq-lang-btn--active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff !important;
  font-weight: 600;
}

/* ========== ACCESSIBILITY BUTTON & PANEL ========== */
.caq-access-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5f5;
  background: #e5edff;
  cursor: pointer;
  font-size: 0.8rem;
  color: #1f2933;
}

/* When active, match blue of lang active button */
.caq-access-btn.caq-access-btn--active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
  font-weight: 600;
}

.caq-access-panel {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  background: #f9fafb;
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
}

.caq-access-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.caq-access-row label {
  font-size: 0.82rem;
  font-weight: 500;
  color: #374151;
}

.caq-access-row select {
  font-size: 0.82rem;
  padding: 4px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #ffffff;
}

.caq-access-section label {
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.caq-access-section select {
  font-size: 0.82rem;
}

/* ========== PROGRESS ========== */
.caq-progress {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #333;
}

/* ========== QUESTION LAYOUT (TWO-COLUMN RESPONSIVE) ========== */
.caq-questions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.caq-question {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafafa;
}

.caq-question-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.5fr) minmax(0, 1.2fr);
  gap: 0.75rem;
  align-items: flex-start;
}

.caq-question-issue {
  font-size: 0.8rem;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.caq-question-text {
  font-weight: 500;
  margin-bottom: 4px;
}

.caq-question-tags {
  margin-bottom: 4px;
}

.caq-tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  margin-right: 4px;
  margin-bottom: 2px;
}

.caq-options {
  margin-top: 4px;
}

.caq-option-label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 2px;
  cursor: pointer;
}

.caq-question-side {
  border-left: 1px dashed #e5e7eb;
  padding-left: 8px;
}

.caq-importance {
  font-size: 0.8rem;
  color: #444;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.caq-importance-label {
  font-weight: 500;
}

.caq-importance-select {
  font-size: 0.8rem;
}

/* Stack columns on small screens */
@media (max-width: 640px) {
  .caq-question-layout {
    grid-template-columns: 1fr;
  }

  .caq-question-side {
    border-left: none;
    border-top: 1px dashed #e5e7eb;
    padding-left: 0;
    padding-top: 6px;
    margin-top: 6px;
  }
}

/* ========== ACTION BUTTONS ========== */
.caq-actions {
  margin-top: 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.caq-actions button {
  padding: 7px 14px;
  font-size: 0.9rem;
  border-radius: 999px;
  border: none;
  background: #2563eb;   /* blue */
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.caq-actions button:nth-child(2) {
  background: #6b7280;   /* gray for Print/PDF */
}

.caq-actions button:hover:not(:disabled) {
  filter: brightness(1.07);
}

.caq-actions button:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

/* ========== RESULTS — PARTY CARDS ========== */
#caq-results,
#caq-issue-comparison,
#caq-ideology,
#caq-patterns {
  margin-top: 1rem;
}

.caq-party-card {
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  margin-top: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15,23,42,0.06);
}

.caq-party-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 4px;
}

.caq-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  font-size: 0.75rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 600;
}

.caq-party-name {
  font-weight: 600;
  font-size: 1rem;
  flex: 1 1 auto;
}

.caq-party-percent {
  font-weight: 600;
  font-size: 1rem;
  color: #111827;
}

.caq-party-blurb {
  font-size: 0.86rem;
  color: #4b5563;
  margin-top: 4px;
}

.caq-party-issues-heading {
  font-size: 0.8rem;
  margin-top: 6px;
  font-weight: 600;
}

.caq-party-issues-list {
  margin: 4px 0;
  padding-left: 18px;
  font-size: 0.8rem;
}

.caq-party-policies-heading {
  font-size: 0.8rem;
  margin-top: 4px;
  font-weight: 600;
}

.caq-party-policies {
  margin: 4px 0 4px 18px;
  padding-left: 16px;
  font-size: 0.8rem;
}

/* ========== ISSUE COMPARISON TABLE ========== */
.caq-issue-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.85rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.caq-issue-table thead {
  background: #f3f4f6;
}

.caq-issue-table th {
  border: 1px solid #d1d5db;
  padding: 8px 10px;
  text-align: center;
  font-weight: 600;
  color: #374151;
}

.caq-issue-table th:first-child {
  text-align: left;
  background: #e5e7eb;
}

.caq-issue-table td {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  text-align: center;
}

.caq-issue-table td.caq-issue-name {
  text-align: left;
  font-weight: 500;
  background: #f9fafb;
}

.caq-issue-table td.caq-issue-value {
  font-weight: 600;
}

/* Color coding for match levels */
.caq-issue-table td.caq-match-high {
  background: #d1fae5;
  color: #065f46;
}

.caq-issue-table td.caq-match-medium {
  background: #fef3c7;
  color: #92400e;
}

.caq-issue-table td.caq-match-low {
  background: #fee2e2;
  color: #991b1b;
}

.caq-issue-table td.caq-match-none {
  background: #f3f4f6;
  color: #9ca3af;
}

/* ========== IDEOLOGY SECTION ========== */
.caq-ideo-item {
  border-top: 1px solid #e5e7eb;
  padding-top: 6px;
  margin-top: 6px;
  font-size: 0.9rem;
}

.caq-ideo-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.caq-ideo-desc {
  font-size: 0.85rem;
  color: #444;
}

.caq-ideo-examples {
  font-size: 0.8rem;
  color: #555;
  margin-top: 2px;
}

/* ========== PATTERN LIST ========== */
.caq-pattern-list {
  margin: 4px 0 0 18px;
  padding-left: 16px;
  font-size: 0.86rem;
}

/* ========== PRINT LAYOUT ========== */
@media print {
  .caq-lang-toggle,
  .caq-actions,
  .caq-access-btn,
  .caq-access-panel {
    display: none !important;
  }
  body {
    background: #ffffff;
  }
}

/* ========== ACCESSIBILITY CLASSES ========== */
/* Text size */
/* Text size: scale the root so all rem-based text grows, including answers */
html.caq-text-normal {
  font-size: 16px;
}

html.caq-text-large {
  font-size: 17.5px;
}

html.caq-text-xlarge {
  font-size: 19px;
}


/* Theme: high contrast */
html.caq-theme-normal .caq-quiz-root {
  background: #ffffff;
  color: #111827;
}

html.caq-theme-contrast .caq-quiz-root {
  background: #000000;
  color: #ffffff;
}

html.caq-theme-contrast .caq-question {
  background: #111827;
  border-color: #4b5563;
}

html.caq-theme-contrast .caq-party-card {
  background: #111827;
  border-color: #4b5563;
}

/* Make sure everything is readable in high-contrast mode */
html.caq-theme-contrast .caq-quiz-root {
  color: #f9fafb;
}

html.caq-theme-contrast .caq-quiz-root *:not(.caq-explanation):not(.caq-explanation *) {
  color: #f9fafb !important;
}

/* Slightly lighter for secondary text */
html.caq-theme-contrast .caq-question-issue {
  color: #e5e7eb !important;
}

html.caq-theme-contrast .caq-tag {
  background: #4b5563;
  color: #f9fafb;
}

/* Buttons in high contrast */
html.caq-theme-contrast .caq-lang-btn,
html.caq-theme-contrast .caq-access-btn {
  background: #111827;
  border-color: #9ca3af;
}

/* Keep the "active" blue still distinct in contrast mode */
html.caq-theme-contrast .caq-lang-btn.caq-lang-btn--active,
html.caq-theme-contrast .caq-access-btn.caq-access-btn--active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff !important;
}

/* High-contrast fixes for Accessibility panel */
html.caq-theme-contrast .caq-access-panel {
  background: #111827;
  border-color: #9ca3af;
}

html.caq-theme-contrast .caq-access-panel label {
  color: #e5e7eb !important;
}

html.caq-theme-contrast .caq-access-panel select {
  background: #000000;
  color: #f9fafb;
  border-color: #9ca3af;
}

/* High contrast for importance dropdown */
html.caq-theme-contrast .caq-importance-select {
  background: #000000;
  color: #f9fafb;
  border: 1px solid #9ca3af;
}

html.caq-theme-contrast .caq-importance-label {
  color: #e5e7eb !important;
}

/* Dyslexia-friendly font (you can swap in your own hosted font) */
html.caq-font-default .caq-quiz-root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Import dyslexia-friendly font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600&display=swap');

html.caq-font-dyslexic .caq-quiz-root {
  font-family: "Lexend", "Comic Sans MS", "Arial", sans-serif;
  letter-spacing: 0.02em;
  line-height: 1.6;
}

html.caq-font-dyslexic .caq-quiz-root .caq-question-text {
  line-height: 1.7;
}

/* Reduced motion */
html.caq-motion-reduced * {
  scroll-behavior: auto !important;
  animation: none !important;
  transition: none !important;
}

/* (Optional) If you host OpenDyslexic yourself, uncomment and fix the URL:
@font-face {
  font-family: "OpenDyslexic";
  src: url("PATH/TO/OpenDyslexic-Regular.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
}
*/

/* ===== NEW FEATURES v0.9.0 ===== */

/* Party Logos */
.caq-party-logo {
    max-width: 100px;
    max-height: 70px;
    margin: 0 auto 15px;
    display: block;
    object-fit: contain;
}

.caq-party-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Explain Button */
.caq-explain-btn {
    background: #2271b1;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 15px;
    transition: background 0.3s;
}

.caq-explain-btn:hover {
    background: #135e96;
}

.caq-explanation {
    background: #f0f6fc;
    border-left: 4px solid #2271b1;
    padding: 15px;
    margin-top: 10px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
}

/* Topics List */
.caq-topics-section {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin: 30px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.caq-topics-section h3 {
    cursor: pointer;
    user-select: none;
    margin: 0;
    padding: 0;
    font-size: 20px;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.caq-topics-list {
    display: none;
    list-style: disc;
    padding-left: 30px;
    margin-top: 15px;
    font-size: 16px;
    line-height: 1.8;
}

.caq-topics-section.expanded .caq-topics-list {
    display: block;
}

.caq-toggle {
    float: right;
    transition: transform 0.3s;
    font-size: 18px;
}

.caq-topics-section.expanded .caq-toggle {
    transform: rotate(180deg);
}

/* Party & Ideology Links */
.caq-party-link,
.caq-ideology-link {
    color: #2271b1;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.caq-party-link:hover,
.caq-ideology-link:hover {
    color: #135e96;
    text-decoration: underline;
}

/* Interest Groups */
.caq-interest-groups-section {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.caq-interest-groups-section h3 {
    margin-top: 0;
    font-size: 22px;
    color: #333;
}

.caq-interest-groups-section > p {
    color: #666;
    font-size: 15px;
    margin-bottom: 20px;
}

.caq-topic-groups {
    margin: 25px 0;
}

.caq-topic-groups h4 {
    font-size: 18px;
    color: #2271b1;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

.caq-groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.caq-group-card {
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 18px;
    background: white;
    transition: all 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.caq-group-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.caq-group-card.liberal {
    border-color: #4a90e2;
}

.caq-group-card.conservative {
    border-color: #e24a4a;
}

.caq-group-card h5 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.caq-group-card a {
    color: #2271b1;
    text-decoration: none;
    font-weight: 600;
}

.caq-group-card a:hover {
    text-decoration: underline;
}

.caq-leaning-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.caq-group-card.liberal .caq-leaning-badge {
    background: #e3f2fd;
    color: #1976d2;
}

.caq-group-card.conservative .caq-leaning-badge {
    background: #ffebee;
    color: #c62828;
}

.caq-group-card p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 10px 0 0 0;
}

/* Ideology Key Points */
.caq-ideology-key-points {
    list-style: disc;
    padding-left: 25px;
    margin: 12px 0 0 0;
    font-size: 14px;
    color: #555;
    line-height: 1.7;
}

.caq-ideology-key-points li {
    margin: 6px 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .caq-groups-grid {
        grid-template-columns: 1fr;
    }
    
    .caq-party-logo {
        max-width: 80px;
        max-height: 60px;
    }
}

/* Interest Groups Table (new alignment-based layout) */
.caq-interest-groups-table {
    margin-top: 20px;
}

.caq-interest-groups-table th:first-child {
    width: 20%;
}

.caq-interest-groups-table th:nth-child(2) {
    width: 15%;
}

.caq-interest-groups-table th:nth-child(3) {
    width: 65%;
}

.caq-groups-cell {
    text-align: left !important;
}

.caq-groups-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}

.caq-group-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #d1d5db;
}

.caq-group-item.liberal {
    border-left-color: #4a90e2;
    background: #eff6ff;
}

.caq-group-item.conservative {
    border-left-color: #e24a4a;
    background: #fef2f2;
}

.caq-group-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.caq-group-name a {
    color: #2271b1;
    text-decoration: none;
}

.caq-group-name a:hover {
    text-decoration: underline;
}

.caq-group-item .caq-leaning-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.caq-group-item.liberal .caq-leaning-badge {
    background: #dbeafe;
    color: #1e40af;
}

.caq-group-item.conservative .caq-leaning-badge {
    background: #fee2e2;
    color: #991b1b;
}

.caq-group-desc {
    font-size: 0.85rem;
    color: #6b7280;
    flex-basis: 100%;
}

/* Responsive: stack table on mobile */
@media (max-width: 768px) {
    .caq-interest-groups-table {
        font-size: 0.8rem;
    }
    
    .caq-interest-groups-table th,
    .caq-interest-groups-table td {
        padding: 6px 8px;
    }
    
    .caq-group-item {
        padding: 6px 8px;
        gap: 6px;
    }
}


/* ===== INTEREST GROUPS CARDS ===== */
.caq-interest-groups-section {
  margin: 40px 0;
}

.caq-interest-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 30px 0 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #2271b1;
}

.caq-interest-category-header h4 {
  margin: 0;
  font-size: 1.3em;
  color: #1d2327;
}

.caq-category-score {
  font-size: 1.1em;
  font-weight: 600;
  color: #2271b1;
}

.caq-groups-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.caq-group-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.caq-group-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

.caq-group-card-name {
  font-size: 1.2em;
  font-weight: 600;
  color: #1d2327;
  margin-bottom: 10px;
}

.caq-group-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 600;
  margin-bottom: 12px;
}

.caq-badge-liberal,
.caq-badge-progressive {
  background: #d4edff;
  color: #0066cc;
}

.caq-badge-conservative,
.caq-badge-libertarian {
  background: #ffe4e4;
  color: #cc0000;
}

.caq-group-card-desc {
  color: #50575e;
  font-size: 0.95em;
  line-height: 1.5;
  margin-bottom: 15px;
}

.caq-group-card-link {
  display: inline-block;
  color: #2271b1;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9em;
  margin-top: 10px;
}

.caq-group-card-link:hover {
  text-decoration: underline;
}

/* ===== IDEOLOGY CARDS ===== */
.caq-ideology-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.caq-ideology-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.caq-ideology-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

.caq-ideology-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f0f0;
}

.caq-ideology-card-name {
  font-size: 1.3em;
  font-weight: 600;
  color: #1d2327;
}

.caq-ideology-card-percent {
  font-size: 1.5em;
  font-weight: 700;
  color: #2271b1;
}

.caq-ideology-card-desc {
  color: #50575e;
  font-size: 0.95em;
  line-height: 1.6;
  margin-bottom: 15px;
}

.caq-ideology-card-points {
  list-style: none;
  padding: 0;
  margin: 15px 0;
}

.caq-ideology-card-points li {
  padding-left: 20px;
  margin-bottom: 8px;
  position: relative;
  color: #50575e;
  font-size: 0.9em;
  line-height: 1.5;
}

.caq-ideology-card-points li:before {
  content: "•";
  position: absolute;
  left: 0;
  color: #2271b1;
  font-weight: bold;
}

.caq-ideology-card-examples {
  color: #787c82;
  font-size: 0.85em;
  font-style: italic;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.caq-ideology-card-link {
  display: inline-block;
  color: #2271b1;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9em;
  margin-top: 12px;
}

.caq-ideology-card-link:hover {
  text-decoration: underline;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .caq-groups-cards,
  .caq-ideology-cards {
    grid-template-columns: 1fr;
  }
  
  .caq-interest-category-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .caq-category-score {
    margin-top: 5px;
  }
}

/* ========== ENHANCED INTEREST GROUPS STYLING ========== */

.caq-groups-cards-enhanced {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.caq-group-card-enhanced {
  position: relative;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.25rem;
  background: #ffffff;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.caq-group-card-enhanced:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

/* Top match badge */
.caq-top-match-badge {
  position: absolute;
  top: -10px;
  right: 15px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #ffffff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
  letter-spacing: 0.5px;
}

/* Card header with name and score */
.caq-group-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.caq-group-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.3;
  flex: 1;
}

.caq-group-card-score {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* Leaning badge - enhanced styling */
.caq-group-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.caq-badge-progressive {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.caq-badge-liberal {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.caq-badge-conservative {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.caq-badge-libertarian {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.caq-badge-moderate {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

/* Description */
.caq-group-card-desc {
  font-size: 0.9rem;
  color: #4b5563;
  line-height: 1.5;
  margin-bottom: 1rem;
}

/* Match explanation - NEW transparency feature */
.caq-match-explanation {
  background: #f0f9ff;
  border-left: 3px solid #3b82f6;
  padding: 0.75rem;
  border-radius: 6px;
  margin: 1rem 0;
}

.caq-match-explanation-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e40af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.caq-match-explanation-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.caq-match-explanation-list li {
  font-size: 0.85rem;
  color: #1f2937;
  padding: 0.25rem 0;
  line-height: 1.4;
}

.caq-match-explanation-list li::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  background: #3b82f6;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* Link button */
.caq-group-card-link {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 8px 16px;
  background: #3b82f6;
  color: #ffffff !important;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.caq-group-card-link:hover {
  background: #2563eb;
  transform: translateX(3px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .caq-groups-cards-enhanced {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .caq-group-card-enhanced {
    padding: 1rem;
  }
  
  .caq-group-card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .caq-group-card-score {
    align-self: flex-start;
  }
}

/* High contrast mode adjustments */
.caq-theme-contrast .caq-group-card-enhanced {
  border-width: 3px;
  border-color: #000000;
}

.caq-theme-contrast .caq-group-card-score {
  background: #000000;
  color: #ffffff;
}

.caq-theme-contrast .caq-match-explanation {
  background: #ffffff;
  border-color: #000000;
  border-width: 2px;
}

.caq-theme-contrast .caq-top-match-badge {
  background: #000000;
  color: #ffff00;
}

/* Reduced motion */
.caq-motion-reduced .caq-group-card-enhanced {
  transition: none;
}

.caq-motion-reduced .caq-group-card-enhanced:hover {
  transform: none;
}

.caq-motion-reduced .caq-group-card-link:hover {
  transform: none;
}

/* Ideology alignment list (similar to party issues) */
.caq-ideology-alignment-heading {
  font-size: 0.85em;
  font-weight: 600;
  color: #2271b1;
  margin-top: 15px;
  margin-bottom: 8px;
}

.caq-ideology-alignment-list {
  list-style: none;
  padding: 0;
  margin: 0 0 15px 0;
}

.caq-ideology-alignment-list li {
  padding: 4px 0 4px 20px;
  font-size: 0.9em;
  color: #50575e;
  position: relative;
}

.caq-ideology-alignment-list li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #2271b1;
  font-weight: bold;
}

/* High contrast mode - preserve explanation readability */
html.caq-theme-contrast .caq-explanation {
  background: #1f2937;
  border-left-color: #60a5fa;
  color: #e5e7eb !important;
}
