:root {
    --color-navy: #001a33;
    --color-navy-mid: #003366;
    --color-gold: #bf9b30;
    --color-gold-bright: #ffcc00;
    --color-bg-page: #f0f2f5;
    --color-text-muted: #555;
    --header-offset: 200px;
    --font-ui: "Century Gothic", "Segoe UI", system-ui, sans-serif;
    --font-title: "Century Gothic", Georgia, "Times New Roman", serif;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    /* Prevents horizontal scrolling */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-ui);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100dvh;
    height: auto;
    background-color: var(--color-bg-page);
    padding-top: var(--header-offset);
}

.lookup-box {
    background-color: #f4f4f4;
    /* Light grey to contrast against the navy dashboard */
    border-left: 5px solid #bf9b30;
    /* Gold accent */
    padding: 15px 25px;
    margin: 28px auto 20px;
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px;
    font-family: 'Century Gothic', sans-serif;
    clear: both;
}

.map-header-section {
    text-align: center;
    margin: 40px auto 20px auto;
    padding: 0 20px;
}

.map-title {
    font-family: var(--font-title);
    /* Serif feels more official */
    color: #001a33;
    /* Presidential Navy */
    font-size: 2.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.title-underline {
    width: 60px;
    height: 4px;
    background-color: #bf9b30;
    /* Presidential Gold */
    margin: 0 auto 15px auto;
}

.map-subtitle {
    font-family: 'Century Gothic', sans-serif;
    color: #555;
    font-size: 1rem;
    font-style: italic;
    max-width: 600px;
    margin: 0 auto;
}

.map-svg-frame {
    position: relative;
    width: 100%;
}

.map-mount {
    min-height: 120px;
}

.map-loading {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    transition: opacity 0.25s ease;
}

.map-loading--done {
    opacity: 0;
    pointer-events: none;
}

.map-loading[hidden] {
    display: none;
}

.map-loading__text {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--color-navy);
    letter-spacing: 0.04em;
}

.map-error {
    padding: 1.5rem;
    text-align: center;
    font-family: var(--font-ui);
    color: #8b0000;
    max-width: 36rem;
    margin: 0 auto;
}

.map-svg-frame #map-mount svg,
.map-svg-frame #congress-map {
    display: block;
    width: 100%;
    height: auto;
}

.map-svg-frame .map-attribution {
    position: absolute;
    right: 10px;
    bottom: 8px;
    margin: 0;
    padding: 4px 8px;
    text-align: right;
    font-family: 'Century Gothic', sans-serif;
    font-size: 0.7rem;
    color: #444;
    letter-spacing: 0.02em;
    line-height: 1.3;
    z-index: 5;
    pointer-events: none;
    text-shadow: 0 0 6px #fff, 0 0 4px #fff;
}

.map-svg-frame .map-attribution a {
    color: #003366;
    font-weight: 600;
    text-decoration: none;
    pointer-events: auto;
}

.map-svg-frame .map-attribution a:hover {
    text-decoration: underline;
    color: var(--color-navy);
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
}

.lookup-box span {
    color: #001a33;
    font-weight: bold;
    font-size: 1.1rem;
}

.lookup-link {
    background-color: #001a33;
    color: #ffffff !important;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 3px;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.lookup-link:hover {
    background-color: #bf9b30;
    /* Gold on hover */
    color: #001a33 !important;
}

.dashboard {


    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #001a33;
    /* Presidential Navy Blue */
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    gap: 30px;

}

/* 1. The Outer Wrapper */
.main-dashboard {
    position: fixed;
    /* Or sticky */
    top: 0;
    /* Forces it to the very top edge */
    left: 0;
    width: 100%;
    height: auto;
    /* Let content define height */
    z-index: 10000;
    /* High enough to beat the map or tooltips */
    background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-mid) 100%);
    border-bottom: 7px solid #bf9b30;
    margin: 0;
    /* Ensure no margin is pushing it up/down */
}

/* 2. The Inner Centering Container */
.dashboard-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 150px;
    /* Gives the dashboard a set height so it doesn't 'jump' */
}

/* Optional: This ensures the text section doesn't lean left or right */
.info-section {
    text-align: center;
    flex: 1;
    /* Helps center it if using Flexbox in the header */
}

.main-title {
    font-family: 'Century Gothic', sans-serif;
    font-size: 2.8rem;
    font-weight: 800;
    /* Extra bold for authority */
    text-transform: uppercase;
    letter-spacing: 4px;
    /* Creates that 'official' wide look */
    margin: 0;
    color: #ffffff;
    /* Crisp white against the Navy background */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    /* Subtle depth */
}

.administration-subtitle {
    font-family: 'Century Gothic', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    color: #bf9b30;
    /* Presidential Gold */
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 5px;
    opacity: 0.9;
}

.tooltip-root {
    position: absolute;
    display: none;
    z-index: 10050;
    width: min(380px, calc(100vw - 24px));
    max-width: 380px;
    pointer-events: none;
    font-family: var(--font-ui);
    font-size: 14px;
    color: #fff;
}

