/* Votecraft Widget Styles - Plural Policy inspired */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --upper-chamber: #14CCB0;  /* Teal for Senate/Upper */
    --lower-chamber: #FFC280;  /* Orange for House/Lower */
    --democrat: #3b82f6;
    --republican: #ef4444;
    --background: #ffffff;
    --background-alt: #f8fafc;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --radius: 8px;
}

html, body {
    overflow-x: hidden;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.votecraft-widget {
    width: 100%;
    max-width: 1280px;
    background: var(--background);
    border-radius: var(--radius);
    box-shadow: none;
    overflow: hidden;
}

/* Header */
.widget-header {
    background: var(--background);
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.widget-header h1 {
    font-family: 'Open Sans', sans-serif;
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.widget-header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Main Content */
.main-content {
    padding: 24px;
    position: relative;
}

/* Address Section */
.address-section {
    margin-bottom: 24px;
}

/* Address Form */
.address-form {
    display: flex;
    gap: 0;
}

.address-form #address-input {
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
}

.address-form .btn-primary {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.address-form .btn-pdf {
    margin-left: 12px;
}

#address-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#address-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-primary {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--primary);
    background: none;
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    margin-left: auto;
}

.btn-pdf:hover:not(:disabled) {
    background: var(--primary);
    color: white;
}

.btn-pdf:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Static map image for printing */
.map-print-image {
    display: none;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}

/* Swapped button states after search */
.address-form.has-results .btn-primary {
    background: white;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.address-form.has-results .btn-primary:hover {
    background: var(--background-alt);
}

.address-form.has-results .btn-pdf {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
}

.address-form.has-results .btn-pdf:hover {
    background: var(--primary-dark);
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 100;
}

.loading-overlay.active {
    display: flex;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: var(--text-light);
}

/* Results */
.results-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    padding: 8px 0;
}

.btn-back:hover {
    text-decoration: underline;
}

.searched-address {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Two Column Layout */
.results-layout {
    display: flex;
    gap: 24px;
}

.results-column {
    flex: 1;
}

.results-left {
    flex: 1;
    min-width: 0;
}

.results-right {
    flex: 1;
    position: sticky;
    top: 24px;
    align-self: flex-start;
    min-width: 0;
    max-width: 50%;
}

/* Map Container */
.map-container {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

#map {
    height: 450px;
    width: 100%;
    background: #f8f9fa;
}

/* District Explorer */
.district-explorer {
    margin-top: 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.district-explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    color: white;
}

.district-explorer-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.close-explorer {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1;
    padding: 0;
}

.close-explorer:hover {
    opacity: 1;
}

.district-scroll-container {
    display: flex;
    align-items: center;
    padding: 12px 8px;
    gap: 8px;
    background: var(--background-alt);
    overflow: hidden;
}

.scroll-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.scroll-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.scroll-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.district-cards {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 0;
    flex: 1;
    min-width: 0;
}

.district-cards::-webkit-scrollbar {
    display: none;
}

.district-card {
    flex-shrink: 0;
    width: 80px;
    padding: 10px 8px;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.district-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.district-card.active {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.district-card.user-district {
    border-color: var(--upper-chamber);
    background: rgba(20, 204, 176, 0.1);
}

.district-card.user-district::after {
    content: '📍';
    display: block;
    font-size: 0.7rem;
    margin-top: 4px;
}

.district-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.district-label {
    font-size: 0.65rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Custom Map Marker */
.custom-marker {
    background: none;
    border: none;
}

.marker-pin {
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    background: var(--primary);
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -20px 0 0 -12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.marker-pin::after {
    content: '';
    width: 12px;
    height: 12px;
    margin: 6px 0 0 6px;
    background: #fff;
    position: absolute;
    border-radius: 50%;
}

/* Map popup styling */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 12px 16px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

.leaflet-popup-tip {
    box-shadow: none;
}

/* Hide default Leaflet attribution styling */
.leaflet-control-attribution {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.8) !important;
    padding: 2px 6px;
}

/* Loader below map - hidden by default */
.map-loader-container {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin-top: 16px;
}

.map-loader {
    width: 50px;
    padding: 8px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #25b09b;
    --_m:
        conic-gradient(#0000 10%,#000),
        linear-gradient(#000 0 0) content-box;
    -webkit-mask: var(--_m);
            mask: var(--_m);
    -webkit-mask-composite: source-out;
            mask-composite: subtract;
    animation: mapLoaderSpin 1s infinite linear;
}

@keyframes mapLoaderSpin {
    to { transform: rotate(1turn); }
}

/* Legislators List */
.legislators-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.legislator-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-title {
    font-family: 'Open Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.legislator-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Legislator Item */
.legislator-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: box-shadow 0.2s;
}

.legislator-item:hover {
    box-shadow: var(--shadow);
}

.legislator-photo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--border);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-light);
}

.legislator-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.legislator-info {
    flex: 1;
    min-width: 0;
}

.legislator-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.legislator-name a {
    color: inherit;
    text-decoration: none;
}

.legislator-name a:hover {
    color: var(--primary);
}

.legislator-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.legislator-party {
    font-weight: 500;
}

.legislator-party.democratic {
    color: var(--democrat);
}

.legislator-party.republican {
    color: var(--republican);
}

.legislator-district {
    color: var(--text-light);
}

/* Chamber Badge */
.chamber-badge {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
    white-space: nowrap;
}

.chamber-badge.upper {
    background: var(--upper-chamber);
    color: #0d4a42;
}

.chamber-badge.lower {
    background: var(--lower-chamber);
    color: #6b4a00;
}

/* Contact Link */
.legislator-link {
    color: var(--primary);
    font-size: 0.85rem;
    text-decoration: none;
    white-space: nowrap;
}

.legislator-link:hover {
    text-decoration: underline;
}

/* Disclaimer */
.disclaimer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
}

/* Error Screen */
#error-screen {
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 200px;
}

.error-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
}

.error-message h2 {
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    margin-bottom: 8px;
}

.error-message p {
    color: var(--text-light);
    margin-bottom: 24px;
}

/* No Data State */
.no-legislators {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-light);
}

/* Placeholder Items */
.placeholder-item {
    opacity: 1;
    background: var(--background);
}

.placeholder-item .legislator-photo {
    font-size: 1.5rem;
    background: var(--background);
}

.placeholder-icon {
    background: #008BFF !important;
    color: #ffffff;
    font-size: 2.2rem;
    font-weight: 700;
}

.placeholder-item .legislator-name {
    color: var(--text);
}

.placeholder-item .chamber-badge {
    opacity: 1;
}

/* Activity Section - Recent Bills */
.activity-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.activity-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: -8px;
    margin-bottom: 8px;
}

