/* HomeSpan Visual Builder — Help pages */

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 4.5rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.6;
    font-size: 15px;
}

/* Header */

.help-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid #e0e0e0;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.help-header h1 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1d1d1f;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-header h1 .badge {
    font-size: 0.7rem;
    color: #999;
    font-weight: 500;
    padding-left: 0.5rem;
    border-left: 1px solid #e0e0e0;
}

.lang-switch {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.lang-switch a {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 5px;
    text-decoration: none;
    color: #555;
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s;
}

.lang-switch a:hover {
    background: #f0f0f3;
}

.lang-switch a.active {
    background: #0071e3;
    color: #fff;
    border-color: #0071e3;
}

/* Layout */

.help-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.help-toc {
    position: sticky;
    top: 5rem;
    align-self: start;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    font-size: 0.85rem;
    padding-right: 0.5rem;
}

.help-toc h2 {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #999;
    font-weight: 600;
}

.help-toc ol {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: sec;
}

.help-toc li {
    counter-increment: sec;
    margin: 0 0 0.15rem 0;
}

.help-toc li a {
    display: block;
    padding: 0.25rem 0.5rem;
    color: #444;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.82rem;
    line-height: 1.35;
    transition: background 0.12s, color 0.12s;
}

.help-toc li a::before {
    content: counter(sec) ". ";
    color: #b0b0b0;
    font-variant-numeric: tabular-nums;
}

.help-toc li a:hover {
    background: #e8e8f0;
    color: #000;
}

.help-toc li.active > a {
    background: #e0ecf9;
    color: #0071e3;
    font-weight: 600;
}

.help-toc li.active > a::before {
    color: #0071e3;
}

.help-content {
    background: #fff;
    border-radius: 10px;
    padding: 2.5rem 2.5rem 3rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    min-width: 0;
}

/* Typography */

.help-content h2 {
    font-size: 1.5rem;
    margin: 2.5rem 0 1rem;
    padding-top: 0.5rem;
    color: #1d1d1f;
    font-weight: 600;
    border-top: 1px solid #ececec;
}

.help-content h2:first-of-type,
.help-content > section:first-child > h2 {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.help-content h3 {
    font-size: 1.1rem;
    margin: 1.75rem 0 0.75rem;
    color: #1d1d1f;
    font-weight: 600;
}

.help-content h4 {
    font-size: 0.95rem;
    margin: 1.25rem 0 0.5rem;
    color: #333;
    font-weight: 600;
}

.help-content p {
    margin: 0.75rem 0;
}

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

.help-content li {
    margin: 0.3rem 0;
}

.help-content a {
    color: #0071e3;
    text-decoration: none;
}

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

.help-content strong {
    font-weight: 600;
    color: #1d1d1f;
}

.help-content hr {
    border: none;
    border-top: 1px solid #ececec;
    margin: 2rem 0;
}

/* Inline code */

.help-content code {
    background: #f4f4f7;
    border-radius: 4px;
    padding: 0.12em 0.4em;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.87em;
    color: #c7254e;
}

.help-content pre {
    background: #1d1d1f;
    color: #f5f5f7;
    padding: 1rem 1.2rem;
    border-radius: 6px;
    overflow-x: auto;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    margin: 1rem 0;
}

.help-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Callouts */

.callout {
    border-left: 3px solid #0071e3;
    background: #f0f7ff;
    padding: 0.75rem 1rem;
    border-radius: 0 6px 6px 0;
    margin: 1rem 0;
    font-size: 0.92rem;
}

.callout.warn {
    border-left-color: #d97706;
    background: #fff8e6;
}

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

/* Mobile */

@media (max-width: 860px) {
    .help-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    .help-toc {
        position: static;
        max-height: none;
        background: #fff;
        border-radius: 8px;
        padding: 1rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }
    .help-content {
        padding: 1.5rem 1.25rem 2rem;
    }
    .help-content h2 {
        font-size: 1.25rem;
    }
    .help-header {
        padding: 0.6rem 1rem;
    }
    .help-header h1 {
        font-size: 0.9rem;
    }
    .help-header h1 .badge {
        display: none;
    }
}

/* Back-to-top */

.to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0071e3;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    z-index: 20;
}

.to-top.visible {
    display: flex;
}

.to-top:hover {
    background: #0060c0;
}
