/* PollingSource Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* ============================================
       PHASE 1: CSS CUSTOM PROPERTIES FOUNDATION
       Created: October 27, 2025
       Purpose: Dynamic CSS migration - all variables in one place
       ============================================ */

    /* === BRAND COLORS === */
    --brand-primary: #002349;      /* Dark Royal Blue - header background */
    --brand-secondary: #1D63FF;    /* Prussian Blue - links, accents */
    --brand-accent: #957C3D;       /* Gold - borders, highlights */
    --brand-light-blue: #B8D4FF;   /* Very light Prussian blue - countdown timer */

    /* === ELECTORAL MAP COLORS === */
    /* Democrat shades (blue) */
    --dem-strong: #1a4c8b;         /* Safe Democratic */
    --dem-medium: #3d7ac7;         /* Likely Democratic */
    --dem-light: #6fa3e3;          /* Lean Democratic */
    --dem-tilt: #a5c9f5;           /* Tilt Democratic */

    /* Republican shades (red) */
    --rep-strong: #b91c1c;         /* Safe Republican */
    --rep-medium: #dc2626;         /* Likely Republican */
    --rep-light: #f87171;          /* Lean Republican */
    --rep-tilt: #fca5a5;           /* Tilt Republican */

    /* Neutral */
    --tossup: #9ca3af;             /* Toss-up / No clear leader */

    /* === BACKGROUND COLORS === */
    --bg-primary: #ffffff;         /* Primary background (white) */
    --bg-secondary: #F8F9FA;       /* Secondary background (light gray) */
    --bg-light: #F8F9FA;           /* Alias for bg-secondary (backward compat) */
    --bg-white: #ffffff;           /* Alias for bg-primary (backward compat) */
    --bg-hover: #f1f5f9;           /* Hover state background */
    --bg-dark: #1a1a1a;            /* Dark backgrounds (future use) */

    /* === TEXT COLORS === */
    --text-primary: #1a1a1a;       /* Primary text (near black) */
    --text-secondary: #5a5a5a;     /* Secondary text (medium gray) */
    --text-tertiary: #9ca3af;      /* Tertiary text (light gray) */
    --text-dark: #1a1a1a;          /* Alias for text-primary (backward compat) */
    --text-gray: #5a5a5a;          /* Alias for text-secondary (backward compat) */
    --text-light: #ffffff;         /* Light text on dark backgrounds */
    --text-link: var(--brand-secondary); /* Link color */
    --text-link-hover: var(--brand-primary); /* Link hover color */

    /* === BORDER COLORS === */
    --border-color: #E0E4E8;       /* Default border color */
    --border: #E0E4E8;             /* Alias (backward compat) */
    --border-light: #f1f5f9;       /* Light borders */
    --border-dark: #cbd5e1;        /* Darker borders */

    /* === SPACING SCALE (8px grid system) === */
    --space-xs: 0.5rem;    /* 8px */
    --space-sm: 1rem;      /* 16px */
    --space-md: 1.5rem;    /* 24px */
    --space-lg: 2rem;      /* 32px */
    --space-xl: 3rem;      /* 48px */
    --space-2xl: 4rem;     /* 64px */
    --space-3xl: 6rem;     /* 96px */

    /* NOTE: Starting with 8px grid. May migrate to 4px grid (0.25rem increments)
       if finer control needed for page requirements. See DYNAMIC_CSS_MIGRATION_PLAN.md */

    /* === TYPOGRAPHY SCALE (Fluid) === */
    /* These use clamp() for responsive sizing */
    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);      /* 12px - 14px */
    --text-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);        /* 14px - 16px */
    --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);        /* 16px - 18px */
    --text-lg: clamp(1.125rem, 1rem + 0.625vw, 1.25rem);       /* 18px - 20px */
    --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);        /* 20px - 24px */
    --text-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);             /* 24px - 32px */
    --text-3xl: clamp(2rem, 1.7rem + 1.5vw, 2.5rem);           /* 32px - 40px */

    /* === BREAKPOINTS (for reference - not actual @media queries) === */
    /* These are documented for consistency, actual @media uses px values */
    --bp-mobile: 480px;     /* Small phones */
    --bp-tablet: 768px;     /* Tablets and large phones */
    --bp-desktop: 1024px;   /* Desktop */
    --bp-wide: 1440px;      /* Large desktop */

    /* NOTE: Breakpoints can be revisited during implementation if needed.
       See DYNAMIC_CSS_MIGRATION_PLAN.md */

    /* === CONTAINER MAX-WIDTHS === */
    --container-sm: 640px;   /* Small container */
    --container-md: 768px;   /* Medium container */
    --container-lg: 1024px;  /* Large container */
    --container-xl: 1280px;  /* Extra large container */

    /* === TRANSITIONS === */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* === SHADOWS === */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-base: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.2);

    /* === BORDER RADIUS === */
    --radius-sm: 4px;
    --radius-base: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;  /* For pills/circles */

    /* === Z-INDEX SCALE === */
    --z-dropdown: 1000;
    --z-sticky: 1010;
    --z-fixed: 1020;
    --z-modal-backdrop: 1030;
    --z-modal: 1040;
    --z-popover: 1050;
    --z-tooltip: 1060;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
}

