/* ---- Ajutor și ghid (Help & Guide) -------------------------------------
   Port of the Client app's Help & Guide styles (client/frontend/css/
   modern_coreidon.css, "Help & Guide" block) onto the Rebut Hub palette.
   Rendered by HUB/views/viewHelp.js; content in HUB/help/helpContent.js.

   A documentation view, not a dashboard: a section strip, a contents rail and
   a list of collapsible topics. Card bodies are HTML authored in
   helpContent.js, so every rule under .help-body targets a bare tag — there
   are no classes in the content to keep in sync with this stylesheet.

   Breakpoints are CONTAINER queries on .help-page, not media queries: inside
   the HUB the 280px sidebar takes part of the viewport, so the page's own
   width — not the window's — decides whether the contents rail fits.
   Mobile-first: the base rules are the phone layout. */

.help-page {
    --help-text: #1f2430;
    --help-text-2: #3f4654;
    --help-muted: #5b6472;
    --help-accent: #d12627;
    --help-accent-soft: #fdeeee;
    --help-border: #e5e2d8;
    --help-border-strong: #cfc9b8;
    --help-sunken: #f7f5ef;
    --help-transition: 0.2s ease;

    container-type: inline-size;
    background: #fff;
    border-radius: 12px;
    /* Fluid rather than stepped: .help-page is the query container, and a
       container query can only restyle its descendants, never itself. */
    padding: clamp(18px, 2.4vw, 30px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    color: var(--help-text);
}

.help-page [hidden] { display: none !important; }

/* Masthead — title block over search on a phone, side by side when wide. */
.help-masthead {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}
.help-masthead-text { min-width: 0; }
.help-heading {
    margin: 0 0 4px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--help-text);
}
.help-subtitle {
    margin: 0;
    color: var(--help-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.help-search {
    position: relative;
    display: block;
    width: 100%;
}
.help-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.6;
    pointer-events: none;
}
.help-search-input {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px 9px 34px;
    border: 1px solid var(--help-border-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--help-text);
    font: inherit;
    font-size: 0.92rem;
    box-sizing: border-box;
    transition: border-color var(--help-transition), box-shadow var(--help-transition);
}
.help-search-input:focus {
    outline: none;
    border-color: var(--help-accent);
    box-shadow: 0 0 0 3px rgba(209, 38, 39, 0.15);
}

@container (min-width: 640px) {
    .help-masthead {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
        gap: 24px;
        margin-bottom: 22px;
    }
    .help-search { width: 18rem; flex: 0 0 auto; }
}

/* Section strip — wrapping chips on a phone (a one-line scrolling strip hides
   half the sections behind a swipe almost nobody attempts), an underline strip
   once there is room for all four on one line. The four uppercase labels need
   ~650px; below 700px the chips wrap instead, otherwise a laptop-width HUB
   (sidebar open) scrolls the strip to the active tab and clips the first one. */
.help-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}
.help-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 14px;
    background: transparent;
    border: 1px solid var(--help-border);
    border-radius: 999px;
    color: var(--help-text-2);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--help-transition), border-color var(--help-transition),
                background var(--help-transition);
}
.help-tab-icon { display: none; }
.help-tab:hover {
    color: var(--help-text);
    border-color: var(--help-border-strong);
}
.help-tab.is-active {
    background: var(--help-accent-soft);
    border-color: var(--help-accent);
    color: var(--help-accent);
}

@container (min-width: 700px) {
    .help-tabs {
        flex-wrap: nowrap;
        gap: 4px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        border-bottom: 1px solid var(--help-border);
    }
    .help-tabs::-webkit-scrollbar { display: none; }
    .help-tab {
        border: 0;
        border-bottom: 2px solid transparent;
        border-radius: 0;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        white-space: nowrap;
    }
    .help-tab-icon { display: inline; font-size: 15px; }
    /* After :hover deliberately — equal specificity, so the current section
       keeps its accent underline while the pointer is over it. */
    .help-tab.is-active {
        background: transparent;
        border-bottom-color: var(--help-accent);
        color: var(--help-accent);
    }
}

/* Search summary — "N rezultate din toate secțiunile". */
.help-status {
    margin-bottom: 18px;
    padding: 10px 12px;
    border: 1px solid var(--help-border);
    border-left: 3px solid var(--help-accent);
    border-radius: 8px;
    background: var(--help-accent-soft);
    color: var(--help-text-2);
    font-size: 0.86rem;
}

/* Layout: one column; contents rail alongside once the page is wide enough. */
.help-layout { display: block; }
.help-main { min-width: 0; }

