/* =========================================================================
   UniProt-style floating Help Window
   One instance lives on the analysis page and one on the database page.
   Uses the same --navbar-height variable already used elsewhere in the app
   to sit just below the modebar.
   ========================================================================= */

.help-window-root {
    /* Change this one value to resize the panel horizontally. */
    --help-window-width: 500px;

    position: fixed;
    top: calc(var(--navbar-height, 60px) + 14px);
    right: 18px;
    z-index: 3500;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: inherit;
    --apex-blue-light: #1f5f8b;
}

.help-window-toggle-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--apex-blue-light);
    border: none;
    color: #fff;
    font-size: 18px;
    box-shadow: 0 2px 10px rgba(13, 110, 253, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.help-window-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(13, 110, 253, 0.5);
    background-color: #0b5ed7;
}

.help-window-panel {
    display: none;
    flex-direction: column;
    width: var(--help-window-width);
    max-width: calc(100vw - 36px);
    max-height: calc(100vh - var(--navbar-height, 60px) - 40px);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Toggle between "small button" and "expanded panel" states. display:none
   (rather than opacity/visibility) is deliberate here: a display:none
   element has no layout box at all, which rules it out completely as a
   source of any stray interference elsewhere on the page — no fade
   transition, but zero ambiguity. */
.help-window-root.help-window-open .help-window-toggle-btn {
    display: none;
}
.help-window-root.help-window-open .help-window-panel {
    display: flex;
}

.help-window-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 8px 12px 14px;
    background: linear-gradient(135deg, var(--apex-blue-light), var(--apex-blue-light-hover));
    color: #fff;
    flex: 0 0 auto;
}
.help-window-title {
    flex: 1 1 auto;
    font-weight: 700;
    font-size: 14.5px;
    letter-spacing: 0.01em;
}
.help-window-icon-btn {
    background: none;
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    transition: background-color 0.12s ease;
}
.help-window-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.help-window-search-row {
    position: relative;
    padding: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex: 0 0 auto;
    background: #fafbfd;
}
.help-window-search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 13px;
    pointer-events: none;
}
.help-window-search-input {
    width: 100%;
    padding: 7px 10px 7px 30px;
    border-radius: 7px;
    border: 1px solid #d7dce2;
    font-size: 13.5px;
    box-sizing: border-box;
    background: #fff;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.help-window-search-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.help-window-body {
    padding: 8px 10px 16px;
    overflow-y: auto;
    flex: 1 1 auto;
    /* Without this, a flex column child won't shrink below its content's
       natural height, so long sections pushed past the panel's max-height
       and got clipped by its overflow:hidden instead of scrolling here. */
    min-height: 0;
}

.help-window-group-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8a93a3;
    font-weight: 700;
    margin: 14px 10px 6px;
}
.help-window-group-label:first-child {
    margin-top: 8px;
}

.help-window-section-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    border-radius: 0 6px 6px 0;
    padding: 8px 10px;
    font-size: 13.5px;
    color: #212529;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.help-window-section-btn:hover {
    background-color: #f1f5ff;
    border-left-color: var(--apex-blue-light);
    color: var(--apex-blue-light);
}

.help-window-section-heading {
    margin: 4px 10px 10px;
    color: var(--apex-blue-light);
    font-weight: 700;
    font-size: 15px;
}
.help-window-section-text {
    margin: 0 10px;
    font-size: 13.5px;
    line-height: 1.6;
    color: #343a40;
    white-space: pre-wrap;
}

.help-window-fullpage-link {
    margin: 6px 6px 0;
    padding-left: 4px;
    font-size: 12.5px;
}

.help-window-empty {
    padding: 16px 14px;
    text-align: center;
}

/* =========================================================================
   Dataset Composition — fixed-position add/remove toggle buttons
   (database page)
   ========================================================================= */
.comp-toggle-btn {
    border-radius: 20px;
}

.stress-condition-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    background-color: #f1f5ff;
    color: #212529;
    border: 1px solid rgba(13, 110, 253, 0.15);
    border-radius: 20px;
    padding: 6px 14px;
    margin: 4px 7px 4px 0;
    font-size: 15px;
    line-height: 1.3;
    white-space: nowrap;
}

/* =========================================================================
   Help Page — fixed left sidebar + flat, always-visible sections
   (replaces the old collapsible-card layout)
   ========================================================================= */