.activity-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.bill-item {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: box-shadow 0.2s;
}

.bill-item:hover {
    box-shadow: var(--shadow);
}

.bill-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.bill-id {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

.bill-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.bill-title {
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 8px;
}

.bill-title a {
    color: var(--text);
    text-decoration: none;
}

.bill-title a:hover {
    color: var(--primary);
}

.bill-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.bill-sponsor {
    font-style: italic;
}

.bill-status {
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 4px;
    background: #f1f5f9;
    color: var(--text-light);
}

.bill-status.status-passed {
    background: #dcfce7;
    color: #166534;
}

.bill-status.status-failed {
    background: #fef2f2;
    color: #dc2626;
}

.bill-status.status-pending {
    background: #fef9c3;
    color: #854d0e;
}

/* Placeholder Bills */
.placeholder-bill {
    opacity: 1;
    background: var(--background);
}

.placeholder-bill .bill-title {
    color: var(--text);
}

.placeholder-bill-id {
    color: #008BFF !important;
    font-weight: 600;
}

/* Bills Loading State */
.bills-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-light);
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius);
    min-height: 120px;
}

.bills-loader {
    width: 50px;
    padding: 8px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #25b09b;
    --_m:
        conic-gradient(#0000 10%,#000),
        linear-gradient(#000 0 0) content-box;
    -webkit-mask: var(--_m);
            mask: var(--_m);
    -webkit-mask-composite: source-out;
            mask-composite: subtract;
    animation: mapLoaderSpin 1s infinite linear;
    margin-bottom: 12px;
}

.bills-loading p {
    font-size: 0.9rem;
    color: #1e3a5f;
    font-weight: 500;
}

/* Votes Section */
.votes-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.votes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vote-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: box-shadow 0.2s;
}

.vote-item:hover {
    box-shadow: var(--shadow);
}

.vote-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    flex-shrink: 0;
}

