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

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-dark: #0a0a0a;
    --bg-medium: #1a1a1a;
    --bg-light: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --border-color: #2a2a2a;
    
    --type-politician: #3b82f6;
    --type-bill: #fbbf24;
    --type-movement: #f59e0b;
    --type-idea: #fcd34d;
    --type-team: #10b981;
    --type-player: #14b8a6;
    --type-league: #6ee7b7;
    --type-event: #6b7280;
    --type-movie: #a855f7;
    --type-tv_show: #8b5cf6;
    --type-album: #ec4899;
    --type-podcast: #f472b6;
    --type-entertainer: #f97316;
    --type-studio: #06b6d4;
}

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

.navbar {
    background: var(--bg-medium);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 0.875rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-light);
}

.nav-link.active {
    color: var(--text-primary);
    background: var(--primary-color);
}

/* Visual separator between categories and utilities */
.nav-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 0.5rem;
}

/* Responsive navigation */
@media (max-width: 1400px) {
    .nav-links {
        gap: 0.375rem;
    }
    
    .nav-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
}

.section {
    display: none;
    padding: 2rem 0;
}

.section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
}

.title-with-help {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.help-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.info-banner {
    background: var(--bg-medium);
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.info-banner strong {
    color: var(--text-primary);
}

.select {
    background: var(--bg-medium);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.filter-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-medium);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.ticker-container {
    background: var(--bg-dark);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
}

.ticker-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr 2fr;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #1a1a1a;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6b7280;
    border-bottom: 1px solid var(--border-color);
}

.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.sortable:hover {
    color: var(--primary-color);
}

.ticker-list {
    max-height: 70vh;
    overflow-y: auto;
}

.ticker-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr 2fr;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #1a1a1a;
    transition: background 0.2s;
    align-items: center;
    background: var(--bg-dark);
}

.ticker-item:hover {
    background: #141414;
}

.entity-name {
    font-weight: 600;
    font-size: 1rem;
}

.entity-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
}

.entity-thumbnail-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    margin-right: 12px;
    flex-shrink: 0;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
}

.col-entity {
    display: flex;
    align-items: center;
}

.entity-type {
    display: inline-block;
    font-size: 0.9rem;
    text-transform: lowercase;
    color: var(--text-secondary);
    font-weight: 400;
}

.score {
    font-size: 1.25rem;
    font-weight: 700;
}

.change {
    font-weight: 600;
}

.change.positive {
    color: var(--success-color);
}

.change.negative {
    color: var(--danger-color);
}

.change.neutral {
    color: var(--text-secondary);
}

.sov {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.zscore {
    font-size: 0.95rem;
    font-weight: 700;
}

.zscore.positive {
    color: var(--success-color);
}

.zscore.negative {
    color: var(--danger-color);
}

.zscore.neutral {
    color: var(--text-secondary);
}

.sparkline-container {
    height: 50px;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.api-test-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.endpoint-selector {
    background: var(--bg-medium);
    padding: 1.5rem;
    border-radius: 1rem;
    height: fit-content;
}

.endpoint-selector h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.endpoint-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.endpoint-btn {
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    text-align: left;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Courier New', monospace;
}

.endpoint-btn:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
}

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

.test-panel {
    background: var(--bg-medium);
    padding: 1.5rem;
    border-radius: 1rem;
}

.test-panel h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.test-panel h3:first-child {
    margin-top: 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.code-input {
    width: 100%;
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
}

.response-box {
    background: var(--bg-dark);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    max-height: 400px;
    overflow-y: auto;
}

.docs-content {
    background: var(--bg-medium);
    padding: 2rem;
    border-radius: 1rem;
}

.doc-section {
    margin-bottom: 3rem;
}

.doc-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.doc-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.8;
}

.doc-section ul {
    list-style: none;
    padding-left: 0;
}

.doc-section ul li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
}

.inline-code {
    background: var(--bg-dark);
    color: #10b981;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.type-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.type-pill.politician { background: rgba(59, 130, 246, 0.2); color: var(--type-politician); }
.type-pill.bill { background: rgba(251, 191, 36, 0.2); color: var(--type-bill); }
.type-pill.movement { background: rgba(245, 158, 11, 0.2); color: var(--type-movement); }
.type-pill.idea { background: rgba(252, 211, 77, 0.2); color: var(--type-idea); }
.type-pill.team { background: rgba(16, 185, 129, 0.2); color: var(--type-team); }
.type-pill.player { background: rgba(20, 184, 166, 0.2); color: var(--type-player); }
.type-pill.league { background: rgba(110, 231, 183, 0.2); color: var(--type-league); }
.type-pill.event { background: rgba(107, 114, 128, 0.2); color: var(--type-event); }
.type-pill.movie { background: rgba(168, 85, 247, 0.2); color: var(--type-movie); }
.type-pill.tv_show { background: rgba(139, 92, 246, 0.2); color: var(--type-tv_show); }
.type-pill.album { background: rgba(236, 72, 153, 0.2); color: var(--type-album); }
.type-pill.podcast { background: rgba(244, 114, 182, 0.2); color: var(--type-podcast); }
.type-pill.entertainer { background: rgba(249, 115, 22, 0.2); color: var(--type-entertainer); }
.type-pill.studio { background: rgba(6, 182, 212, 0.2); color: var(--type-studio); }

.code-block {
    background: var(--bg-dark);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    margin: 1rem 0;
}

.endpoint-doc {
    background: var(--bg-dark);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.endpoint-doc h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.params {
    margin-top: 1rem;
}

.params strong {
    color: var(--text-primary);
}

.snippets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
}

.snippet-card {
    background: var(--bg-medium);
    padding: 1.5rem;
    border-radius: 1rem;
}

.snippet-card h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    margin: 2rem;
    animation: slideDown 0.3s;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-medium);
    z-index: 10;
}

.modal-header h2 {
    font-size: 1.75rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

.methodology-section {
    margin-bottom: 2rem;
}

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

.methodology-section p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.metric-explain,
.tech-block {
    background: var(--bg-dark);
    border-left: 3px solid var(--primary-color);
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 0.5rem;
}

.metric-explain h4,
.tech-block h4 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.metric-explain ul,
.tech-block ul,
.methodology-section > ul {
    list-style: none;
    padding-left: 0;
}

.metric-explain li,
.tech-block li,
.methodology-section > ul li {
    color: var(--text-secondary);
    padding: 0.5rem 0;
    line-height: 1.6;
}

.tech-block code {
    background: var(--bg-light);
    color: var(--success-color);
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .ticker-header,
    .ticker-item {
        grid-template-columns: 1fr;
    }
    
    .api-test-grid,
    .snippets-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-links {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}