.help-page-shell {
    --help-sidebar-width: 300px;
    /* Safety net: nothing here should overflow horizontally any more (see
       .help-content-container below for the actual fix), but this makes
       sure a stray wide element can never bring back the scrollbar. */
    overflow-x: hidden;
}

/* Pinned to the real viewport edge (not the centered container), so it
   never drifts while the page scrolls and doesn't waste space on grid
   gutters. */
.help-sidebar-fixed {
    position: fixed;
    left: 0;
    top: var(--navbar-height, 60px);
    bottom: 0;
    width: var(--help-sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--background_color, #ffffff);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 10;
}

/* Pinned header of the sidebar — stays put even while the link list below
   it scrolls internally on a long help page. */
.help-sidebar-title {
    flex: 0 0 auto;
    font-size: 23px;
    font-weight: 800;
    color: #0d6efd;
    margin: 0;
    padding: 22px 18px 16px 22px;
    border-bottom: 2px solid rgba(13, 110, 253, 0.15);
}

.help-sidebar-links {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    /* Generous bottom padding so the last link has room to sit above the
       screen edge instead of being cut off by it once scrolled to. */
    padding: 16px 16px 72px 22px;
}
.help-sidebar-group {
    margin-bottom: 18px;
}
.help-sidebar-mainlink {
    display: block;
    font-weight: 700;
    font-size: 17.5px;
    color: #212529;
    text-decoration: none;
    padding: 5px 0;
}
.help-sidebar-mainlink:hover {
    color: var(--apex-blue-light);
}
.help-sidebar-sublist {
    display: flex;
    flex-direction: column;
    margin-left: 10px;
    border-left: 2px solid rgba(13, 110, 253, 0.15);
}
.help-sidebar-sublink {
    display: block;
    font-size: 15px;
    color: #495057;
    text-decoration: none;
    padding: 5px 0 5px 12px;
}
.help-sidebar-sublink:hover {
    color: var(--apex-blue-light);
    border-left: 2px solid var(--apex-blue-light);
    margin-left: -2px;
    padding-left: 12px;
}

/* A plain Div (not a Bootstrap fluid Container) on purpose: .container-fluid
   sets width:100%, and 100% + margin-left both taking up space is exactly
   what was overflowing the viewport and causing the horizontal scrollbar.
   box-sizing:border-box + a plain auto width here means this box correctly
   shrinks to "everything right of the sidebar", full stop. */
.help-content-container {
    box-sizing: border-box;
    margin-left: var(--help-sidebar-width);
    max-width: 1200px;
    padding: 32px 48px 56px;
}
.help-main-section {
    scroll-margin-top: calc(var(--navbar-height, 60px) + 16px);
    padding-bottom: 32px;
    margin-bottom: 28px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.help-main-section:last-child {
    border-bottom: none;
}
/* Plain heading — no card-like border/box, just clear typographic hierarchy. */
.help-main-heading {
    color: #212529;
    font-weight: 800;
    font-size: 26px;
    margin-bottom: 20px;
}
.help-subsection {
    scroll-margin-top: calc(var(--navbar-height, 60px) + 16px);
    margin-bottom: 26px;
}
.help-section-heading {
    font-size: 18px;
    font-weight: 700;
    color: #0d6efd;
    margin-bottom: 8px;
}
.help-section-text {
    /* Fills the content column instead of stopping at a fixed px value —
       the content column's own max-width above already keeps lines from
       getting unreasonably long on very wide screens. */
    font-size: 15px;
    line-height: 1.7;
    color: #343a40;
}
/* 'section-collapse-content' is kept on this element only so the existing
   hash-highlight JS can still find it (see .querySelectorAll('.section-
   collapse-content, ...') in the clientside callback) — it used to be a
   collapsible card's body and may carry its own border/background/shadow
   from the app's base stylesheet. Force all of that off here so the text
   reads as plain content, not a boxed card. */
.help-content .section-collapse-content {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

@media (max-width: 991.98px) {
    .help-sidebar-fixed {
        position: static;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }
    .help-sidebar-links {
        max-height: none;
        overflow-y: visible;
        padding-bottom: 16px;
    }
    .help-content-container {
        margin-left: 0;
        max-width: 100%;
    }
}