/* help.css — Help encyclopedia styles
   Extends cropcrop.css variables. Load after cropcrop.css. */

/* ── Layout ── */
.help-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 3rem;
}

.help-hub {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 3rem;
}

/* ── Breadcrumb ── */
.help-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.help-breadcrumb a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.help-breadcrumb a:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

.help-breadcrumb .separator {
    color: var(--text-muted);
    opacity: 0.5;
    user-select: none;
}

/* ── Sidebar TOC ── */
.help-sidebar {
    position: sticky;
    top: 70px;
    align-self: start;
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
}

.help-sidebar-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

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

.help-toc-list li {
    margin-bottom: 0.15rem;
}

.help-toc-list a {
    display: block;
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    transition: all var(--transition-fast);
    line-height: 1.4;
}

.help-toc-list a:hover {
    color: var(--accent);
    background: var(--accent-bg);
}

.help-toc-list a.active {
    color: var(--accent);
    background: var(--accent-bg);
    border-left-color: var(--accent);
    font-weight: 600;
}

.help-toc-list .help-toc-nested {
    margin-left: 0.75rem;
}

/* Overlay — hidden on desktop, only used on mobile */
.help-sidebar-overlay {
    display: none;
}

/* Mobile sidebar toggle button */
.help-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 90;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.help-sidebar-toggle:hover {
    background: var(--accent-dark);
    transform: scale(1.05);
}

.help-sidebar-toggle .cc-icon {
    width: 20px;
    height: 20px;
}

/* ── Article Typography ── */
.help-content {
    min-width: 0;
}

.help-article-header {
    margin-bottom: 2rem;
}

.help-article-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0.5rem 0 0.75rem;
}

.help-article-header .help-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.help-article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.help-article-meta .cc-icon {
    width: 14px;
    height: 14px;
    margin-right: 0.25rem;
    vertical-align: -2px;
}

.help-article h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2.5rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
    line-height: 1.4;
}

.help-article h2:first-of-type {
    border-top: none;
    padding-top: 0;
}

.help-article h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.75rem;
    line-height: 1.4;
}

.help-article p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.help-article ul,
.help-article ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.help-article li {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.help-article strong {
    color: var(--text-primary);
    font-weight: 600;
}

.help-article code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--accent-bg);
    color: var(--accent);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

.help-article pre {
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin-bottom: 1.25rem;
    position: relative;
}

.help-article pre code {
    background: none;
    color: var(--text-primary);
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.7;
}

.help-article img {
    max-width: 100%;
    border-radius: var(--radius-xs);
    margin: 1rem 0;
}

/* Heading anchor links */
.help-heading-anchor {
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0;
    margin-left: 0.4rem;
    font-size: 0.85em;
    transition: opacity var(--transition-fast);
}

.help-article h2:hover .help-heading-anchor,
.help-article h3:hover .help-heading-anchor {
    opacity: 0.6;
}

.help-heading-anchor:hover {
    opacity: 1 !important;
    color: var(--accent);
}

/* ── Callout Boxes ── */
.help-callout {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-xs);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.7;
}

.help-callout .cc-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 0.15rem;
}

.help-callout-body {
    min-width: 0;
}

.help-callout-body p {
    margin-bottom: 0.5rem;
}

.help-callout-body p:last-child {
    margin-bottom: 0;
}

.help-callout.info {
    background: var(--info-bg);
    border: 1px solid rgba(59,130,246,0.2);
    color: var(--text-secondary);
}

.help-callout.info .cc-icon { color: var(--info); }

.help-callout.tip {
    background: var(--success-bg);
    border: 1px solid rgba(16,185,129,0.2);
    color: var(--text-secondary);
}

.help-callout.tip .cc-icon { color: var(--success); }

.help-callout.warning {
    background: var(--warning-bg);
    border: 1px solid rgba(245,158,11,0.2);
    color: var(--text-secondary);
}

.help-callout.warning .cc-icon { color: var(--warning); }

.help-callout.danger {
    background: var(--error-bg);
    border: 1px solid rgba(239,68,68,0.2);
    color: var(--text-secondary);
}

.help-callout.danger .cc-icon { color: var(--error); }

/* ── Table ── */
.help-table-wrap {
    overflow-x: auto;
    margin-bottom: 1.25rem;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
}

.help-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.help-table th {
    background: var(--accent-bg);
    font-weight: 600;
    text-align: left;
    padding: 0.65rem 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.help-table td {
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border-light);
    color: var(--text-secondary);
    line-height: 1.6;
}

.help-table tr:hover td {
    background: var(--bg-card-hover);
}

/* ── Related Articles ── */
.help-related {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.help-related h2 {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.help-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.help-related-card {
    display: block;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition);
}

.help-related-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.help-related-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.35rem;
}

