/* Guide-specific styles */

/* Override body layout for guides */
body:has(.guide-container) {
    overflow: hidden;
    height: 100vh;
    gap: 0;
    display: flex;
    flex-direction: column;
}

/* Main guide layout wrapper */
.guide-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Container and Layout */
.guide-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    height: calc(100vh - 4rem); /* Account for header height */
}

/* Table of Contents Sidebar */
.guide-toc {
    width: 280px;
    background: rgba(0, 0, 0, 0.8);
    border-right: 1px solid rgba(var(--primary-rgb), 0.3);
    overflow-y: auto;
    padding: 20px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    box-shadow: inset -1px 0 2rem 0 rgba(var(--primary-rgb), calc(var(--glow-intensity) / 6));
}

.guide-toc h3 {
    color: var(--input-color);
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 0 1rem rgba(var(--primary-rgb), var(--glow-intensity));
}

.guide-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.guide-toc > ul > li {
    margin-bottom: 15px;
}

.guide-toc a {
    color: rgba(var(--input-rgb), 0.7);
    text-decoration: none;
    display: block;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.guide-toc a:hover {
    color: var(--input-color);
    background: rgba(var(--primary-rgb), 0.1);
    text-shadow: 0 0 0.5rem rgba(var(--primary-rgb), var(--glow-intensity));
}

.guide-toc a.active {
    color: var(--input-color);
    background: rgba(var(--primary-rgb), 0.2);
    font-weight: 600;
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    box-shadow: inset 0 0 1rem 0 rgba(var(--primary-rgb), calc(var(--glow-intensity) / 4));
}

/* Nested TOC items */
.guide-toc ul ul {
    margin-left: 20px;
    margin-top: 5px;
}

.guide-toc ul ul a {
    font-size: 13px;
    padding: 5px 12px;
    color: rgba(var(--input-rgb), 0.5);
}

.guide-toc ul ul a:hover {
    color: rgba(var(--input-rgb), 0.9);
}

.guide-toc ul ul a.active {
    color: var(--input-color);
    background: rgba(var(--primary-rgb), 0.15);
}

/* Main content area */
.guide-content {
    flex: 1;
    overflow-y: auto;
    padding: 3rem 4rem;
    margin: 0;
    width: 100%;
}

/* Mobile toggle button */
.guide-toc-toggle {
    display: none;
    position: fixed;
    left: 20px;
    top: 80px;
    z-index: 101;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(var(--primary-rgb), 0.5);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0px 0.25rem 1rem 0 rgb(0 0 0 / 50%), inset 0 0 2rem 0 rgba(var(--primary-rgb), calc(var(--glow-intensity) / 3));
}

.guide-toc-toggle:hover {
    background: rgba(var(--primary-rgb), 0.1);
    box-shadow: 0px 0.25rem 1rem 0 rgb(0 0 0 / 50%), inset 0 0 2rem 0 rgba(var(--primary-rgb), calc(var(--glow-intensity) / 2));
}

.guide-toc-toggle svg {
    width: 24px;
    height: 24px;
    fill: var(--input-color);
}

/* Content Styling */
.guide-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 2rem 0;
    color: var(--input-color);
    border-bottom: 2px solid rgba(var(--primary-rgb), 0.3);
    padding-bottom: 1.5rem;
    text-shadow: 0 0 1rem rgba(var(--primary-rgb), var(--glow-intensity));
    letter-spacing: -0.02em;
}

.guide-content h2 {
    font-size: 2rem;
    font-weight: 600;
    margin: 4rem 0 1.5rem 0;
    color: var(--input-color);
    position: relative;
    padding-top: 1.5rem;
    text-shadow: 0 0 0.5rem rgba(var(--primary-rgb), calc(var(--glow-intensity) * 0.8));
    letter-spacing: -0.01em;
}

.guide-content h2:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(var(--primary-rgb), 0.3) 0%, transparent 100%);
}

.guide-content h2:first-of-type {
    margin-top: 0;
}

.guide-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 3rem 0 1.25rem 0;
    color: rgba(var(--input-rgb), 0.95);
    letter-spacing: -0.01em;
}

.guide-content h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2.5rem 0 1rem 0;
    color: rgba(var(--input-rgb), 0.9);
}

.guide-content h5 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem 0;
    color: rgba(var(--input-rgb), 0.85);
}

.guide-content p {
    line-height: 1.75;
    margin: 0 0 1.25rem 0;
    color: rgba(var(--input-rgb), 0.8);
    font-size: 1rem;
}

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

.guide-content li {
    margin-bottom: 0.5rem;
    line-height: 1.75;
    color: rgba(var(--input-rgb), 0.8);
}

.guide-content li:last-child {
    margin-bottom: 0;
}

/* Nested lists */
.guide-content ul ul,
.guide-content ol ol,
.guide-content ul ol,
.guide-content ol ul {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Tables */
.guide-content table {
    width: 100%;
    margin: 2rem 0;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    font-size: 0.95rem;
}

.guide-content th {
    background: rgba(var(--primary-rgb), 0.1);
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    color: var(--input-color);
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.3);
}

