/* Reset & Base Variables */
:root {
    --bg-color: #08090c;
    --primary-color: #f59e0b;
    --text-color: #d97706;
    --border-color: rgba(245, 158, 11, 0.3);
    --hover-bg: rgba(245, 158, 11, 0.1);
    
    --font-mono: 'Courier New', Courier, monospace;
    --font-sans: 'Inter', system-ui, sans-serif;
    
    --crt-scanline: rgba(245, 158, 11, 0.05);
}

[data-theme="phosphor"] {
    --primary-color: #10b981;
    --text-color: #059669;
    --border-color: rgba(16, 185, 129, 0.3);
    --hover-bg: rgba(16, 185, 129, 0.1);
    --crt-scanline: rgba(16, 185, 129, 0.05);
}

[data-theme="dark"] {
    --bg-color: #121212;
    --primary-color: #60a5fa;
    --text-color: #e5e7eb;
    --border-color: #374151;
    --hover-bg: #1f2937;
    --crt-scanline: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-mono);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    overflow-x: hidden;
}

/* CRT Effect */
body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, var(--crt-scanline) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 999;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

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

/* Header */
.terminal-header {
    display: flex;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sys-info span { margin-right: 1.5rem; }
.sys-info a {
    color: var(--primary-color);
    text-decoration: none;
    margin-right: 1.5rem;
    font-weight: bold;
    opacity: 0.6;
    transition: opacity 0.2s, text-shadow 0.2s;
}
.sys-info a:hover {
    opacity: 1;
    text-shadow: 0 0 8px var(--primary-color);
}
.sys-info a.active {
    opacity: 1;
    text-shadow: 0 0 8px var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

/* Theme Switcher */
.theme-switcher { display: flex; gap: 0.5rem; }
.theme-btn {
    width: 20px; height: 20px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    cursor: pointer; padding: 0;
}
.theme-btn.ambre { background: #f59e0b; }
.theme-btn.vert { background: #10b981; }
.theme-btn.sombre { background: #1f2937; border-color: #60a5fa; }

/* Glitch Text */
.glitch-text {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 4px;
}

/* Search Form */
.search-form {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    padding: 1rem;
    background: var(--hover-bg);
    margin-bottom: 3rem;
}
.prompt-symbol { font-size: 1.5rem; margin-right: 1rem; color: var(--primary-color); }
.search-form input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-family: var(--font-mono);
    font-size: 1.2rem;
    outline: none;
}
.search-form button {
    background: var(--primary-color);
    color: var(--bg-color);
    border: none;
    padding: 0.5rem 1.5rem;
    font-family: var(--font-mono);
    font-weight: bold;
    cursor: pointer;
}
.search-form button:hover { opacity: 0.8; }

/* Radar List */
.radar-header {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}
.radar-header h2 { font-size: 1rem; letter-spacing: 2px; }

.links-list { list-style: none; padding: 0; }
.link-card {
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    transition: background 0.2s;
}
.link-card:hover { background: var(--hover-bg); }

.link-meta {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}
.category-badge { color: var(--primary-color); }
.link-card h3 {
    margin: 0 0 0.5rem 0;
    font-family: var(--font-sans);
    font-size: 1.3rem;
}
.link-card a {
    color: var(--primary-color);
    text-decoration: none;
}
.link-card a:hover { text-decoration: underline; }

.description, .snippet {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    opacity: 0.8;
    margin-bottom: 1rem;
}
.snippet mark {
    background: var(--primary-color);
    color: var(--bg-color);
}
.url-display {
    font-size: 0.75rem;
    opacity: 0.5;
    word-break: break-all;
}

/* JEV States */
.state-purring { border-left: 4px solid #10b981; }
.state-alert { border-left: 4px solid #f59e0b; }
.state-hissing { border-left: 4px solid #ef4444; opacity: 0.6; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}
.pagination a {
    color: var(--primary-color);
    text-decoration: none;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    transition: background 0.2s;
}
.pagination a:hover {
    background: var(--hover-bg);
}
.page-info {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Footer Signature */
.terminal-footer {
    text-align: center;
    padding: 2rem;
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    opacity: 0.7;
}
.terminal-footer a {
    color: var(--primary-color);
    text-decoration: none;
}
.terminal-footer a:hover {
    text-decoration: underline;
}

/* Scroll to Top Button */
#scrollToTopBtn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-color);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: background 0.2s;
}
#scrollToTopBtn:hover {
    background: var(--hover-bg);
}

.command-panels { display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.command-panels .search-form { margin-bottom: 0; flex: 1; min-width: 300px; }
.ingest-form { border-color: rgba(16, 185, 129, 0.3); }
.ingest-form .prompt-symbol, .ingest-form input { color: #10b981; }
.ingest-form button { background: #10b981; }
.category-select {
    background: transparent;
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.5rem;
    font-family: var(--font-mono);
    margin-right: 0.5rem;
    outline: none;
    cursor: pointer;
}
.category-select option {
    background: var(--bg-color);
    color: #10b981;
}

/* Learning Paths */
.paths-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}
.path-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
}
.path-card:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
}
.path-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}
.node-index {
    color: var(--primary-color);
    opacity: 0.7;
}

.edit-link {
    margin-left: auto;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.8rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.edit-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Responsive (iPhone & iPad) */
@media (max-width: 768px) {
    .terminal-header {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        text-align: center;
    }
    .sys-info {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    .sys-info span, .sys-info a { margin-right: 0; }
    
    .container {
        padding: 1rem;
    }
    
    .glitch-text {
        font-size: 1.8rem;
    }
    
    .command-panels .search-form {
        min-width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    .command-panels .search-form button {
        width: 100%;
    }
    .category-select {
        margin-right: 0;
        width: 100%;
    }
    .prompt-symbol { display: none; }
    
    .paths-grid {
        grid-template-columns: 1fr;
    }
    
    .link-meta {
        flex-wrap: wrap;
    }
}
