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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #202122;
    --text-secondary: #54595d;
    --border-color: #a2a9b1;
    --link-color: #3366cc;
    --link-hover: #447ff5;
    --button-bg: #3366cc;
    --button-hover: #447ff5;
}

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

header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.search-bar {
    flex: 1;
    max-width: 500px;
}

.search-bar input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    font-size: 0.95rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.9rem;
    background: var(--button-bg);
    color: white;
    transition: background 0.2s;
}

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

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 1rem;
    padding: 1rem;
}

.articles-container {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.article-panel {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    min-height: 500px;
}

.article-panel.single {
    max-width: 900px;
    margin: 0 auto;
}

.article-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-title {
    font-size: 1.8rem;
    font-weight: 400;
}

.article-meta {
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.article-content {
    padding: 1.5rem;
    line-height: 1.7;
}

.article-content h2 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.article-content h3 {
    font-size: 1.2rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.article-content p {
    margin-bottom: 1rem;
}

.article-content a {
    color: var(--link-color);
    text-decoration: none;
}

.article-content a:hover {
    text-decoration: underline;
}

.version-selector {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    font-size: 0.9rem;
}

.loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state h2 {
    margin-bottom: 0.5rem;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 4px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 1rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    font-family: inherit;
}

.form-group textarea {
    min-height: 200px;
    font-family: monospace;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.status-indicator {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 2px;
}

.status-indicator.connected {
    background: #d4edda;
    color: #155724;
}

.status-indicator.disconnected {
    background: #f8d7da;
    color: #721c24;
}

@media (max-width: 1024px) {
    .articles-container {
        flex-direction: column;
    }

    .article-panel {
        max-width: 100%;
    }

    .header-content {
        flex-wrap: wrap;
    }

    .search-bar {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
    }
}

/* AsciiDoc specific styles */
.article-content pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 1rem;
    overflow-x: auto;
}

.article-content code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    background: var(--bg-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 2px;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content blockquote {
    border-left: 4px solid var(--border-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.article-content .sidebar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 1rem;
    margin: 1rem 0;
}

.article-content .admonition {
    border-left: 4px solid;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: 2px;
}

.article-content .admonition-note {
    background: #e7f3ff;
    border-color: #2196F3;
}

.article-content .admonition-tip {
    background: #e8f5e9;
    border-color: #4CAF50;
}

.article-content .admonition-important {
    background: #fff3e0;
    border-color: #FF9800;
}

.article-content .admonition-warning {
    background: #fff3cd;
    border-color: #FFC107;
}

.article-content .admonition-caution {
    background: #ffebee;
    border-color: #F44336;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.article-content table td,
.article-content table th {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
}

.article-content table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.article-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.article-content ul,
.article-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.article-content li {
    margin: 0.25rem 0;
}

.wikilink {
    color: #3366cc;
    text-decoration: none;
    font-weight: 500;
}

.wikilink:hover {
    text-decoration: underline;
}

.nostr-link {
    color: #8b5cf6;
    text-decoration: none;
    font-family: monospace;
    font-size: 0.9em;
}

.nostr-link:hover {
    text-decoration: underline;
}

.home-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.home-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.article-list {
    display: grid;
    gap: 0.75rem;
}

.article-item {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.2s;
}

.article-item:hover {
    background: var(--bg-secondary);
}

.article-item-title {
    font-weight: 600;
    color: var(--link-color);
    margin-bottom: 0.25rem;
}

.article-item-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
}

.category-tag {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.category-tag:hover {
    background: var(--button-bg);
    color: white;
    border-color: var(--button-bg);
}