/* ============================================
   CONTAINER SYSTEM - Responsive Containers
   ============================================ */

.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

/* Responsive container max-widths */
@media (min-width: 640px) {
    .container {
        max-width: var(--container-sm);
    }
}

@media (min-width: 768px) {
    .container {
        max-width: var(--container-md);
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: var(--container-lg);
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: var(--container-xl);
    }
}

/* Container size variations (for future use) */
.container-sm {
    max-width: var(--container-sm);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

.container-md {
    max-width: var(--container-md);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

.container-lg {
    max-width: var(--container-lg);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

.container-xl {
    max-width: var(--container-xl);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

/* Header */
/* ============================================
   PHASE 2: RESPONSIVE HEADER & NAVIGATION
   ============================================ */

.site-header {
    background: var(--brand-primary);  /* Dark royal blue */
    border-bottom: 3px solid var(--brand-accent);  /* Gold border */
    padding: clamp(1rem, 2vw, 1.5rem) 0;  /* Fluid padding: smaller mobile, larger desktop */
    margin-bottom: 0;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;  /* For hamburger positioning */
}

.logo-title {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Home link wrapper - preserves visual appearance while being clickable */
.site-home-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
}

.site-home-link:hover,
.site-home-link:visited,
.site-home-link:active {
    text-decoration: none;
    color: inherit;
}

.site-logo {
    width: clamp(60px, 10vw, 80px);  /* Fluid logo: 60-80px */
    height: clamp(60px, 10vw, 80px);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;  /* Prevent squishing */
}

.title-wrapper {
    flex: 1;
}

.site-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);  /* Fluid title size */
    font-weight: 800;
    color: var(--bg-white);  /* White on dark blue */
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.site-tagline {
    color: #B8C5D6;  /* Light blue-gray */
    font-size: clamp(0.9rem, 2vw, 1.1rem);  /* Fluid tagline */
    margin-bottom: 0;
}

/* Header Banner Box - Hidden on mobile/tablet, visible on desktop */
.header-banner {
    margin-left: auto;
    border: 2px solid var(--brand-accent);  /* Gold border */
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-white);
    box-shadow: 0 2px 4px rgba(149, 124, 61, 0.2);  /* Gold glow */
    display: none;  /* Hidden by default (mobile/tablet) */
}

.header-banner-image {
    display: block;
    height: 60px;
    width: auto;
    object-fit: contain;
}

/* Show banner on desktop (>1024px) */
@media (min-width: 1024px) {
    .header-banner {
        display: block;
    }

    .site-tagline {
        display: block;
    }

    .nav-divider {
        display: block;
    }
}

/* Hamburger Menu Button - Mobile/Tablet only */
.hamburger-btn {
    display: none;  /* Hidden by default (desktop) */
    position: absolute;
    top: 0;
    right: 0;
    background: var(--brand-secondary);  /* Prussian blue */
    border: 2px solid var(--brand-accent);  /* Gold border */
    border-radius: 8px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    z-index: 100;
    transition: var(--transition-base);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
}

.hamburger-btn:hover {
    background: var(--brand-accent);
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--bg-white);
    border-radius: 2px;
    transition: var(--transition-base);
}

/* Hamburger animation when open */
.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Navigation - Desktop (visible by default) */
.main-nav {
    display: flex;
    gap: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 1rem;
    transition: var(--transition-base);
}

.main-nav a {
    text-decoration: none;
    color: var(--bg-white);  /* White links */
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: var(--transition-base);
}

.main-nav a:hover {
    background: var(--brand-accent);  /* Gold hover */
    color: var(--brand-primary);
}

.main-nav a.active {
    background: var(--brand-secondary);  /* Prussian blue */
    color: var(--bg-white);
}

.main-nav a.disabled {
    color: #6B8CAE;
    cursor: not-allowed;
    opacity: 0.6;
}

.main-nav a.disabled:hover {
    background: transparent;
    color: #6B8CAE;
}

/* Nav divider and login link */
.nav-divider {
    display: none;  /* Hidden on mobile */
    width: 1px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 0.5rem;
}

.nav-login {
    background: var(--brand-accent) !important;
    color: var(--brand-primary) !important;
}

.nav-login:hover {
    background: var(--bg-white) !important;
    color: var(--brand-primary) !important;
}

/* Nav Donate Button - same style as Login, pushed to far right */
.nav-donate {
    background: var(--brand-accent) !important;
    color: var(--brand-primary) !important;
    margin-left: auto;
}

.nav-donate:hover {
    background: var(--bg-white) !important;
    color: var(--brand-primary) !important;
}

/* Subscribe CTA Banner */
.subscribe-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    margin: 1rem auto;
    max-width: 600px;
    font-size: 0.95rem;
}

.subscribe-cta span {
    flex: 1;
}