.tooltip-root.tooltip-root--visible {
    display: block;
}

.tooltip-root.tooltip-root--locked {
    pointer-events: auto;
}

.tooltip-card {
    background: #0a0a0a;
    color: #fff;
    border: 2px solid var(--color-gold);
    padding: 25px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.9);
    white-space: normal;
}

.tooltip-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--color-gold);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.tooltip-close:hover {
    background: rgba(191, 155, 48, 0.15);
}

.tooltip-block--house {
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.tooltip-kicker {
    color: var(--color-gold);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 0.06em;
}

.tooltip-kicker--right {
    font-size: 12px;
    text-align: right;
}

.tooltip-grid--house {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 20px;
    align-items: start;
}

.tooltip-photo {
    object-fit: cover;
    border: 2px solid #333;
    display: block;
    max-width: none;
}

.tooltip-photo--house {
    width: 90px;
    height: 120px;
    border-radius: 6px;
}

.tooltip-photo--sen {
    width: 60px;
    height: 80px;
    border-radius: 4px;
}

.tooltip-name {
    font-size: 22px;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 4px;
}

.tooltip-name--sen {
    font-size: 17px;
    font-weight: 700;
    color: #f6f6f6;
}

.party-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
}

.party-badge__dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.party-badge--d {
    color: #4d94ff;
    border-color: #4d94ff;
    background: rgba(77, 148, 255, 0.18);
}

.party-badge--d .party-badge__dot {
    background: #4d94ff;
}

.party-badge--r {
    color: #ff4d4d;
    border-color: #ff4d4d;
    background: rgba(255, 77, 77, 0.18);
}

.party-badge--r .party-badge__dot {
    background: #ff4d4d;
}

.party-badge--i {
    color: #b5b5b5;
    border-color: #b5b5b5;
    background: rgba(181, 181, 181, 0.16);
}

.party-badge--i .party-badge__dot {
    background: #b5b5b5;
}

.party-badge--o {
    color: #c9a227;
    border-color: #c9a227;
    background: rgba(201, 162, 39, 0.15);
}

.party-badge--o .party-badge__dot {
    background: #c9a227;
}

.tooltip-countdown {
    color: var(--color-gold);
    font-weight: bold;
    font-size: 13px;
}

.tooltip-countdown--muted {
    font-size: 12px;
    font-weight: 400;
    color: #888;
    margin-top: 8px;
}

.tooltip-countdown--accent {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-gold);
    margin-top: 8px;
}

.tooltip-share {
    margin-top: 10px;
    width: 100%;
    background: var(--color-gold);
    border: none;
    color: #000;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    padding: 6px 12px;
    font-weight: bold;
    font-family: var(--font-ui);
}

.tooltip-share:hover {
    filter: brightness(1.05);
}

.tooltip-sen-row {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 15px;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #444;
}

.hero-logo {
    height: auto;
    width: auto;
    max-width: 200px;

    /* This makes the logo white */
    filter: brightness(0) invert(1)
        /* This adds the glow: X-offset, Y-offset, Blur-radius, Color */
        drop-shadow(0 0 15px rgba(255, 255, 255, 0.4));

    transition: transform 0.3s ease
}

/* 'path' refers to the individual districts in the SVG */
/* 1. THE BASE STATE */
#congress-map path {
    fill: #d5d5d5;
    stroke: rgba(255, 255, 255, 0.812);
    stroke-width: 0.5px;
    pointer-events: all;
    cursor: pointer;
}

/* Border polylines are painted after districts; their strokes otherwise win hit-testing on shared edges (e.g. ID–MT). */
#congress-map #state_borders {
    pointer-events: none;
}

.map-highlight-clone {
    fill: #bf9b30 !important;
    stroke: #ffffff !important;
    stroke-width: 2.5px !important;
    paint-order: stroke fill !important;
    pointer-events: none !important;
    user-select: none;
    z-index: 9999;
    /* Let clicks pass through to the real map below */
    filter: drop-shadow(0 0 5px rgba(191, 155, 48, 0.5));
}

#congress-map path:hover,
.selected-district {
    fill: #bf9b30 !important;
    /* 119th Gold */
    stroke: #ffffff !important;
    /* Sharp White Border */
    stroke-width: 3px !important;
    paint-order: stroke fill !important;
    cursor: pointer;
    transition: fill 0.2s ease;
}

/* 3. THE SELECTED/LOCKED STATE */
/* This matches the 'Click to Lock' functionality we added earlier */
.selected-district {
    fill: #bf9b30 !important;
    stroke: #ffffff !important;
    stroke-width: 4px !important;
    /* Slightly thicker for the 'Locked' one */
    paint-order: stroke fill !important;
    filter: drop-shadow(0 0 8px rgba(191, 155, 48, 0.7));
}

.info-section {
    flex: 2;
    /* Takes up more space than the other sections */
    min-width: 300px;
}

