/**
 * Help guide — the "How this works" modal.
 *
 * Its own stylesheet because more than one screen uses it (Subscription Plans,
 * Plan Categories, Content Subscriptions) and none of them should have to load
 * another screen's CSS just to get the dialog.
 */

/* ─────────────────────────────────────────────────────────────────────────
   Help guide.

   Full width on purpose: this holds two wide flow diagrams and a shortcode
   table, and squeezing them into a narrow dialog would force the one thing
   the guide exists to show — the mechanism — into a horizontal scroll.
   ───────────────────────────────────────────────────────────────────────── */
.ss-help[hidden] {
    display: none;
}

.ss-help {
    position: fixed;
    inset: 0;
    z-index: 160000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 32px 20px;
}

.ss-help__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.6);
}

.ss-help__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1180px;
    max-height: calc(100vh - 64px);
    background: var(--ss-surface);
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.3);
    overflow: hidden;
}

/* The admin menu must not scroll behind the guide. */
body.ss-help-open {
    overflow: hidden;
}

.ss-help__header,
.ss-help__footer {
    flex: none;
    padding: 20px 32px;
    background: var(--ss-surface);
}

.ss-help__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--ss-border);
}

.ss-help__eyebrow {
    margin: 0 0 2px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ss-muted);
}

.ss-help__title {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
    color: var(--ss-ink);
}

.ss-help__close {
    flex: none;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ss-muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.ss-help__close:hover {
    background: var(--ss-bg);
    color: var(--ss-ink);
}

.ss-help__body {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px 32px;
}

.ss-help__lede {
    max-width: 78ch;
    margin: 0 0 24px;
    font-size: 15px;
    line-height: 1.65;
    color: var(--ss-body);
}

/* Figures ───────────────────────────────────────────────────────────────── */
.ss-help__figure {
    margin: 0 0 28px;
    padding: 22px 22px 16px;
    background: var(--ss-bg);
    border: 1px solid var(--ss-border);
    border-radius: 8px;
}

/* The diagram scales to the panel; it never forces the page sideways. */
.ss-help__svg {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    color: var(--ss-ink);
}

.ss-help__figure figcaption {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--ss-border);
    font-size: 13px;
    line-height: 1.6;
    color: var(--ss-body);
    max-width: 84ch;
}

.ss-help__h3 {
    margin: 32px 0 14px;
    font-size: 17px;
    color: var(--ss-ink);
}

/* Steps — numbered because this genuinely is a sequence. */
.ss-help__steps {
    counter-reset: ss-step;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ss-help__steps > li {
    counter-increment: ss-step;
    position: relative;
    margin: 0 0 22px;
    padding: 0 0 22px 52px;
    border-bottom: 1px solid var(--ss-border);
}

.ss-help__steps > li:last-child {
    border-bottom: 0;
    margin-bottom: 0;
}

.ss-help__steps > li::before {
    content: counter(ss-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--ss-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.ss-help__steps h4 {
    margin: 4px 0 8px;
    font-size: 15px;
    color: var(--ss-ink);
}

.ss-help__steps p {
    margin: 0 0 10px;
    max-width: 80ch;
    line-height: 1.65;
    color: var(--ss-body);
}

/* A secondary remark — the "why", kept visually subordinate to the "what". */
.ss-help__aside {
    padding-left: 12px;
    border-left: 3px solid var(--ss-border);
    font-size: 13px;
    color: var(--ss-muted) !important;
}

.ss-help__table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 12px;
    background: var(--ss-surface);
    border: 1px solid var(--ss-border);
    border-radius: 6px;
    overflow: hidden;
}

.ss-help__table th,
.ss-help__table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--ss-border);
    vertical-align: top;
    font-size: 13px;
    line-height: 1.55;
}

.ss-help__table th {
    background: var(--ss-bg);
    font-size: 12px;
    color: var(--ss-ink);
}

.ss-help__table tr:last-child td {
    border-bottom: 0;
}

.ss-help__table code {
    display: inline-block;
    padding: 3px 7px;
    background: var(--ss-primary-tint);
    color: var(--ss-primary-dark);
    border-radius: 4px;
    font-size: 12.5px;
    white-space: nowrap;
}

.ss-help__notes {
    margin: 0;
    padding: 0;
    list-style: none;
    max-width: 84ch;
}

.ss-help__notes li {
    margin-bottom: 10px;
    padding-left: 16px;
    position: relative;
    line-height: 1.65;
    color: var(--ss-body);
}

.ss-help__notes li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ss-primary);
}

.ss-help__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--ss-border);
}

.ss-help__footer-note {
    margin: 0;
    font-size: 13px;
    color: var(--ss-muted);
}

.ss-help-open .dashicons {
    vertical-align: text-bottom;
    margin-right: 2px;
}

@media screen and (max-width: 900px) {
    .ss-help {
        padding: 0;
    }

    .ss-help__panel {
        max-width: none;
        max-height: 100vh;
        border-radius: 0;
    }

    .ss-help__header,
    .ss-help__footer,
    .ss-help__body {
        padding-left: 18px;
        padding-right: 18px;
    }

    .ss-help__steps > li {
        padding-left: 42px;
    }
}
