:root {
    --bg-primary: #080808;
    --bg-secondary: #0c0c0f;
    --text-primary: #f1f1f1;
    --text-secondary: #a0a0a0;
    --accent: #ff3a3a;
    --accent-shadow: rgba(255, 58, 58, 0.35);
    --border-color: #1e1e24;
    --sidebar-width: 280px;
    --header-height: 70px;
}

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

body {
    font-family: "Courier New", Courier, monospace;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(8, 8, 8, 0.95);
    z-index: 8;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
}
.logo-xor { color: var(--accent); }
.logo-ganiq { color: #e8e8e8; }

.container {
    display: flex;
    padding-top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

#sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    overflow-y: auto;
    max-height: calc(100vh - var(--header-height));
}

.search-container { padding: 0 20px 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); }
#search {
    width: 100%;
    padding: 10px 15px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 3px;
}

.category-tree { padding: 0 10px; }
#category-list { list-style-type: none; }

.category {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.9rem;
}
.category:hover { background-color: rgba(255, 255, 255, 0.05); }
.category i { color: var(--accent); width: 18px; text-align: center; }

.subcategories {
    list-style-type: none;
    margin-left: 15px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
}
.subcategories.active {
    max-height: 2000px;
    overflow: visible;
}

.article {
    padding: 8px 15px 8px 43px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-radius: 3px;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
}
.article:hover { color: var(--text-primary); background-color: rgba(255, 255, 255, 0.05); }

main {
    flex: 1;
    min-height: 0;
    padding: 30px;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#article-container { padding: 20px 0; }

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 0;
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.markdown-content {
    max-width: 900px;
}
.markdown-content h1, .markdown-content h2, .markdown-content h3 {
    margin: 1.5em 0 0.5em;
    color: var(--text-primary);
}
.markdown-content h1 { font-size: 2rem; }
.markdown-content h2 { font-size: 1.5rem; }
.markdown-content p { margin-bottom: 1em; }
.markdown-content ul, .markdown-content ol { margin: 1em 0 1em 2em; }
.markdown-content code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}
.markdown-content pre {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1em 0;
}
.markdown-content pre code { padding: 0; background: none; }

.error {
    padding: 20px;
    background: rgba(255, 58, 58, 0.1);
    border: 1px solid var(--accent);
    border-radius: 5px;
    color: var(--text-primary);
}

.footer-content {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 7;
    }
    #sidebar.active { transform: translateX(0); }
    main { margin-left: 0; width: 100%; }
}