.info-section h1 {
    font-size: 3rem;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.info-section p {
    font-size: 1.2rem;
    opacity: 0.8;
}

.counter-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    min-width: 200px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#day-count {
    font-size: 4rem;
    /* Giant countdown number */
    font-weight: 900;
    color: #ffcc00;
    line-height: 1;
    margin: 10px 0;
}

.label,
.sub-label {
    display: block;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    color: #aaa;
}

/* ***Outdated/unused style reference*** --- This styles the dashboard to look like a clean header */
.wh-logo {
    height: 80px;
    filter: brightness(0) invert(1);
    /* Makes the logo white to pop against blue */
}

#day-count {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffcc00;
    /* Gold for emphasis */
}

.counter-box h3 {
    margin: 0;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.presidential-header {
    background: #1a2a40;
    /* Deep navy */
    color: white;
    padding: 20px;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#countdown-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 15px 0;
}

.timer-block {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-block span {
    font-size: 2.5rem;
    font-weight: bold;
    color: #e63946;
    /* Distinguished red */
}

.timer-block label {
    font-size: 0.8rem;
    letter-spacing: 1px;
    opacity: 0.8;
}

@media (max-width: 600px) {
    .timer-block span {
        font-size: 1.8rem;
    }

    #countdown-container {
        gap: 10px;
    }
}

/* Highlight class for the SVG paths */
.selected-district {
    fill: #bf9b30 !important;
    /* Gold highlight */
    stroke: #fff !important;
    stroke-width: 2px;
    transition: fill 0.2s ease;
}

/* Close button styling */
.close-btn {
    position: absolute;
    left: 10px;
    top: 10px;
    background: #333;
    color: #fff;
    border: 1px solid #444;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    z-index: 10;
}

.close-btn:hover {
    background: #ff4d4d;
}

/* This is the map container that helps with mobile viewing */
#map-container {
    /* --- RETAINED FROM YOUR ORIGINAL --- */
    width: 90%;
    max-width: 1100px;
    /* Increased slightly to accommodate the new padding */
    margin: 40px auto;
    /* Increased top/bottom margin for better breathing room */
    text-align: center;

    /* --- NEW PROFESSIONAL ELEMENTS --- */
    background: radial-gradient(circle at center, #1e1e1e 0%, #0a0a0a 100%);
    border: 2px solid #333;
    border-top: 1px solid #444;
    /* "Studio Lighting" top highlight */
    border-radius: 16px;
    padding: 50px 30px;
    /* Deep padding makes the map feel like a framed piece of art */

    /* Layered shadows for depth */
    box-shadow:
        inset 0 0 80px rgba(0, 0, 0, 0.9),
        0 30px 60px rgba(0, 0, 0, 0.7);

    position: relative;
    overflow: hidden;
    transition: border-color 0.5s ease;
}

/* Subtle glow effect when a user is interacting with the map */
#map-container:hover {
    border-color: #bf9b30;
    /* Faint gold glow on the container border */
}

/* The "Brand Tag" - Makes it look like a high-end data tool */
#map-container::before {
    content: "119TH CONGRESS • LIVE DATA ENGINE";
    position: absolute;
    top: 15px;
    left: 25px;
    font-size: 9px;
    font-weight: 800;
    color: #bf9b30;
    letter-spacing: 2px;
    opacity: 0.6;
}

img {
    max-width: 100%;
    /* The magic line: image shrinks to fit its container */
    height: auto;
    /* Keeps the map's proportions so it doesn't look squished */
    display: block;
    margin: 0 auto;
}

.card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

button:hover {
    background-color: #0056b3;
}

/* Mobile-first refinements for phones and small tablets */
@media (max-width: 768px) {
    body {
        min-height: 100dvh;
        height: auto;
        padding-top: var(--header-offset);
        justify-content: flex-start;
    }

    .dashboard-container {
        flex-direction: column;
        gap: 16px;
        min-height: auto;
        padding: 12px 16px;
    }

    .main-title {
        font-size: clamp(1.4rem, 6vw, 2rem);
        letter-spacing: 1px;
    }

    .administration-subtitle {
        font-size: 0.85rem;
        letter-spacing: 0.8px;
    }

    .info-section,
    .counter-section {
        min-width: 0;
        width: 100%;
    }

    .info-section h1 {
        font-size: clamp(1.5rem, 7vw, 2.2rem);
        line-height: 1.1;
    }

    .info-section p {
        font-size: 1rem;
    }

    #day-count {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    #map-container {
        width: 95%;
        padding: 24px 14px;
        margin: 20px auto;
    }

    #map-container::before {
        left: 12px;
        top: 10px;
        font-size: 8px;
        letter-spacing: 1px;
    }

    .tooltip-root {
        width: min(340px, calc(100vw - 20px));
        font-size: 13px;
    }

    .lookup-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 14px;
    }

    .map-svg-frame .map-attribution {
        right: 5px;
        bottom: 4px;
        font-size: 0.62rem;
        padding: 2px 4px;
    }
}