/*
 * 11/03/2026 - The help drawer, help icons and full help page. Loaded only by the admin layouts and help pages, never by
 * public marketplace pages. See docs/help-system-plan.md, section 3.
 */

/* On a wide screen the drawer sits beside the page: the page narrows instead of being covered. Below this width the
   drawer covers the page, and on a phone it fills the screen. */
@media (min-width: 1100px) {
    body.help-drawer-open {
        margin-right: 380px;
    }
}

.help-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    width: 380px;
    max-width: 100%;
    background: #fff;
    color: #212529;
    border-left: 1px solid #c9ced6;
    font-size: 15px;
    line-height: 1.5;
    text-align: left;
}

.help-drawer[hidden] {
    display: none;
}

.help-drawer:focus {
    outline: 0;
}

@media (max-width: 1099.98px) {
    .help-drawer {
        box-shadow: -4px 0 16px rgba(0, 0, 0, 0.2);
    }
}

.help-drawer-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px 6px;
}

.help-drawer-head b {
    flex: 1;
    font-weight: 500;
    font-size: 16px;
}

.help-drawer-close {
    border: 0;
    background: transparent;
    color: inherit;
    padding: 2px 6px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.help-drawer-back {
    display: none;
    margin: 10px 16px 0;
}

.help-drawer-search {
    padding: 4px 16px 10px;
    border-bottom: 1px solid #e8ebef;
}

/* Bottom padding keeps the last lines clear of the chat bubble in the corner. */
.help-drawer-body {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 16px 80px;
}

.help-nav {
    margin-bottom: 8px;
}

.help-article-title {
    margin: 0 0 2px;
    font-size: 20px;
    font-weight: 500;
    line-height: 1.3;
    outline: 0;
}

.help-article-meta {
    margin-bottom: 10px;
    font-size: 14px;
}

.help-sections {
    margin-bottom: 12px;
}

.help-sections summary {
    cursor: pointer;
    font-weight: 500;
}

.help-sections ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

.help-sections li {
    margin-bottom: 4px;
}

.help-article h1,
.help-article h2 {
    margin: 18px 0 6px;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.3;
}

.help-article h3,
.help-article h4 {
    margin: 14px 0 4px;
    font-size: 15px;
    font-weight: 500;
}

.help-article p {
    margin: 0 0 10px;
}

.help-article ol,
.help-article ul {
    margin: 0 0 10px;
    padding-left: 22px;
}

.help-article li {
    margin-bottom: 6px;
}

.help-article strong {
    font-weight: 500;
}

.help-article table {
    width: 100%;
    margin-bottom: 10px;
    border-collapse: collapse;
    font-size: 14px;
}

.help-article th,
.help-article td {
    padding: 5px 6px;
    border-bottom: 1px solid #e8ebef;
    text-align: left;
    vertical-align: top;
}

.help-article th {
    font-weight: 500;
}

.help-show-me {
    white-space: nowrap;
}

.help-staff-note {
    margin: 12px 0;
    padding: 8px 10px;
    background: #e8f2fa;
    border-left: 3px solid #2c7fb8;
}

.help-staff-note::before {
    content: "Staff only";
    display: block;
    font-weight: 500;
}

.help-staff-note > :last-child {
    margin-bottom: 0;
}

/* The box for the one thing not to miss, and for what can't be undone. */
.help-note,
.help-warning {
    margin: 14px 0;
    padding: 10px 14px;
    border: 1px solid #b9d6ef;
    border-radius: 8px;
    background: #eef6fc;
}

.help-warning {
    border-color: #eec9a6;
    background: #fdf3e7;
}

.help-note > :last-child,
.help-warning > :last-child {
    margin-bottom: 0;
}

/* The link icon beside a heading. It copies a link straight to that section. */
.help-anchor {
    position: relative;
    display: inline-block;
    margin-left: 4px;
    padding: 0 4px;
    color: #6a7885;
    font-size: 0.72em;
    font-weight: 400;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.1s;
}

h2:hover > .help-anchor,
h3:hover > .help-anchor,
.help-anchor:focus {
    opacity: 1;
}

.help-anchor:hover {
    color: #1f2933;
    text-decoration: none;
}

@media (hover: none) {
    .help-anchor {
        opacity: 0.7;
    }
}

.help-anchor[data-copied]::after {
    content: attr(data-copied);
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-bottom: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #1f2933;
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    transform: translateX(-50%);
}

.help-flash {
    background: #fff6e5;
    box-shadow: -8px 0 0 #fff6e5, 8px 0 0 #fff6e5;
}

.help-article-footer {
    margin-top: 16px;
    padding-top: 10px;
    border-top: 1px solid #e8ebef;
}

.help-footer-row {
    margin-bottom: 10px;
}

.help-helped a,
.help-footer-links a {
    margin-right: 12px;
}

.help-footer-note {
    margin-top: 6px;
    font-size: 14px;
}

.help-form-label {
    margin-bottom: 4px;
}

.help-form textarea {
    min-height: 76px;
}

.help-form-problem {
    color: #a32d2d;
    font-size: 14px;
}

.help-form-buttons {
    margin-top: 6px;
}

.help-result {
    margin-bottom: 14px;
}

.help-result-section {
    font-size: 14px;
    font-weight: 500;
}

.help-result-snippet {
    font-size: 14px;
}

.help-home-heading {
    margin: 14px 0 6px;
    font-size: 16px;
    font-weight: 500;
}

.help-home-heading:first-child {
    margin-top: 0;
}

.help-area-group {
    margin-bottom: 6px;
}

.help-area-group > summary {
    padding: 4px 0;
    cursor: pointer;
    font-weight: 500;
}

.help-home-item {
    margin: 0 0 6px 16px;
}

.help-copy-box {
    position: fixed;
    left: -9999px;
}

/* The button a Show me points at. */
.help-ring {
    outline: 3px solid #f18805;
    outline-offset: 3px;
    animation: help-ring-pulse 1s ease-in-out 3;
}

@keyframes help-ring-pulse {
    50% {
        outline-offset: 7px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .help-ring {
        animation: none;
    }
}

.help-back-chip {
    position: fixed;
    left: 12px;
    bottom: 12px;
    z-index: 100000;
}

/* The small icon beside a field or column. The padding gives it a target big enough for a finger. It takes the text's own
   color and size, like the dark question marks on the KPI dashboards (owner, 2026-11-10), not the blue of a link. */
.help-tip {
    display: inline-block;
    padding: 2px 4px;
    color: inherit;
    font-size: inherit;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
}

.help-tip:hover,
.help-tip:focus {
    color: inherit;
    opacity: 0.7;
    text-decoration: none;
}

/* The Help button. */
.help-button-label {
    margin-left: 4px;
}

@media (max-width: 575.98px) {
    .help-drawer {
        width: 100%;
        border-left: 0;
        box-shadow: none;
    }

    .help-drawer-back {
        display: block;
    }

    .help-drawer-head {
        display: none;
    }

    .help-drawer-search {
        padding-top: 10px;
    }

    .help-tip {
        padding: 6px 8px;
    }

    /* There's no room for the word in the phone top bar, and the button keeps its label for screen readers. */
    .help-button-label {
        display: none;
    }
}

@media print {
    #help-drawer,
    .help-back-chip {
        display: none !important;
    }

    body.help-drawer-open {
        margin-right: 0;
    }

    /* Works on every layout: the script puts a copy of the article straight on <body>, and everything else there goes. */
    body.help-print-page > :not(.help-print-copy) {
        display: none !important;
    }
}

@media screen {
    .help-print-copy {
        display: none;
    }
}
