/* Congressional Cosponsorship Network — Main Styles */

:root {
    --dem-blue: #2166ac;
    --rep-red: #b2182b;
    --ind-purple: #756bb1;
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --bg-surface: #21262d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --accent: #58a6ff;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ─── Navigation ────────────────────────────────────────────── */

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 56px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand span {
    font-size: 1.3rem;
}

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

.nav-links a {
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ─── Filter Bar ────────────────────────────────────────────── */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-btn-group {
    display: flex;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.filter-btn {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.filter-btn:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.filter-btn.active {
    background: var(--accent);
    color: #fff;
}

.filter-select {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
}

.filter-slider {
    width: 100px;
    accent-color: var(--accent);
}

.filter-value {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 1.5em;
}

/* ─── Page Layouts ──────────────────────────────────────────── */

.page-header {
    padding: 2rem 1.5rem 1rem;
    text-align: center;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.graph-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
}

.graph-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* ─── Landing Page ──────────────────────────────────────────── */

.hero {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.hero h1 .highlight-d { color: var(--dem-blue); }
.hero h1 .highlight-r { color: var(--rep-red); }

.hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 650px;
    margin: 0 auto 2rem;
}

.page-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    padding: 0 1.5rem 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.page-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: border-color 0.2s, transform 0.2s;
    display: block;
}

.page-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    text-decoration: none;
}

.page-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.page-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.page-card .card-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

/* ─── Leaderboard Section ───────────────────────────────────── */

.leaderboards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1rem 1.5rem 3rem;
    max-width: 1000px;
    margin: 0 auto;
}

.leaderboard {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.leaderboard h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.leaderboard-list {
    list-style: none;
}

.leaderboard-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.leaderboard-list li:last-child {
    border-bottom: none;
}

.lb-rank {
    font-weight: 700;
    color: var(--text-muted);
    width: 1.5em;
}

.lb-name {
    flex: 1;
    margin: 0 0.75rem;
}

.lb-party {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.4rem;
}

.lb-party.D { background: var(--dem-blue); }
.lb-party.R { background: var(--rep-red); }
.lb-party.I { background: var(--ind-purple); }

.lb-score {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ─── Stats Bar ─────────────────────────────────────────────── */

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem 1.5rem;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ─── Sidebar (Detail Panel + Leaderboard) ──────────────────── */

.sidebar {
    position: fixed;
    top: 56px;
    right: -400px;
    width: 380px;
    height: calc(100vh - 56px);
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    z-index: 90;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 1.5rem;
}

.sidebar.open {
    right: 0;
}

.sidebar-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.sidebar h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Inline sidebar for graph pages (non-overlay) */
.graph-with-sidebar {
    display: flex;
    height: calc(100vh - 56px - 42px);  /* nav + filter bar */
}

.graph-with-sidebar .graph-container {
    flex: 1;
}

.graph-with-sidebar .page-sidebar {
    width: 300px;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 1rem;
    flex-shrink: 0;
}

.page-sidebar h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.page-sidebar-list {
    list-style: none;
}

.page-sidebar-list li {
    padding: 0.5rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s;
}

.page-sidebar-list li:hover {
    background: var(--bg-surface);
}

/* ─── Member Page ───────────────────────────────────────────── */

.member-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.member-photo {
    width: 100px;
    height: 130px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg-surface);
}

.member-info h1 {
    font-size: 1.75rem;
}

.member-info .member-meta {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.member-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.member-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem 1.5rem 2rem;
}

.member-section h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.ally-list {
    list-style: none;
}

.ally-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
}

.ally-list li:last-child {
    border-bottom: none;
}

/* ─── About Page ────────────────────────────────────────────── */

.about-content {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    line-height: 1.7;
}

.about-content h2 {
    font-size: 1.3rem;
    margin: 2rem 0 0.75rem;
}

.about-content p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.embed-code {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    color: var(--text-primary);
}

/* ─── Mock Data Banner ──────────────────────────────────────── */

.mock-banner {
    background: #1a1a2e;
    border: 1px solid #e2b340;
    color: #e2b340;
    text-align: center;
    padding: 0.4rem;
    font-size: 0.8rem;
}

/* ─── Responsive ────────────────────────────────────────────── */

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        flex-direction: column;
        padding: 0.5rem;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

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

    .graph-with-sidebar {
        flex-direction: column;
    }

    .graph-with-sidebar .page-sidebar {
        width: 100%;
        max-height: 200px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .sidebar {
        width: 100%;
        right: -100%;
    }

    .member-header {
        flex-direction: column;
        text-align: center;
    }

    .filter-bar {
        padding: 0.5rem;
        gap: 0.5rem;
    }
}