.vote-yea {
    background: #dcfce7;
    color: #166534;
}

.vote-nay {
    background: #fef2f2;
    color: #dc2626;
}

.vote-abstain {
    background: #f1f5f9;
    color: var(--text-light);
}

.vote-unknown {
    background: #fef9c3;
    color: #854d0e;
}

.vote-content {
    flex: 1;
    min-width: 0;
}

.vote-bill {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.vote-bill a {
    color: var(--primary);
    text-decoration: none;
}

.vote-bill a:hover {
    text-decoration: underline;
}

.vote-title {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.4;
}

.vote-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.vote-legislator {
    font-weight: 500;
}

.vote-result {
    text-transform: capitalize;
}

/* Placeholder Votes */
.placeholder-vote {
    opacity: 1;
}

.placeholder-vote .vote-bill {
    color: #008BFF;
}

/* Topics Section */
.topics-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.topics-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topic-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.topic-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.topic-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.topic-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.placeholder-topic {
    opacity: 0.7;
}

.topic-emoji {
    font-size: 1rem;
}

.topic-label {
    font-weight: 500;
}

.topics-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.topics-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px 16px;
    color: var(--text-light);
}

.topics-placeholder p {
    font-size: 0.95rem;
}

/* Ballot Section */
.ballot-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.ballot-info {
    margin-bottom: 8px;
}

.ballot-election-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.ballot-election-info.no-election {
    background: #f8fafc;
}

.ballot-election-info.placeholder-ballot {
    background: var(--background);
}

.ballot-election-info.past-election {
    background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
    border-color: #fcd34d;
}

.past-election-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: #92400e;
    line-height: 1.4;
}

.past-election-notice .notice-icon {
    flex-shrink: 0;
}

.past-election-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    background: #fcd34d;
    color: #92400e;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.election-icon {
    font-size: 2.5rem;
}

.election-details {
    flex: 1;
}

.election-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.election-date {
    font-size: 0.95rem;
    color: var(--text-light);
}

