/* Reset and base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --text-primary: #eee;
    --text-secondary: #aaa;
    --accent: #e94560;
}

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

/* Header */
header {
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

nav h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent);
}

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

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    background: rgba(255,255,255,0.1);
}

.status {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Main content */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* List View */
.list-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.category-section {
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-left: 4px solid;
    cursor: pointer;
}

.category-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 500;
}

.category-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.count {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 0.875rem;
    transition: transform 0.2s;
}

.category-section.collapsed .toggle-btn .chevron {
    transform: rotate(-90deg);
}

.articles-list {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 600px;
    overflow-y: auto;
}

.category-section.collapsed .articles-list {
    display: none;
}

.article-card {
    background: var(--bg-card);
    padding: 1rem 1.25rem;
    border-radius: 6px;
    transition: transform 0.2s;
}

.article-card:hover {
    transform: translateX(4px);
}

.article-card a {
    color: var(--text-primary);
    text-decoration: none;
}

.article-card a:hover h3 {
    color: var(--accent);
}

.article-card h3 {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.article-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.article-meta .source {
    font-weight: 500;
}

.article-meta .confidence {
    opacity: 0.6;
}

.summary {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.no-articles {
    color: var(--text-secondary);
    font-style: italic;
    padding: 1rem;
    text-align: center;
}

/* Graph View */
.graph-view {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.graph-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.legend {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.controls {
    display: flex;
    gap: 0.5rem;
}

.controls button {
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.controls button:hover {
    background: var(--accent);
}

#graph-container {
    flex: 1;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
}

#graph {
    width: 100%;
    height: 100%;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 1rem;
    max-width: 350px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    pointer-events: none;
    z-index: 1000;
}

.tooltip.hidden {
    display: none;
}

.tooltip h4 {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.tooltip p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    nav {
        padding: 1rem;
    }

    main {
        padding: 1rem;
    }

    .graph-view {
        height: calc(100vh - 140px);
    }

    .legend {
        display: none;
    }
}
