/* === GUIDE PAGE STYLES === */

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--accent);
    width: 0%;
    z-index: 1001;
    transition: width 0.1s ease;
}

/* Guide Container - Two Column Layout */
.guide-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 6rem 2rem 2rem;
}

/* Sticky Sidebar */
.guide-sidebar {
    position: sticky;
    top: 6rem;
    height: fit-content;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
}

.toc {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.toc h4 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.toc ul {
    list-style: none;
}

.toc-link {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 0;
    font-size: 0.85rem;
    border-left: 2px solid transparent;
    padding-left: 1rem;
    transition: all 0.2s ease;
}

.toc-link:hover,
.toc-link.active {
    color: var(--text-primary);
    border-left-color: var(--accent);
}

.toc-h3 {
    padding-left: 1rem;
}

.toc-h3 .toc-link {
    font-size: 0.8rem;
    padding: 0.35rem 0 0.35rem 1rem;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumbs a:hover {
    color: var(--accent);
}

.breadcrumbs span {
    color: var(--border);
}

/* Guide Header */
.guide-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.guide-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    align-items: center;
}

.guide-category {
    background: var(--accent);
    color: var(--bg-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.guide-reading-time,
.guide-updated {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.guide-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.guide-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Guide Content */
.guide-content {
    min-width: 0; /* Fix for grid overflow */
}

/* Article Body */
.guide-body {
    line-height: 1.8;
}

.guide-body section {
    margin-bottom: 3rem;
}

.guide-body h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-top: 1rem;
}

.guide-body h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2.5em 0 0.75em;
    padding: 0.5rem 0 0.5rem 1rem;
    border-left: 3px solid var(--accent);
}

.guide-body h4 {
    color: var(--accent-blue);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 2em 0 0.6em;
}

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

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

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

.guide-body a {
    color: var(--accent);
    text-decoration: none;
}

.guide-body a:hover {
    text-decoration: underline;
}

.guide-body strong {
    color: var(--text-primary);
}

/* Steps Component */
.steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.step {
    display: flex;
    gap: 1.5rem;
}

.step-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.step-content {
    flex: 1;
    padding-top: 0.5rem;
}

.step-content h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
    text-transform: none;
    letter-spacing: normal;
}

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

/* Callouts */
.callout {
    display: flex;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    border-left: 4px solid;
}

.callout-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.callout-content {
    flex: 1;
}

.callout-content strong {
    display: block;
    margin-bottom: 0.25rem;
}

.callout-content p {
    margin: 0;
    font-size: 0.9rem;
}

.callout-info {
    background: rgba(0, 168, 255, 0.1);
    border-color: var(--accent-blue);
}

.callout-warning {
    background: rgba(255, 107, 53, 0.1);
    border-color: var(--accent);
}

.callout-success {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--accent-green);
}

.callout-danger {
    background: rgba(255, 87, 87, 0.1);
    border-color: #ff5757;
}

/* Prerequisites List */
.prereq-list {
    list-style: none;
    padding: 0;
}

.prereq-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.prereq-list li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent-green);
    font-weight: bold;
}

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: left;
    border: 1px solid var(--border);
}

.comparison-table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
}

.comparison-table td {
    color: var(--text-secondary);
}

.comparison-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

.comparison-table tr:hover td {
    background: var(--bg-secondary);
}

/* FAQ/Troubleshooting */
.faq-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.faq-item summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    color: var(--accent);
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item summary:hover {
    color: var(--accent);
}

.faq-item[open] summary {
    border-bottom: 1px solid var(--border);
}

.faq-item > div {
    padding: 1rem 1.5rem;
}

/* Related Guides */
.related-guides {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.related-guides h3 {
    margin-bottom: 1.5rem;
}

.related-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.related-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.related-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
}

.related-card h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.related-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* Guide Footer */
.guide-footer {
    margin-top: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(0, 168, 255, 0.1));
    border-radius: 12px;
    text-align: center;
}

.guide-feedback p {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #0088cc;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.feedback-btn:hover {
    background: #006699;
    transform: translateY(-2px);
}

.feedback-btn svg {
    width: 20px;
    height: 20px;
}

/* Image in Guide */
.guide-image {
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.guide-image img {
    width: 100%;
    height: auto;
    display: block;
}

.guide-image figcaption {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .guide-container {
        grid-template-columns: 1fr;
        padding-top: 5rem;
    }

    .guide-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .guide-container {
        padding: 3.5rem 0.75rem 1rem;
    }

    .guide-header h1 {
        font-size: 1.75rem;
    }

    .guide-meta {
        gap: 0.5rem;
    }

    .guide-section > summary {
        padding: 1rem;
    }

    .guide-section > summary h2 {
        font-size: 1.2rem;
    }

    .step {
        flex-direction: column;
        gap: 0.75rem;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .callout {
        flex-direction: column;
        gap: 0.5rem;
    }

    .comparison-table {
        font-size: 0.8rem;
        display: block;
        overflow-x: auto;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
}

/* === GUIDE SECTION (Top-level Collapsible) === */
.guide-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 2rem;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.guide-section:hover {
    border-color: var(--accent);
}

.guide-section > summary {
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    transition: background 0.2s ease;
}

.guide-section > summary::-webkit-details-marker {
    display: none;
}

.guide-section > summary:hover {
    background: rgba(255, 107, 53, 0.05);
}

.guide-section > summary h2 {
    margin: 0;
    padding: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Make h3 groups visually distinct */
.guide-body h3 ~ h3 {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.guide-section > summary::after {
    content: '+';
    color: var(--accent);
    font-size: 1.5rem;
    font-weight: 300;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: 1rem;
}

.guide-section[open] > summary::after {
    transform: rotate(45deg);
}

.guide-section[open] {
    border-color: rgba(255, 107, 53, 0.3);
}

.guide-section[open] > summary {
    border-bottom: 1px solid var(--border);
}

.guide-section > .section-content {
    padding: 1.5rem;
}

/* Expand/Collapse All Button */
.expand-collapse-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.expand-collapse-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.2s ease;
}

.expand-collapse-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Security Checklist */
.checklist {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.checklist-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.checklist-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
    position: relative;
    transition: all 0.2s ease;
}

.checklist-item input[type="checkbox"]:checked {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.checklist-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--bg-primary);
    font-size: 14px;
    font-weight: bold;
}

.checklist-item span {
    color: var(--text-secondary);
    line-height: 1.5;
}

.checklist-item:has(input:checked) span {
    color: var(--text-primary);
    text-decoration: line-through;
    opacity: 0.7;
}

/* Architecture diagrams (bare pre>code without .code-block wrapper) */
.guide-body > pre,
.section-content > pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-green);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.85rem;
    line-height: 1.6;
}