.polling-location {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.polling-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.polling-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.polling-address {
    font-size: 0.9rem;
    color: var(--text-light);
}

.polling-hours {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 4px;
}

.ballot-contests {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contest-item {
    padding: 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: box-shadow 0.2s;
}

.contest-item:hover {
    box-shadow: var(--shadow);
}

.contest-item.placeholder-contest {
    opacity: 1;
}

/* Placeholder field styles - look like form inputs */
.placeholder-field {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    padding: 8px 12px;
    color: #64748b;
    font-style: italic;
}

.placeholder-ballot .election-name.placeholder-field,
.placeholder-ballot .election-date.placeholder-field {
    display: inline-block;
    margin-bottom: 4px;
}

.placeholder-polling {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 12px;
}

.placeholder-polling .polling-name,
.placeholder-polling .polling-address {
    background: transparent;
    border: none;
    padding: 4px 0;
}

.placeholder-candidate {
    background: #f1f5f9;
    border: 1px dashed #cbd5e1;
}

.placeholder-candidate .candidate-name,
.placeholder-candidate .candidate-party {
    color: #64748b;
    font-style: italic;
}

.contest-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.contest-office {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}

.contest-level {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: capitalize;
}

.contest-candidates {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.candidate-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 6px;
}

.candidate-name {
    font-weight: 500;
}

.candidate-party {
    font-size: 0.85rem;
    color: var(--text-light);
    padding: 2px 8px;
    background: var(--background);
    border-radius: 4px;
}

.contest-description {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.5;
}

.referendum-arguments {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.referendum-arguments .argument {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.referendum-arguments .argument.pro {
    background: #dcfce7;
    border-left: 3px solid #22c55e;
}

.referendum-arguments .argument.con {
    background: #fef2f2;
    border-left: 3px solid #ef4444;
}

/* Error Inline */
.error-inline {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
}

.error-inline .error-message {
    display: flex;
    align-items: center;
    gap: 12px;
}

.error-inline .error-icon {
    width: 32px;
    height: 32px;
    margin: 0;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Responsive */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .results-layout {
        gap: 20px;
    }

    .results-right {
        max-width: 45%;
    }

    #map {
        height: 380px;
    }

    .activity-list,
    .topics-list {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

/* Tablets - stack to single column */
@media (max-width: 900px) {
    .results-layout {
        flex-direction: column-reverse;
    }

    .results-right {
        flex: none;
        position: static;
        width: 100%;
        max-width: 100%;
    }

    #map {
        height: 300px;
    }

    .main-content {
        padding: 20px;
    }

    .activity-list,
    .topics-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* Small tablets */
@media (max-width: 768px) {
    #map {
        height: 250px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .btn-pdf {
        margin-left: 0;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .legislator-photo {
        width: 48px;
        height: 48px;
    }

    .legislator-name {
        font-size: 1rem;
    }

    .district-explorer-header h3 {
        font-size: 0.85rem;
    }

    .district-card {
        width: 70px;
        padding: 8px 6px;
    }

    .district-number {
        font-size: 1.25rem;
    }
}

/* Mobile phones */
@media (max-width: 520px) {
    body {
        padding: 0;
    }

    .votecraft-widget {
        max-width: 100%;
        min-height: 100vh;
        border-radius: 0;
    }

    .main-content {
        padding: 16px;
    }

    #address-input {
        padding: 14px 16px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .btn-primary {
        padding: 14px 16px;
    }

    #map {
        height: 280px;
    }

    .legislator-item {
        padding: 14px;
        gap: 12px;
    }

    .legislator-photo {
        width: 44px;
        height: 44px;
    }

    .activity-list,
    .topics-list {
        grid-template-columns: 1fr;
    }

    .bill-item,
    .vote-item,
    .contest-item {
        padding: 14px;
    }

    .vote-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .vote-indicator {
        align-self: flex-start;
    }

    .topic-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .ballot-election-info {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }

    .state-website-btn {
        padding: 14px 20px;
        font-size: 0.95rem;
    }

    .district-scroll-container {
        padding: 10px 4px;
    }

    .scroll-btn {
        width: 28px;
        height: 28px;
    }

    .district-card {
        width: 65px;
        padding: 8px 4px;
    }
}

/* iPhone 16 Pro and similar (around 400px width) */
@media (max-width: 430px) {
    .address-form {
        gap: 0;
    }

    .address-form .btn-pdf {
        margin-left: 6px;
        padding: 10px 8px;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .address-form .btn-primary {
        padding: 10px 10px;
        font-size: 0.85rem;
    }

    #address-input {
        padding: 10px 12px;
        min-width: 0;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .legislator-item {
        padding: 12px;
        gap: 10px;
    }

    .legislator-photo {
        width: 42px;
        height: 42px;
    }

    .legislator-name {
        font-size: 0.95rem;
    }

    .legislator-details {
        font-size: 0.85rem;
        gap: 6px;
    }

    .chamber-badge {
        padding: 3px 8px;
        font-size: 0.7rem;
    }

    #map {
        height: 260px;
    }

    .bill-item,
    .vote-item,
    .contest-item {
        padding: 12px;
    }

    .bill-title {
        font-size: 0.9rem;
    }

    .bill-id {
        font-size: 0.85rem;
    }

    .topic-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .district-card {
        width: 60px;
        padding: 6px 4px;
    }

    .district-number {
        font-size: 1.1rem;
    }

    .district-label {
        font-size: 0.6rem;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .main-content {
        padding: 12px;
    }

    .address-form .btn-pdf {
        margin-left: 4px;
        padding: 8px 6px;
        font-size: 0.7rem;
    }

    .address-form .btn-primary {
        padding: 8px 8px;
        font-size: 0.8rem;
    }

    #address-input {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1rem;
    }

    .activity-subtitle {
        font-size: 0.85rem;
    }

    .legislator-item {
        padding: 10px;
    }

    .legislator-photo {
        width: 38px;
        height: 38px;
    }

    .legislator-details {
        font-size: 0.8rem;
    }

    .bill-item,
    .contest-item {
        padding: 10px;
    }

    .bill-title {
        font-size: 0.85rem;
    }
}

/* State Elections Website Button */
.state-website-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.state-website-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.state-website-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
}

.state-website-btn:active {
    transform: translateY(0);
}

.state-website-icon {
    font-size: 1.3rem;
}

.state-website-text {
    flex: 1;
    text-align: center;
}

.state-website-arrow {
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.state-website-btn:hover .state-website-arrow {
    transform: translateX(4px);
}

/* Placeholder State Website */
.placeholder-state-website {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    box-shadow: none;
    cursor: default;
}

.placeholder-state-website:hover {
    transform: none;
    box-shadow: none;
    background: #f8fafc;
}

.placeholder-state-website .state-website-text {
    font-style: italic;
}

/* Print Styles - 2 Page PDF Layout */
@media print {
    body {
        padding: 0;
        background: white;
        font-size: 11pt;
    }

    .address-section,
    .btn-pdf,
    .disclaimer,
    .district-explorer {
        display: none !important;
    }

    .votecraft-widget {
        max-width: 100%;
        box-shadow: none;
    }

    .main-content {
        padding: 16px;
    }

    .results-layout {
        display: block;
    }

    .results-left {
        width: 100%;
    }

    .results-right {
        width: 100%;
        max-width: 100%;
        position: static;
        margin-bottom: 24px;
    }

    .map-container {
        border: 1px solid #ccc;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Hide interactive map, show static image for print */
    #map {
        display: none !important;
    }

    .map-print-image {
        display: block !important;
        width: 100%;
        height: auto;
        max-height: 300px;
        object-fit: contain;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .results-header {
        margin-bottom: 16px;
        border-bottom: 2px solid var(--text);
        padding-bottom: 8px;
    }

    .searched-address {
        font-size: 1.2rem;
        font-weight: 600;
    }

    /* Page 1: Legislators */
    .legislator-section {
        margin-bottom: 16px;
    }

    .section-title {
        font-size: 1.1rem;
        margin-bottom: 8px;
        padding-bottom: 4px;
    }

    .legislator-item {
        break-inside: avoid;
        page-break-inside: avoid;
        padding: 12px;
        margin-bottom: 8px;
        border: 1px solid #ccc;
    }

    .legislator-photo {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .legislator-name {
        font-size: 1rem;
    }

    .legislator-details {
        font-size: 0.85rem;
    }

    .chamber-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    /* Page 2: Recent Activity - force page break before */
    .activity-section {
        break-before: page;
        page-break-before: always;
        margin-top: 0;
        padding-top: 16px;
        border-top: none;
    }

    .activity-subtitle {
        margin-bottom: 12px;
    }

    .activity-list {
        display: block;
    }

    .bill-item {
        break-inside: avoid;
        page-break-inside: avoid;
        padding: 12px;
        margin-bottom: 12px;
        border: 1px solid #ccc;
    }

    .bill-header {
        margin-bottom: 4px;
    }

    .bill-id {
        font-size: 0.85rem;
        color: #000;
    }

    .bill-title {
        font-size: 0.9rem;
        margin-bottom: 4px;
    }

    .bill-title a {
        color: #000;
        text-decoration: none;
    }

    .bill-meta {
        font-size: 0.8rem;
        margin-bottom: 4px;
    }

    .bill-status {
        font-size: 0.75rem;
        padding: 4px 8px;
        background: #f0f0f0 !important;
        color: #333 !important;
    }

    /* Remove link styling for print */
    a {
        color: inherit;
        text-decoration: none;
    }
}
