:root {
    /* Dark theme (default) */
    --bg-primary: #000;
    --bg-secondary: #1a1a1a;
    --text-primary: #f0f0f0;
    --text-secondary: #888;
    --text-muted: #ccc;
    --border-color: #333;
    --border-accent: #666;
    --link-color: #fff;
    --link-hover: #ccc;
    --noise-opacity: 0.15;
}

[data-theme="light"] {
    /* Light theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --text-muted: #333;
    --border-color: #ddd;
    --border-accent: #999;
    --link-color: #000;
    --link-hover: #333;
    --noise-opacity: 0.05;
}

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

body {
    font-family: 'Andale Mono', monospace;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-repeat: repeat;
    opacity: var(--noise-opacity);
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.3s ease;
}

.logo {
    font-size: 2.2em;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: 1px;
    margin-bottom: 20px;
    padding-left: 8px;
    -webkit-text-stroke: 0.5px var(--text-primary);
    transition: color 0.3s ease;
}

.container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: 250px;
    background-color: var(--bg-primary);
    padding: 20px;
    padding-bottom: 60px;
    overflow-y: auto;
    flex-shrink: 0;
    position: relative;
    transition: background-color 0.3s ease;
}

.sidebar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20px;
    bottom: 60px;
    width: 1px;
    background-color: var(--border-color);
    transition: background-color 0.3s ease;
}

.menu ul {
    list-style: none;
}

.menu li {
    margin-bottom: 10px;
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s;
}

.menu li.parent-dir {
    cursor: default;
    color: var(--text-secondary);
    font-weight: bold;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.menu li.parent-dir:hover {
    background-color: transparent;
    border-left-color: transparent;
}

.menu li.file-item {
    padding-left: 20px;
    border-left: 2px solid transparent;
}

.menu li:hover:not(.active) {
    text-decoration: underline;
}

.menu li.active {
    text-decoration: underline;
    background-color: transparent !important;
    border-left-color: transparent !important;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    padding-bottom: 60px;
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease;
}

#markdown-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

#markdown-content h1,
#markdown-content h2,
#markdown-content h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    transition: border-color 0.3s ease;
}

#markdown-content h1 {
    font-size: 2em;
}

#markdown-content h2 {
    font-size: 1.5em;
}

#markdown-content h3 {
    font-size: 1.2em;
}

#markdown-content p {
    margin-bottom: 15px;
}

#markdown-content ul,
#markdown-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

#markdown-content li {
    margin-bottom: 8px;
}

/* Code blocks - preserve all whitespace */
#markdown-content pre {
    background-color: var(--bg-secondary);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 15px;
    border-left: 3px solid var(--border-accent);
    white-space: pre;
    font-family: 'Andale Mono', monospace;
    position: relative;
    tab-size: 4;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

#markdown-content pre code {
    background-color: transparent;
    padding: 0;
    white-space: pre;
    font-family: 'Andale Mono', monospace;
    display: block;
    font-size: 1em;
}

/* Inline code - different styling */
#markdown-content code:not(pre code) {
    background-color: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    white-space: pre;
    font-family: 'Andale Mono', monospace;
    transition: background-color 0.3s ease;
}

/* Loading bar animation for block characters - reveal one by one */
@keyframes loading-bar-reveal {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* Animate block characters (█ and ░) with a progressive loading effect */
#markdown-content pre .loading-bar-char {
    display: inline-block;
    opacity: 0;
    animation: loading-bar-reveal 0.1s ease-out forwards;
    animation-delay: calc(var(--char-index) * 0.05s);
}

#markdown-content a {
    color: var(--link-color);
    text-decoration: underline;
    transition: color 0.3s ease;
}

#markdown-content a:hover {
    color: var(--link-hover);
}

#markdown-content blockquote {
    border-left: 3px solid var(--border-accent);
    padding-left: 15px;
    margin-left: 0;
    color: var(--text-muted);
    font-style: italic;
    transition: border-color 0.3s ease, color 0.3s ease;
}

/* Tooltip for "ahoj" */
#markdown-content .ahoj-tooltip {
    position: relative;
    cursor: help;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

#markdown-content .ahoj-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 5px;
    padding: 4px 8px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-accent);
    border-radius: 3px;
    font-size: 0.75em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out, background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    z-index: 1000;
}

#markdown-content .ahoj-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: -1px;
    border: 4px solid transparent;
    border-top-color: var(--border-accent);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out, border-color 0.3s ease;
    z-index: 1001;
}

#markdown-content .ahoj-tooltip:hover::after,
#markdown-content .ahoj-tooltip:hover::before {
    opacity: 1;
}

.footer {
    position: fixed;
    bottom: 0;
    left: 20px;
    right: 20px;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
    font-size: 0.85em;
    flex-wrap: wrap;
    z-index: 100;
    color: var(--text-secondary);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 3px;
    font-family: 'Andale Mono', monospace;
    font-size: 0.85em;
    transition: all 0.2s ease;
    z-index: 200;
}

.theme-toggle:hover {
    background-color: var(--border-color);
    border-color: var(--border-accent);
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .content {
        padding: 20px;
    }
    
    .footer {
        display: none;
    }
}