.help-related-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ── Article Nav (prev/next) ── */
.help-article-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.help-article-nav a {
    display: block;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition);
}

.help-article-nav a:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow);
}

.help-article-nav .nav-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.help-article-nav .nav-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--accent);
}

.help-article-nav .nav-next {
    text-align: right;
}

/* ── Code Copy Button ── */
.help-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.help-copy-btn .cc-icon {
    width: 13px;
    height: 13px;
}

pre:hover .help-copy-btn {
    opacity: 1;
}

.help-copy-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-bg);
}

.help-copy-btn.copied {
    color: var(--success);
    border-color: var(--success);
}

/* ── Category Badge ── */
.help-category-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    background: var(--accent-bg);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Hub Page ── */
.help-hub-hero {
    text-align: center;
    padding: 3rem 0 2.5rem;
}

.help-hub-hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
}

.help-hub-hero p {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 1.5rem;
    line-height: 1.7;
}

/* Hub Search */
.help-search-wrap {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.help-search {
    width: 100%;
    padding: 0.75rem 1.25rem 0.75rem 2.75rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    font-size: 0.92rem;
    color: var(--text-primary);
    font-family: var(--font-primary);
    outline: none;
    transition: all var(--transition);
}

.help-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.help-search::placeholder {
    color: var(--text-muted);
}

.help-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.help-search-shortcut {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    pointer-events: none;
}

/* Search Results Dropdown */
.help-search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 360px;
    overflow-y: auto;
    display: none;
    z-index: 50;
}

.help-search-results.active {
    display: block;
}

.help-search-result {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}

.help-search-result:last-child {
    border-bottom: none;
}

.help-search-result:hover,
.help-search-result.is-active {
    background: var(--accent-bg);
}

.help-search-result.is-active {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.help-search-result .result-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    font-weight: 600;
}

.help-search-result .result-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.1rem;
}

.help-search-result .result-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    line-height: 1.4;
}

.help-search-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* Hub Category Sections */
.help-hub-categories {
    margin-top: 1rem;
}

.help-hub-category {
    margin-bottom: 2.5rem;
}

.help-hub-category-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.help-hub-category-header .cc-icon {
    width: 22px;
    height: 22px;
    color: var(--accent);
}

.help-hub-category-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.help-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.help-hub-card {
    display: block;
    padding: 1.25rem 1.5rem;
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition);
}

.help-hub-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.help-hub-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.help-hub-card h3 .cc-icon {
    width: 14px;
    height: 14px;
    color: var(--accent);
    flex-shrink: 0;
}

.help-hub-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.55;
}

.help-hub-card.coming-soon {
    opacity: 0.5;
    pointer-events: none;
}

.help-hub-card.coming-soon h3::after {
    content: 'Soon';
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    background: var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
}

/* Hub CTA */
.help-hub-cta {
    text-align: center;
    padding: 2.5rem 1.5rem;
    margin-top: 1rem;
    background: var(--accent-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.help-hub-cta h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.help-hub-cta p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin: 0 0 1.25rem;
}

.help-hub-cta .cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: all var(--transition);
}

.help-hub-cta .cta-btn:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.help-hub-cta .cta-btn .cc-icon {
    width: 18px;
    height: 18px;
}

/* ── Footer ── */
.help-footer {
    text-align: center;
    padding: 2rem 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    max-width: 1200px;
    margin: 0 auto;
}

.help-footer a {
    color: var(--accent);
    text-decoration: none;
}

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

/* ── Mobile Responsive ── */
@media (max-width: 900px) {
    .help-layout {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .help-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100vh;
        max-height: 100vh;
        z-index: 200;
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--border);
        transition: left var(--transition);
        background: var(--bg-card-solid);
        padding-top: 1.5rem;
    }

    .help-sidebar.open {
        left: 0;
    }

    .help-sidebar-toggle {
        display: flex;
    }

    .help-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 199;
    }

    .help-sidebar-overlay.active {
        display: block;
    }

    .help-breadcrumb {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 768px) {
    .help-hub-grid {
        grid-template-columns: 1fr;
    }

    .help-related-grid {
        grid-template-columns: 1fr;
    }

    .help-article-nav {
        grid-template-columns: 1fr;
    }

    .help-hub-hero {
        padding: 2rem 0 1.5rem;
    }

    .help-hub-hero h1 {
        font-size: 1.7rem;
    }
}

@media (max-width: 480px) {
    .help-article-header h1 {
        font-size: 1.5rem;
    }

    .help-article h2 {
        font-size: 1.15rem;
    }

    .help-article h3 {
        font-size: 1rem;
    }

    .help-hub-hero h1 {
        font-size: 1.5rem;
    }
}