.guide-content td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.1);
    color: rgba(var(--input-rgb), 0.8);
    vertical-align: top;
}

.guide-content tr:last-child td {
    border-bottom: none;
}

/* Blockquotes */
.guide-content blockquote {
    background: rgba(0, 0, 0, 0.5);
    border-left: 4px solid rgba(var(--primary-rgb), 0.5);
    padding: 1.5rem 2rem;
    margin: 1.5rem 0;
    border-radius: 0.25rem;
    box-shadow: inset 0 0 1rem 0 rgba(var(--primary-rgb), calc(var(--glow-intensity) / 6));
}

.guide-content blockquote p {
    margin-bottom: 0.75rem;
}

.guide-content blockquote p:last-child {
    margin-bottom: 0;
}

.guide-content blockquote ul,
.guide-content blockquote ol {
    margin-bottom: 0;
}

/* Code blocks */
.guide-content code {
    background: rgba(var(--secondary-rgb), 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--secondary-color);
}

/* Warning blocks */
.guide-content .warn {
    background: rgba(255, 100, 100, 0.1);
    border: 1px solid rgba(255, 100, 100, 0.3);
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
}

.guide-content .warn blockquote {
    background: transparent;
    border-left-color: rgba(255, 100, 100, 0.5);
    margin: 0;
    padding: 0.5rem 0 0.5rem 1.5rem;
    box-shadow: none;
}

/* Images */
.guide-content img {
    max-width: 100%;
    height: auto;
    margin: 1.5rem auto;
    display: block;
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .guide-toc {
        width: 250px;
    }
    
    .guide-content {
        padding: 2.5rem 3rem;
    }
}

@media (max-width: 768px) {
    .guide-toc {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        width: 280px;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .guide-toc.active {
        transform: translateX(0);
    }
    
    .guide-content {
        padding: 1.5rem;
        max-width: 100%;
    }
    
    .guide-toc-toggle {
        display: block;
    }
    
    .guide-content h1 {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }
    
    .guide-content h2 {
        font-size: 1.75rem;
        margin-top: 3rem;
    }
    
    .guide-content h3 {
        font-size: 1.35rem;
        margin-top: 2.5rem;
    }
    
    .guide-content h4 {
        font-size: 1.15rem;
        margin-top: 2rem;
    }
    
    .guide-content h5 {
        font-size: 1rem;
        margin-top: 1.5rem;
    }
    
    .guide-content p {
        font-size: 0.95rem;
    }
    
    .guide-content table {
        font-size: 0.875rem;
    }
    
    .guide-content th,
    .guide-content td {
        padding: 0.75rem 1rem;
    }
    
    .guide-content blockquote {
        padding: 1rem 1.5rem;
    }
    
    .section-break {
        margin: 2rem 0;
    }
}

/* Overlay for mobile */
.guide-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.guide-overlay.active {
    display: block;
}

/* Scroll to top button */
.scroll-to-top {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(var(--primary-rgb), 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0px 0.25rem 1rem 0 rgb(0 0 0 / 50%), inset 0 0 2rem 0 rgba(var(--primary-rgb), calc(var(--glow-intensity) / 3));
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background: rgba(var(--primary-rgb), 0.1);
    box-shadow: 0px 0.25rem 1rem 0 rgb(0 0 0 / 50%), inset 0 0 2rem 0 rgba(var(--primary-rgb), calc(var(--glow-intensity) / 2));
}

.scroll-to-top svg {
    width: 20px;
    height: 20px;
    fill: var(--input-color);
}

/* Section anchors */
.guide-content h2[id],
.guide-content h3[id],
.guide-content h4[id] {
    scroll-margin-top: 2rem;
}

/* Improve readability with max line length */
.guide-content p,
.guide-content li {
    max-width: 65ch;
}

/* Consistent spacing between different content types */
.guide-content > * + h2 {
    margin-top: 4rem;
}

.guide-content > * + h3 {
    margin-top: 3rem;
}

.guide-content > * + h4 {
    margin-top: 2.5rem;
}

.guide-content > * + h5 {
    margin-top: 2rem;
}

/* Reduce spacing when heading follows heading */
.guide-content h2 + h3 {
    margin-top: 1.5rem;
}

.guide-content h3 + h4 {
    margin-top: 1.25rem;
}

.guide-content h4 + h5 {
    margin-top: 1rem;
}

/* Add spacing around blockquotes */
.guide-content blockquote + *:not(blockquote) {
    margin-top: 1.5rem;
}

/* Better spacing for consecutive elements */
.guide-content p + ul,
.guide-content p + ol {
    margin-top: -0.5rem;
}

/* Strong elements in content */
.guide-content strong {
    color: var(--input-color);
    font-weight: 600;
}

/* Links in content */
.guide-content a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.guide-content a:hover {
    text-decoration: underline;
    text-shadow: 0 0 0.5rem rgba(var(--secondary-rgb), var(--glow-intensity));
}

/* Visual section breaks */
.section-break {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.3), transparent);
    margin: 3rem 0;
    box-shadow: 0 0 1rem 0 rgba(var(--primary-rgb), calc(var(--glow-intensity) / 4));
}