/* Contents rail. Hidden on narrow pages rather than restyled: there the
   collapsed topic headings ARE the contents. Sticky within #hub-content, the
   HUB's scroller. */
.help-toc { display: none; }

@container (min-width: 900px) {
    .help-layout {
        display: grid;
        grid-template-columns: 14rem minmax(0, 1fr);
        gap: 40px;
        align-items: start;
    }
    .help-toc {
        display: block;
        position: sticky;
        top: 8px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        padding-right: 6px;
    }
    /* A search spans all four sections, so a rail listing only the active one
       would point at topics the filtered list no longer shows. */
    .help-page.is-searching .help-layout { display: block; }
}

.help-toc-title {
    margin: 0 0 10px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--help-muted);
}
.help-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    border-left: 1px solid var(--help-border);
}
.help-toc-link {
    display: block;
    width: 100%;
    padding: 7px 0 7px 12px;
    margin-left: -1px;
    background: none;
    border: 0;
    border-left: 2px solid transparent;
    color: var(--help-muted);
    font: inherit;
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: color var(--help-transition), border-color var(--help-transition);
}
.help-toc-link:hover { color: var(--help-text); }
/* Colour and the accent bar only — nothing that changes the text's metrics,
   so a long title never rewraps (and the rail never twitches) as it becomes
   current. */
.help-toc-link.is-current {
    color: var(--help-accent);
    border-left-color: var(--help-accent);
}
.help-page.is-searching .help-toc { display: none; }

/* Toolbar above the list: how many topics, and a bulk expand/collapse. */
.help-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    margin-bottom: 6px;
}
.help-count {
    margin: 0;
    font-size: 0.78rem;
    color: var(--help-muted);
    font-variant-numeric: tabular-nums;
}
.help-expand {
    min-height: 44px;
    padding: 0 12px;
    margin-right: -12px;
    background: transparent;
    border: 0;
    color: var(--help-text-2);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color var(--help-transition);
}
.help-expand:hover { color: var(--help-accent); }

/* Topics read as a document, not a stack of boxes: the page is already a
   card, so a hairline between rows carries the separation. */
.help-card { border-top: 1px solid var(--help-border); }
.help-card:first-child { border-top: 0; }

.help-card-head { margin: 0; }
.help-card-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 12px 0;
    background: transparent;
    border: 0;
    text-align: start;
    cursor: pointer;
    color: var(--help-text);
    font: inherit;
}
.help-card-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.35;
    text-wrap: balance;
    transition: color var(--help-transition);
}
.help-card-toggle:hover .help-card-title { color: var(--help-accent); }
.help-card-chevron {
    flex: 0 0 auto;
    font-size: 16px;
    color: var(--help-muted);
    transition: transform var(--help-transition);
}
.help-card-toggle[aria-expanded="true"] .help-card-chevron { transform: rotate(180deg); }

/* Which section a hit came from — only while searching, where results from
   four sections merge into one list. */
.help-card-eyebrow { display: none; }
.help-page.is-searching .help-card-eyebrow {
    display: block;
    flex: 0 0 auto;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--help-sunken);
    color: var(--help-muted);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Card bodies — the only place authored HTML renders. Capped near 68
   characters, a comfortable reading measure. */
.help-body {
    max-width: 68ch;
    padding: 0 0 20px 0;
    font-size: 0.94rem;
    line-height: 1.75;
    color: var(--help-text-2);
}
.help-body p { margin: 0 0 12px; }
.help-body p:last-child { margin-bottom: 0; }
.help-body ul,
.help-body ol { margin: 0 0 12px 20px; padding: 0; }
.help-body ul { list-style: disc; }
.help-body ol { list-style: decimal; }
.help-body li { margin-bottom: 6px; }
.help-body li:last-child { margin-bottom: 0; }
.help-body ul:last-child,
.help-body ol:last-child { margin-bottom: 0; }
.help-body li::marker { color: var(--help-muted); }
.help-body strong { color: var(--help-text); font-weight: 600; }
/* Asides, not emphasis — <em> marks "you may not have this right" notes,
   which read better muted than italic. */
.help-body em { color: var(--help-muted); font-style: normal; }
.help-body code {
    padding: 1px 5px;
    border: 1px solid var(--help-border);
    border-radius: 4px;
    background: var(--help-sunken);
    color: var(--help-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
}

@container (min-width: 640px) {
    .help-card-title { font-size: 1.05rem; }
    .help-body { font-size: 0.95rem; }
}

/* Sidebar entry — set apart from the modules above it. */
.hub-nav-btn.hub-nav-btn-help { margin-top: 10px; }