.subscribe-btn {
    background: var(--brand-accent);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.subscribe-btn:hover {
    background: #7a6531;
}

@media (max-width: 600px) {
    .subscribe-cta {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .subscribe-btn {
        width: 100%;
        text-align: center;
    }
}

/* Mobile/Tablet Navigation (≤768px) */
@media (max-width: 768px) {
    /* Hide tagline on mobile/tablet */
    .site-tagline {
        display: none;
    }

    /* Show hamburger button */
    .hamburger-btn {
        display: flex;
    }

    /* Hide navigation by default */
    .main-nav {
        display: none;
        flex-direction: column;
        gap: 0;
        border-top: none;
        padding-top: 0;
        margin-top: 1rem;
        background: var(--brand-primary);
        border-radius: 8px;
        overflow: hidden;
    }

    /* Show navigation when active */
    .main-nav.active {
        display: flex;
    }

    /* Dropdown menu styling */
    .main-nav a {
        padding: 1rem;
        border-radius: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .main-nav a:last-child {
        border-bottom: none;
    }
}

/* Electoral Counter */
.electoral-counter {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.counter-bar {
    display: flex;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.democrat-bar {
    background: linear-gradient(135deg, var(--dem-strong) 0%, var(--dem-medium) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.republican-bar {
    background: linear-gradient(135deg, var(--rep-medium) 0%, var(--rep-strong) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.tossup-bar {
    background: var(--tossup);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.counter-note {
    text-align: center;
    color: var(--text-gray);
    font-size: 0.95rem;
}

/* States Grid */
.states-section {
    margin-bottom: 3rem;
}

.states-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.states-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.state-card {
    background: var(--bg-white);
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s;
    border: 2px solid var(--brand-secondary);  /* Prussian blue border */
    border-left: 4px solid var(--tossup);  /* Rating color on left */
}

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

/* State Rating Colors */
.state-card.safe-dem { border-left-color: var(--dem-strong); }
.state-card.likely-dem { border-left-color: var(--dem-medium); }
.state-card.lean-dem { border-left-color: var(--dem-light); }
.state-card.tilt-dem { border-left-color: var(--dem-tilt); }
.state-card.safe-rep { border-left-color: var(--rep-strong); }
.state-card.likely-rep { border-left-color: var(--rep-medium); }
.state-card.lean-rep { border-left-color: var(--rep-light); }
.state-card.tilt-rep { border-left-color: var(--rep-tilt); }
.state-card.tossup { border-left-color: var(--tossup); }

.state-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.state-header h3 {
    font-size: 1.25rem;
    color: var(--text-dark);
}

.electoral-votes {
    background: var(--bg-light);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-gray);
}

.state-data {
    margin-bottom: 1rem;
}

.poll-results {
    margin-bottom: 0.75rem;
}

.result-bar {
    display: flex;
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.dem-bar {
    background: var(--dem-medium);
}

.rep-bar {
    background: var(--rep-medium);
}

.result-numbers {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
}

.result-numbers .dem { color: var(--dem-strong); }
.result-numbers .rep { color: var(--rep-strong); }
.result-numbers .separator { color: var(--text-gray); }

.state-rating {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rating-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    background: var(--bg-light);
    color: var(--text-dark);
}

.poll-count {
    font-size: 0.85rem;
    color: var(--text-gray);
}

.no-polls {
    text-align: center;
    padding: 1rem 0;
}

.no-data {
    color: var(--text-gray);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.state-link {
    display: block;
    text-align: center;
    padding: 0.5rem;
    color: var(--dem-medium);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
    padding-top: 1rem;
    transition: color 0.2s;
}

.state-link:hover {
    color: var(--dem-strong);
}

/* Methodology */
.methodology {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.methodology h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.methodology p {
    color: var(--text-gray);
    margin-bottom: 1rem;
}

.methodology a {
    color: var(--dem-medium);
    text-decoration: none;
    font-weight: 600;
}

.methodology a:hover {
    text-decoration: underline;
}

/* Sticky Footer Donation Banner */
.donation-footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.donation-footer-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.donation-footer-text strong {
    font-size: 1rem;
    color: var(--text-dark);
}

.donation-footer-text span {
    font-size: 0.875rem;
    color: var(--text-gray);
}

.donation-footer-button {
    background: var(--brand-accent);  /* Gold */
    color: var(--brand-primary);  /* Dark blue text */
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
}

.donation-footer-button:hover {
    background: #B59556;  /* Lighter gold */
}

.donation-footer-button svg {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .donation-footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .donation-footer-text span {
        font-size: 0.8rem;
    }

    .donation-footer-button {
        width: 100%;
        justify-content: center;
    }
}

/* Footer */
.site-footer {
    background: var(--brand-primary);  /* Dark royal blue */
    color: var(--bg-white);
    padding: 2rem 0;
    margin-top: 0;
    text-align: center;
    border-top: 3px solid var(--brand-accent);  /* Gold accent */
}

.site-footer p {
    margin: 0.5rem 0;
    opacity: 0.9;
}

.site-footer a {
    color: var(--brand-accent);  /* Gold links */
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: #B59556;  /* Lighter gold */
    text-decoration: underline;
}

/* State Detail Page */
.breadcrumb {
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: var(--dem-medium);
    text-decoration: none;
    font-weight: 600;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.state-header-section {
    margin-bottom: 2rem;
}

.state-header-section h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.state-meta {
    display: flex;
    gap: 2rem;
    color: var(--text-gray);
    font-size: 1.1rem;
}

.current-average-box {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    border-left: 6px solid var(--tossup);
}

.current-average-box.safe-dem { border-left-color: var(--dem-strong); }
.current-average-box.likely-dem { border-left-color: var(--dem-medium); }
.current-average-box.lean-dem { border-left-color: var(--dem-light); }
.current-average-box.safe-rep { border-left-color: var(--rep-strong); }
.current-average-box.likely-rep { border-left-color: var(--rep-medium); }
.current-average-box.lean-rep { border-left-color: var(--rep-light); }

.current-average-box h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.current-average-box.no-data {
    text-align: center;
    padding: 3rem 2rem;
}

.average-bars {
    margin-bottom: 1.5rem;
}

.candidate-bar {
    margin-bottom: 1.5rem;
    position: relative;
}

.candidate-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.candidate-label .percentage {
    font-size: 2rem;
    font-weight: 800;
}

.dem-bar .candidate-label { color: #1a202c; }
.rep-bar .candidate-label { color: #1a202c; }

.candidate-bar .bar-fill {
    height: 40px;
    border-radius: 8px;
    transition: width 0.3s ease;
    background: var(--bg-light);
    position: relative;
    overflow: visible;
}

.dem-bar .bar-fill {
    background: linear-gradient(90deg, #2c5282 0%, #2d5a8d 100%);
    box-shadow: 0 2px 4px rgba(26, 76, 139, 0.3);
}

.rep-bar .bar-fill {
    background: linear-gradient(90deg, #a81c1c 0%, #b01f1f 100%);
    box-shadow: 0 2px 4px rgba(185, 28, 28, 0.3);
}

.average-details {
    display: flex;
    gap: 2rem;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 8px;
    flex-wrap: wrap;
}

.average-details > div {
    flex: 1;
    min-width: 150px;
}

.rating-display, .margin-display {
    font-size: 1.1rem;
}

.rating-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.margin-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.margin-value.dem { color: var(--dem-strong); }
.margin-value.rep { color: var(--rep-strong); }

/* Polls Table */
.polls-section {
    margin-bottom: 3rem;
}

.polls-section h2 {
    margin-bottom: 1.5rem;
}

.polls-table {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--brand-secondary);  /* Prussian blue border */
    overflow: hidden;
}

.polls-table table {
    width: 100%;
    border-collapse: collapse;
}

.polls-table th {
    background: var(--bg-light);
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
}

.polls-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.polls-table tbody tr:last-child td {
    border-bottom: none;
}

.polls-table tbody tr:hover {
    background: var(--bg-light);
}

.pollster-cell {
    min-width: 150px;
}

.pollster-cell small {
    color: var(--text-gray);
}

.date-cell {
    min-width: 100px;
}

.date-cell small {
    color: var(--text-gray);
    font-size: 0.85rem;
}

.sample-cell {
    text-align: center;
}

.sample-cell small {
    color: var(--text-gray);
}

.dem-cell {
    color: var(--dem-strong);
    text-align: center;
    font-size: 1.1rem;
}

.rep-cell {
    color: var(--rep-strong);
    text-align: center;
    font-size: 1.1rem;
}

.margin-cell {
    text-align: center;
    font-size: 1.1rem;
}

.margin-cell.dem-margin {
    color: var(--dem-strong);
}

.margin-cell.rep-margin {
    color: var(--rep-strong);
}

/* Historical Results */
.historical-section {
    margin-bottom: 3rem;
}

.historical-section h2 {
    margin-bottom: 1.5rem;
}

.historical-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.historical-card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.historical-card h3 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
}

.result-row.dem {
    background: var(--dem-light);
    color: white;
}

.result-row.rep {
    background: var(--rep-light);
    color: white;
}

.result-row .percentage {
    font-weight: 700;
}

.winner {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-gray);
}

/* Responsive - Mobile Optimizations */
@media (max-width: 768px) {
    .logo-title {
        gap: 1rem;
    }

    .site-logo {
        width: 60px;
        height: 60px;
    }

    .site-title {
        font-size: 1.75rem;
    }

    .site-tagline {
        font-size: 0.9rem;
    }

    .header-banner {
        display: none;
    }

    .states-grid {
        grid-template-columns: 1fr;
    }

    .counter-bar {
        height: 60px;
        font-size: 0.9rem;
    }

    .main-nav {
        flex-wrap: wrap;
        gap: 0.5rem;
        font-size: 0.9rem;
    }

    .main-nav a {
        padding: 0.4rem 0.8rem;
    }

    .polls-table {
        overflow-x: auto;
    }

    .polls-table table {
        min-width: 600px;
    }

    .average-details {
        flex-direction: column;
        gap: 1rem;
    }

    .state-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Countdown Timer - Mobile already optimized by desktop base styles */
    .election-countdown {
        margin: 8px auto;
        padding: 6px;
        max-width: 100%;
    }

    .countdown-display {
        font-size: 0.9rem;
        letter-spacing: 0.5px;
        margin-bottom: 3px;
    }

    .countdown-label {
        font-size: 0.4rem;
    }

    /* Electoral Map - MOBILE ONLY - Option 3: Responsive with viewBox */
    .electoral-map-container {
        padding: 0.5rem 0;
        margin: 0 auto;
        max-width: 100%;
        width: 100%;
    }

    .map-svg-wrapper {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
        display: block;
    }

    .map-svg-wrapper svg {
        width: 100%;
        height: auto;
        display: block;
    }

    /* Enhanced tap targets for mobile - visual feedback on touch */
    path.state:active {
        filter: brightness(1.15);
    }

    /* Sticky Footer Donation - MOBILE ONLY - Very Compact */
    .ad-banner-bottom {
        position: relative;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        max-height: none;
        margin-top: 2rem;
        background: var(--bg-light);
    }

    .donation-footer-content {
        flex-direction: column;
        gap: 0.2rem;
        text-align: center;
        padding: 0;
    }

    .donation-footer-text {
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
        margin-bottom: 0.2rem;
    }

    .donation-footer-text strong {
        font-size: 0.75rem;
        display: block;
        font-weight: 600;
        margin-bottom: 0.05rem;
    }

    .donation-footer-text span {
        font-size: 0.6rem;
        line-height: 1.15;
        display: block;
    }

    .donation-footer-button {
        width: auto;
        max-width: 150px;
        padding: 0.35rem 0.65rem;
        font-size: 0.7rem;
        margin: 0 auto;
        display: block;
    }

    /* Site Footer - Adjust spacing on mobile */
    .site-footer {
        padding: 2.5rem 1rem;
        margin-top: 1rem;
    }

    .site-footer p {
        font-size: 0.875rem;
        line-height: 1.6;
        margin-bottom: 0.75rem;
    }

    .footer-links {
        margin-top: 1rem;
    }

    /* Container padding adjustment */
    .container {
        padding: 0 15px;
    }

    /* Main content - add bottom padding for footer clearance */
    main.container {
        padding-bottom: 3rem;
        margin-bottom: 0;
    }

    /* Electoral vote bars - stack better on mobile */
    .electoral-votes-container {
        margin: 1rem 0;
    }

    /* Methodology section - better spacing */
    .methodology {
        margin-top: 2.5rem;
        padding: 1.5rem 1rem;
    }

    /* Electoral Vote Bar - Smaller text on mobile */
    .electoral-counter {
        margin: 1.5rem 0;
    }

    .counter-label {
        font-size: 0.85rem;
    }

    .counter-label strong {
        font-size: 1.1rem;
    }

    .counter-note {
        font-size: 0.85rem;
    }
}

/* Ad Banners */
.ad-banner-top {
    text-align: center;
    margin: 0 auto 2rem;
    max-width: 728px;
}

.ad-banner-top > * {
    margin: 0 auto;
}

/* Affiliate Disclosure */
.affiliate-disclosure {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-top: 1rem;
    font-style: italic;
}

/* Electoral Map */
.electoral-map-container {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.electoral-map-container h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.map-subtitle {
    text-align: center;
    color: var(--text-gray);
    margin-bottom: 2rem;
}

.map-svg-wrapper {
    width: 100%;
    max-width: 1020px;
    margin: 0 auto;
}

.map-svg-wrapper svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Only apply to path elements with state class, not groups */
.map-svg-wrapper path.state {
    cursor: pointer;
    transition: all 0.2s;
    stroke: #fff;
    stroke-width: 1.5;
    fill: var(--tossup) !important;
}

/* Ensure group containers don't get fills */
.map-svg-wrapper g.state {
    fill: none;
}

.map-svg-wrapper path.state:hover {
    stroke: #fff;
    stroke-width: 2.5;
}

.map-svg-wrapper path.state.safe-dem { fill: var(--dem-strong) !important; }
.map-svg-wrapper path.state.likely-dem { fill: var(--dem-medium) !important; }
.map-svg-wrapper path.state.lean-dem { fill: var(--dem-light) !important; }
.map-svg-wrapper path.state.tilt-dem { fill: var(--dem-tilt) !important; }
.map-svg-wrapper path.state.safe-rep { fill: var(--rep-strong) !important; }
.map-svg-wrapper path.state.likely-rep { fill: var(--rep-medium) !important; }
.map-svg-wrapper path.state.lean-rep { fill: var(--rep-light) !important; }
.map-svg-wrapper path.state.tilt-rep { fill: var(--rep-tilt) !important; }
.map-svg-wrapper path.state.tossup { fill: var(--tossup) !important; }

/* Election Countdown Timer */
.election-countdown {
    text-align: center;
    margin: 10px auto;
    padding: 8px;
    max-width: 250px;
    background: var(--brand-light-blue);  /* Solid light Prussian blue */
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.countdown-display {
    font-size: 1rem;
    font-weight: bold;
    color: #111827;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.countdown-number {
    display: inline-block;
    min-width: 18px;
    text-align: center;
}

.countdown-label {
    color: #374151;
    font-size: 0.45rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

/* Congressional District Circles (ME-2, NE-2) */
.map-svg-wrapper circle[id^="ME-"],
.map-svg-wrapper circle[id^="NE-"] {
    cursor: pointer;
    transition: all 0.2s;
    stroke: #fff;
    stroke-width: 2;
}

/* District colors - match state colors */
.map-svg-wrapper circle.safe-dem { fill: var(--dem-strong) !important; }
.map-svg-wrapper circle.likely-dem { fill: var(--dem-medium) !important; }
.map-svg-wrapper circle.lean-dem { fill: var(--dem-light) !important; }
.map-svg-wrapper circle.tilt-dem { fill: var(--dem-tilt) !important; }
.map-svg-wrapper circle.safe-rep { fill: var(--rep-strong) !important; }
.map-svg-wrapper circle.likely-rep { fill: var(--rep-medium) !important; }
.map-svg-wrapper circle.lean-rep { fill: var(--rep-light) !important; }
.map-svg-wrapper circle.tilt-rep { fill: var(--rep-tilt) !important; }
.map-svg-wrapper circle.tossup { fill: var(--tossup) !important; }

.map-svg-wrapper circle[id^="ME-"]:hover,
.map-svg-wrapper circle[id^="NE-"]:hover {
    stroke: #fff;
    stroke-width: 3;
    opacity: 0.8;
}

.map-svg-wrapper text {
    fill: white;
    font-weight: 700;
    pointer-events: none;
    text-shadow: 0 0 3px rgba(0,0,0,0.7);
}

.map-tooltip {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    visibility: hidden; /* Extra safety - hide when not in use */
}

.map-tooltip[style*="display: block"] {
    visibility: visible; /* Only show when JavaScript sets display: block */
}

/* Mobile State Dropdown Selector */
.mobile-state-selector {
    display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
    .mobile-state-selector {
        display: block;
        margin: 20px auto;
        max-width: 400px;
        padding: 0 15px;
    }
}

.mobile-state-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.mobile-state-selector label svg {
    flex-shrink: 0;
}

.mobile-state-selector select {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px; /* Prevents iOS zoom on focus */
    font-family: inherit;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3e%3cpath fill='%23333' d='M6 9L1 4h10z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
    transition: all 0.2s ease;
}

.mobile-state-selector select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.mobile-state-selector select:hover {
    border-color: var(--text-secondary);
}

.map-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.legend-color {
    width: 24px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.1);
}

.legend-color.safe-dem { background: var(--dem-strong); }
.legend-color.likely-dem { background: var(--dem-medium); }
.legend-color.lean-dem { background: var(--dem-light); }
.legend-color.tilt-dem { background: var(--dem-tilt); }
.legend-color.tossup { background: var(--tossup); }
.legend-color.tilt-rep { background: var(--rep-tilt); }
.legend-color.lean-rep { background: var(--rep-light); }
.legend-color.likely-rep { background: var(--rep-medium); }
.legend-color.safe-rep { background: var(--rep-strong); }

/* State Page Layout - 70/30 split with sidebar */
.state-page-layout {
    display: grid;
    grid-template-columns: 70% 30%;
    gap: 2rem;
    margin-top: 2rem;
}

.state-main-content {
    min-width: 0; /* Prevent grid overflow */
}

.state-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-ad-box {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-ad-box img {
    max-width: 100%;
    height: auto;
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .state-page-layout {
        grid-template-columns: 1fr;
    }

    .state-sidebar {
        order: 2;
    }
}

/* Bottom Banner Ad (Sticky Footer Ad) */
.ad-banner-bottom {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-top: 2px solid var(--border);
    padding: 0.75rem 0;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    max-height: 120px;
    overflow: hidden;
}

.ad-banner-bottom img {
    max-width: 100%;
    max-height: 90px;
    height: auto;
}

/* PayPal Donation Placeholder Styles */
.donation-placeholder {
    background: linear-gradient(135deg, #6FA3FF 0%, #B8D4FF 100%);  /* Gradient of new blues */
    border: 2px solid var(--brand-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

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

.donation-content h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    color: var(--text-dark);
    font-weight: 600;
}

.donation-content p {
    margin: 0 0 1rem 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.donation-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--brand-accent);  /* Gold */
    color: var(--brand-primary);  /* Dark blue text */
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.donation-button:hover {
    background: #B59556;  /* Lighter gold */
    transform: scale(1.05);
}

.paypal-icon {
    width: 20px;
    height: 20px;
}

.donation-note {
    margin: 0.75rem 0 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Donation Banner (top_banner) */
.donation-banner {
    max-height: 120px;
    padding: 1rem 2rem;
}

.donation-banner .donation-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.donation-banner .donation-content p {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.donation-banner .donation-button {
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
}

/* Donation Sidebar (sidebar_box_1, sidebar_box_2) */
.donation-sidebar {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Donation Footer (bottom_banner) */
.donation-footer {
    max-height: 100px;
    padding: 1rem 2rem;
}

.donation-footer .donation-content h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.donation-footer .donation-content p {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.donation-footer .donation-button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Responsive: Simplify on mobile */
@media (max-width: 768px) {
    .donation-banner,
    .donation-footer {
        padding: 1rem;
    }

    .donation-content h3 {
        font-size: 1rem;
    }

    .donation-content p {
        font-size: 0.85rem;
    }

    .donation-button {
        font-size: 0.9rem;
        padding: 0.65rem 1.25rem;
    }
}


/* Legal Pages (Privacy, Terms, About) */
.legal-page {
    background: var(--bg-white);
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 900px;
    margin: 2rem auto;
}

.legal-page h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.legal-page .last-updated {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.legal-page section {
    margin-bottom: 2.5rem;
}

.legal-page h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    margin-top: 2rem;
}

.legal-page h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
    color: var(--text-dark);
}

.legal-page p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.legal-page ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.legal-page li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

.legal-page a {
    color: var(--dem-medium);
    text-decoration: none;
}

.legal-page a:hover {
    text-decoration: underline;
}

.legal-page strong {
    color: var(--text-dark);
    font-weight: 600;
}

.footer-links {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.footer-links a {
    color: #e5e7eb;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .legal-page {
        padding: 1.5rem;
        margin: 1rem;
    }

    .legal-page h1 {
        font-size: 2rem;
    }

    .legal-page h2 {
        font-size: 1.5rem;
    }
}

/* Social Media Links */
.social-media-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 0;
    margin: 1rem 0;
}

.social-media-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-white);
    border: 2px solid var(--border);
    color: var(--text-gray);
    font-size: 1.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-media-links a:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.social-media-links a:hover .fa-facebook {
    color: #1877f2;
}

.social-media-links a:hover .fa-twitter {
    color: #1da1f2;
}

.social-media-links a:hover .fa-instagram {
    color: #e4405f;
}

.social-media-links a:hover .fa-youtube {
    color: #ff0000;
}

.social-media-links a:hover .fa-linkedin {
    color: #0077b5;
}

.social-media-links a:hover .fa-x-twitter {
    color: #000000;
}

/* Social Media Icon Images (Truth Social, GETTR) */
.social-icon-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

@media (max-width: 768px) {
    .social-media-links {
        gap: 1rem;
        padding: 1.5rem 0;
    }

    .social-media-links a {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .social-icon-img {
        width: 24px;
        height: 24px;
    }
}

/* ============================================
   SENATE PAGE STYLES
   Created: December 2025
   ============================================ */

.page-title {
    font-size: var(--text-3xl);
    color: var(--brand-primary);
    margin-bottom: var(--space-xs);
    text-align: center;
}

.page-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: var(--space-lg);
}

/* Senate Balance Bar */
.senate-balance {
    background: var(--bg-white);
    border: 2px solid var(--brand-secondary);
    border-radius: 8px;
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.senate-balance h3 {
    font-size: var(--text-xl);
    color: var(--text-primary);
    text-align: center;
    margin-bottom: var(--space-sm);
}

.balance-bar {
    display: flex;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.balance-bar .dem-seats {
    background: var(--dem-strong);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: var(--space-sm);
}

.balance-bar .rep-seats {
    background: var(--rep-strong);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: var(--space-sm);
}

.balance-bar .seat-count {
    color: white;
    font-weight: bold;
    font-size: var(--text-lg);
}

.balance-labels {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-xs);
    font-size: var(--text-sm);
}

.balance-labels .dem-label {
    color: var(--dem-strong);
    font-weight: 600;
}

.balance-labels .rep-label {
    color: var(--rep-strong);
    font-weight: 600;
}

.balance-labels .majority-marker {
    color: var(--text-secondary);
    font-style: italic;
}

/* Senate Races Section */
.senate-races {
    margin-bottom: var(--space-xl);
}

.senate-races h3 {
    font-size: var(--text-2xl);
    color: var(--brand-primary);
    margin-bottom: var(--space-md);
}

.rating-group {
    margin-bottom: var(--space-lg);
}

.rating-header {
    font-size: var(--text-lg);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 4px;
    margin-bottom: var(--space-sm);
    color: white;
}

.rating-header.tossup {
    background: var(--tossup);
}

.rating-header.lean-d {
    background: var(--dem-light);
}

.rating-header.lean-r {
    background: var(--rep-light);
}

.rating-header.safe-d {
    background: var(--dem-strong);
}

.rating-header.safe-r {
    background: var(--rep-strong);
}

/* Race Cards */
.race-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
}

.race-cards.compact {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-sm);
}

.race-card {
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: var(--space-md);
    transition: var(--transition-base);
    border-left-width: 4px;
    /* Clickable link styles */
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}

.race-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: var(--brand-secondary);
}

.race-card.tossup {
    border-left-color: var(--tossup);
}

.race-card.lean-d, .race-card.tilt-d {
    border-left-color: var(--dem-light);
}

.race-card.likely-d {
    border-left-color: var(--dem-medium);
}

.race-card.safe-d {
    border-left-color: var(--dem-strong);
}

.race-card.lean-r, .race-card.tilt-r {
    border-left-color: var(--rep-light);
}

.race-card.likely-r {
    border-left-color: var(--rep-medium);
}

.race-card.safe-r {
    border-left-color: var(--rep-strong);
}

.race-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.race-header .state-code {
    font-weight: bold;
    font-size: var(--text-xl);
    color: var(--brand-primary);
}

.race-header .state-name {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.race-header .special-badge {
    background: var(--brand-accent);
    color: white;
    font-size: var(--text-xs);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}

.race-details {
    margin-bottom: var(--space-sm);
}

.race-details .incumbent {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-base);
}

.race-details .incumbent.d .party-badge {
    background: var(--dem-strong);
}

.race-details .incumbent.r .party-badge {
    background: var(--rep-strong);
}

.party-badge {
    color: white;
    font-size: var(--text-xs);
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
}

.race-details .challenger {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

.race-rating {
    display: flex;
    justify-content: flex-end;
}

/* Multi-Source Ratings */
.rating-multi-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.source-indicator {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: var(--text-xs);
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-light);
    color: var(--text-gray);
}

.source-indicator i {
    font-size: 0.7rem;
}

.source-indicator.sources-agree {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.source-indicator.sources-vary {
    background: rgba(234, 179, 8, 0.15);
    color: #ca8a04;
}

/* Rating Pills (for showing all sources) */
.rating-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: var(--space-xs);
}

.rating-pill {
    font-size: var(--text-xs);
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--bg-light);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rating-pill .source-abbrev {
    font-weight: 600;
    color: var(--text-dark);
}

.rating-pill.changed {
    border: 1px solid var(--brand-accent);
}

/* Compact Race Cards (for Safe seats) */
.race-card-compact {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    border-left-width: 3px;
    /* Clickable link styles */
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: var(--transition-base);
}

.race-card-compact:hover {
    background: var(--bg-light);
    border-color: var(--brand-secondary);
}

.race-card-compact .state-code {
    font-weight: bold;
    color: var(--brand-primary);
}

.race-card-compact .state-name {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.race-card-compact .incumbent-name {
    margin-left: auto;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Retirements Section */
.retirements {
    margin-bottom: var(--space-xl);
}

.retirements h3 {
    font-size: var(--text-2xl);
    color: var(--brand-primary);
    margin-bottom: var(--space-md);
}

.retirement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

.retirement-card {
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: var(--space-md);
}

.retirement-card.dem {
    border-left: 4px solid var(--dem-strong);
}

.retirement-card.rep {
    border-left: 4px solid var(--rep-strong);
}

.retirement-card h4 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-sm);
}

.retirement-card.dem h4 {
    color: var(--dem-strong);
}

.retirement-card.rep h4 {
    color: var(--rep-strong);
}

.retirement-card ul {
    list-style: none;
    padding: 0;
}

.retirement-card li {
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border-light);
    font-size: var(--text-sm);
}

.retirement-card li:last-child {
    border-bottom: none;
}

/* Senate Map Section */
.senate-map-section {
    margin-bottom: var(--space-lg);
}

.senate-map-container {
    margin-bottom: var(--space-lg);
}

.senate-map-container .map-svg-wrapper {
    max-width: 100%;
    margin: 0 auto;
}

.senate-map-container .map-svg-wrapper svg {
    width: 100%;
    height: auto;
}

/* States without Senate races - gray/neutral */
.no-senate-race {
    fill: #e5e7eb !important;
    stroke: #9ca3af;
    stroke-width: 0.5;
}

/* Legend color for no race */
.legend-color.no-race {
    background-color: #e5e7eb;
    border: 1px solid #9ca3af;
}

/* Responsive adjustments for Senate page */
@media (max-width: 768px) {
    .page-title {
        font-size: var(--text-2xl);
    }

    .balance-bar {
        height: 32px;
    }

    .balance-labels {
        flex-direction: column;
        align-items: center;
        gap: var(--space-xs);
    }

    .race-cards {
        grid-template-columns: 1fr;
    }

    .race-cards.compact {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   HOUSE PAGE STYLES
   Created: December 2025
   ============================================ */

.house-balance {
    background: var(--bg-white);
    border: 2px solid var(--brand-secondary);
    border-radius: 8px;
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.house-balance h3 {
    font-size: var(--text-xl);
    color: var(--text-primary);
    text-align: center;
    margin-bottom: var(--space-sm);
}

.house-races {
    margin-bottom: var(--space-xl);
}

.house-races h3 {
    font-size: var(--text-2xl);
    color: var(--brand-primary);
    margin-bottom: var(--space-xs);
}

.section-note {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-md);
}

/* District code styling (for House races) */
.district-code {
    font-weight: bold;
    font-size: var(--text-xl);
    color: var(--brand-primary);
}

/* 2024 margin display */
.margin-2024 {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
    font-style: italic;
}

/* Likely rating headers */
.rating-header.likely-d {
    background: var(--dem-medium);
}

.rating-header.likely-r {
    background: var(--rep-medium);
}

/* Browse States Section */
.browse-states {
    margin-bottom: var(--space-xl);
}

.browse-states h3 {
    font-size: var(--text-2xl);
    color: var(--brand-primary);
    margin-bottom: var(--space-xs);
}

.state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.state-link-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm);
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    transition: var(--transition-base);
}

.state-link-box:hover {
    border-color: var(--brand-secondary);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.state-link-box .state-code {
    font-weight: bold;
    font-size: var(--text-lg);
    color: var(--brand-primary);
}

.state-link-box .district-count {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* House Map Section */
.house-map-section {
    margin-bottom: var(--space-lg);
}

/* Responsive adjustments for House page */
@media (max-width: 768px) {
    .state-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: var(--space-xs);
    }

    .state-link-box {
        padding: var(--space-xs);
    }
}
