:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --accent-primary: #58a6ff;
    --accent-secondary: #79c0ff;
    --accent-seal: #7ee787;
    --border-color: #30363d;
    --success: #238636;
    --warning: #d29922;
    --danger: #da3633;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    line-height: 1.6;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo .seal {
    font-size: 32px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.logo h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-seal);
}

.nav-links {
    list-style: none;
    padding: 16px 0;
    flex: 1;
}

.nav-links li {
    margin: 4px 12px;
}

.nav-links a {
    display: block;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-links a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-links a.active {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    font-weight: 500;
}

.seal-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Main Content */
.content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    max-width: calc(100% - 260px);
}

.section {
    display: none;
}

.section.active {
    display: block;
}

h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

.chart-card canvas {
    max-height: 300px;
}

/* Network Section */
.network-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.network-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.network-controls select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
}

#network-viz {
    height: 600px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

/* Sessions Section */
.sessions-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    height: calc(100vh - 200px);
}

.sessions-list {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow-y: auto;
    padding: 8px;
}

.session-item {
    padding: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.session-item:last-child {
    border-bottom: none;
}

.session-item:hover {
    background: var(--bg-tertiary);
}

.session-item.active {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-primary);
}

.session-item h4 {
    margin-bottom: 4px;
    color: var(--text-primary);
}

.session-item .timestamp {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.session-item .topics {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.topic-tag {
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.session-detail {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    overflow-y: auto;
}

.session-detail .placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
}

.message {
    margin-bottom: 16px;
    padding: 16px;
    border-radius: 8px;
    border-left: 3px solid;
}

.message.user {
    background: var(--bg-tertiary);
    border-left-color: var(--accent-primary);
}

.message.assistant {
    background: var(--bg-tertiary);
    border-left-color: var(--accent-seal);
}

.message .role {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.message .content {
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Search Section */
.search-container {
    position: relative;
    max-width: 500px;
    margin-bottom: 24px;
}

#search-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

#search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--bg-tertiary);
}

.suggestion-item .entity-type {
    font-size: 11px;
    color: var(--accent-seal);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 12px;
}

.entity-detail {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

.entity-detail h3 {
    color: var(--accent-primary);
    margin-bottom: 16px;
}

.entity-detail .entity-type {
    display: inline-block;
    background: var(--accent-seal);
    color: var(--bg-primary);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}

.relationships h4 {
    margin-top: 16px;
    margin-bottom: 8px;
}

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

.relationship-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.rel-arrow {
    color: var(--accent-primary);
    font-size: 12px;
}

/* Query Section */
.query-container {
    max-width: 900px;
}

.query-examples {
    margin-bottom: 16px;
}

.example-query {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 6px;
    margin-right: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.example-query:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}

#cypher-query {
    width: 100%;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
    resize: vertical;
    margin-bottom: 16px;
}

#cypher-query:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Buttons */
.btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg-primary);
}

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

/* Query Results */
.query-results {
    margin-top: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.results-table th,
.results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.results-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.results-table tr:hover {
    background: var(--bg-tertiary);
}

.results-table td {
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, monospace;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.error-message {
    color: var(--danger);
    padding: 16px;
    background: rgba(218, 54, 51, 0.1);
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .content {
        margin-left: 0;
        max-width: 100%;
    }
    
    .sessions-container {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s ease-in-out infinite;
}

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

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

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

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

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