:root {
    --bg-main: #0f0f12;
    --bg-sidebar: #0a0a0c;
    --bg-card: #18181b;
    --accent: #ff3e3e;
    --accent-hover: #ff5555;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border: #27272a;
    --sidebar-width: 280px;
    --top-bar-height: 64px;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --glass: rgba(15, 15, 18, 0.7);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

#app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.logo-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px rgba(255, 62, 62, 0.5));
}

.logo-text span {
    color: var(--accent);
}

#nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.nav-item {
    display: block;
    padding: 0.6rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(255, 62, 62, 0.1);
    color: var(--accent);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Main Content */
#main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#top-bar {
    height: var(--top-bar-height);
    background-color: var(--glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

#breadcrumbs {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.top-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.top-links a:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

#content-render {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 2rem;
    flex: 1;
    width: 100%;
}

/* Markdown Styling */
.markdown-body h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.markdown-body h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.markdown-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.markdown-body p {
    margin-bottom: 1.25rem;
    color: var(--text-secondary);
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.markdown-body li {
    margin-bottom: 0.5rem;
}

.markdown-body blockquote {
    border-left: 4px solid var(--accent);
    background: rgba(255, 62, 62, 0.05);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}

.markdown-body img {
    max-width: 100%;
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: var(--shadow);
}

.markdown-body code:not(pre code) {
    background: var(--bg-card);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--accent);
}

.markdown-body pre {
    background: #000 !important;
    padding: 1rem;
    border-radius: 10px;
    margin: 1.5rem 0;
    border: 1px solid var(--border);
    overflow-x: auto;
}

/* Callouts */
.markdown-body blockquote[data-type="IMPORTANT"] {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

/* Footer */
#page-footer {
    padding: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

#page-footer a {
    color: var(--accent);
    text-decoration: none;
}

/* Mobile */
.mobile-only {
    display: none;
}

@media (max-width: 1024px) {
    #sidebar {
        transform: translateX(-100%);
    }
    
    #sidebar.open {
        transform: translateX(0);
    }
    
    #main-content {
        margin-left: 0;
    }
    
    .mobile-only {
        display: block;
    }
    
    #mobile-open {
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.5rem;
        cursor: pointer;
    }
    
    #mobile-close {
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.5rem;
        cursor: pointer;
    }
}

/* Loader */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 62, 62, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
    margin: 4rem auto;
}

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

/* Error Container */
.error-container {
    text-align: center;
    padding: 4rem 2rem;
}

.error-container h1 {
    font-size: 4rem;
    color: var(--accent);
    margin-bottom: 1rem;
    border: none;
}

.error-container small {
    display: block;
    margin-top: 1rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* Hero Section */
.hero-section {
    padding: 4rem 0;
    text-align: center;
    background: radial-gradient(circle at center, rgba(255, 62, 62, 0.1) 0%, transparent 70%);
}

.glitch-text {
    font-size: 5rem;
    font-weight: 900;
    text-transform: uppercase;
    position: relative;
    color: var(--text-primary);
    letter-spacing: -2px;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

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

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 62, 62, 0.3);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--text-muted);
}

/* Stats */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 4rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: border-color 0.3s ease;
}

.stat-card:hover {
    border-color: var(--accent);
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Grid Layouts */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 4rem 0;
}

.feature-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--accent);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* CTA */
.call-to-action {
    background: linear-gradient(135deg, #ff3e3e 0%, #991b1b 100%);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    margin-top: 4rem;
}

.call-to-action h2 {
    color: white;
    margin-bottom: 1rem;
}

.call-to-action p {
    color: rgba(255, 255, 255, 0.9);
}

.call-to-action code {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-weight: 700;
}

/* HTML Content Specifics */
.html-content {
    animation: fadeIn 0.6s ease-out;
}

/* Fade-in animation class */
.fade-in {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Gallery */
.gallery-header {
    text-align: center;
    margin-bottom: 3rem;
}

.gallery-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    border: none;
}

.gallery-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.gallery-item.large {
    grid-column: span 2;
}

.gallery-placeholder {
    border-radius: 16px;
    height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.gallery-placeholder:hover {
    transform: scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 0 30px rgba(255, 62, 62, 0.15);
}

.gallery-emoji {
    font-size: 3rem;
}

.gallery-caption {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
}

.gallery-cta {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.gallery-cta a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.gallery-cta a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .glitch-text { font-size: 3rem; }
    .hero-stats { grid-template-columns: 1fr; }
    .gallery-grid { grid-template-columns: 1fr; }
    .gallery-item.large { grid-column: span 1; }
}

/* ===== Multi-Format Styles ===== */

/* Format badge in breadcrumbs */
.format-badge {
    display: inline-block;
    background: var(--bg-card);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    vertical-align: middle;
    margin-left: 6px;
    text-transform: uppercase;
}

/* Plain text & logs */
.format-txt, .format-log {
    background: #000 !important;
    color: #c9d1d9;
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.format-log {
    color: #8b949e;
}

/* CSV Tables */
.table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.csv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.csv-table th {
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 700;
    text-align: left;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid var(--accent);
    white-space: nowrap;
}

.csv-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.csv-table tbody tr:hover {
    background: rgba(255, 62, 62, 0.04);
}

.csv-table tbody tr:last-child td {
    border-bottom: none;
}

/* Callout types */
.markdown-body blockquote[data-type="NOTE"] {
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.06);
}

.markdown-body blockquote[data-type="TIP"] {
    border-left-color: #22c55e;
    background: rgba(34, 197, 94, 0.06);
}

.markdown-body blockquote[data-type="IMPORTANT"] {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.06);
}

.markdown-body blockquote[data-type="WARNING"] {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.06);
}

.markdown-body blockquote[data-type="CAUTION"] {
    border-left-color: #a855f7;
    background: rgba(168, 85, 247, 0.06);
}

/* Monospace override */
code, pre, .format-txt, .format-log {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
