/*
 * Multi-page guided walkthroughs (tours).
 *
 * Mirrors the page-help overlay so the two feel like one feature, and is
 * self-contained (tours can appear on pages that do not load page_help.css).
 */

/*
 * The tour runs in a panel docked to the right so it does not obscure the page.
 * The wrapper spans the viewport but ignores pointer events, so the page stays
 * fully interactive; only the panel itself takes clicks. On wide screens the
 * page reserves space for the panel (body.penra-tour-open) so nothing is hidden.
 */

.penra-tour-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    justify-content: flex-end;
    align-items: stretch;
    pointer-events: none;
}

.penra-tour-backdrop[hidden] {
    display: none;
}

.penra-tour-panel {
    pointer-events: auto;
    width: min(400px, 92vw);
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bs-body-bg, #1b1f24);
    color: var(--bs-body-color, #e6eef6);
    border-left: 1px solid var(--bs-border-color, rgba(255, 255, 255, 0.14));
    box-shadow: -0.75rem 0 2rem rgba(0, 0, 0, 0.45);
}

/* Reserve room for the docked panel so page content is not covered. */
@media (min-width: 992px) {
    body.penra-tour-open {
        padding-right: 400px;
        transition: padding-right 0.2s ease-in-out;
    }
}

/* On small screens dock to the bottom as a sheet instead of covering the page. */
@media (max-width: 991.98px) {
    .penra-tour-backdrop {
        align-items: flex-end;
        justify-content: center;
    }

    .penra-tour-panel {
        width: 100%;
        height: auto;
        max-height: 70vh;
        border-left: 0;
        border: 1px solid var(--bs-border-color, rgba(255, 255, 255, 0.14));
        border-bottom: 0;
        border-radius: 0.75rem 0.75rem 0 0;
        box-shadow: 0 -0.75rem 2rem rgba(0, 0, 0, 0.45);
    }
}


.penra-tour-panel .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.penra-tour-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bs-border-color, rgba(255, 255, 255, 0.12));
}

.penra-tour-title {
    font-weight: 600;
}

.penra-tour-progress {
    margin-top: 0.15rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color, rgba(255, 255, 255, 0.6));
}

.penra-tour-body {
    overflow-y: auto;
    padding: 1rem;
}

.penra-tour-step-title {
    font-weight: 600;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.penra-tour-action {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.3;
    padding: 0.1rem 0.45rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 193, 7, 0.55);
    background: rgba(255, 193, 7, 0.15);
    color: var(--bs-warning, #ffc107);
}

.penra-tour-action[hidden] {
    display: none;
}

.penra-tour-step-body {
    font-size: 0.92rem;
    color: var(--bs-body-color, #e6eef6);
}

.penra-tour-example {
    margin: 0.75rem 0 0;
    padding: 0.6rem 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--bs-body-color, #e6eef6);
    background: var(--bs-tertiary-bg, rgba(255, 255, 255, 0.05));
    border: 1px dashed var(--bs-border-color, rgba(255, 255, 255, 0.2));
    border-radius: 0.4rem;
}

.penra-tour-example[hidden] {
    display: none;
}

.penra-tour-options {
    margin-top: 0.75rem;
}

.penra-tour-options[hidden] {
    display: none;
}

.penra-tour-related {
    margin-top: 0.75rem;
}

.penra-tour-related[hidden] {
    display: none;
}

.penra-tour-related-link {
    display: block;
    width: 100%;
    text-align: left;
    margin-top: 0.35rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 0.35rem;
    border: 1px solid var(--bs-border-color, rgba(255, 255, 255, 0.2));
    background: transparent;
    color: var(--bs-link-color, #6ea8fe);
    cursor: pointer;
}

.penra-tour-related-link:hover,
.penra-tour-related-link:focus-visible {
    border-color: var(--bs-primary, #0d6efd);
    color: #fff;
    background: rgba(13, 110, 253, 0.15);
}

.penra-tour-notice {
    margin-bottom: 0.6rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 0.4rem;
    border: 1px solid var(--bs-warning, #ffc107);
    background: rgba(255, 193, 7, 0.12);
    color: var(--bs-body-color, #e6eef6);
}

.penra-tour-notice[hidden] {
    display: none;
}

.penra-tour-options-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color, rgba(255, 255, 255, 0.6));
    margin-bottom: 0.35rem;
}

.penra-tour-option {
    display: flex;
    gap: 0.6rem;
    padding: 0.3rem 0;
    font-size: 0.82rem;
    border-top: 1px solid var(--bs-border-color, rgba(255, 255, 255, 0.08));
}

.penra-tour-option-label {
    flex: 0 0 44%;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.penra-tour-option-name {
    font-weight: 600;
}

.penra-tour-option-kind {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: var(--bs-secondary-color, rgba(255, 255, 255, 0.55));
}

.penra-tour-option-kind .bi {
    font-size: 0.7rem;
}

.penra-tour-option[data-tour-option-kind="toggle"] .penra-tour-option-kind {
    color: var(--bs-info, #0dcaf0);
}

.penra-tour-option[data-tour-option-kind="choice"] .penra-tour-option-kind {
    color: var(--bs-primary, #0d6efd);
}

.penra-tour-option[data-tour-option-kind="button"] .penra-tour-option-kind {
    color: var(--bs-success, #198754);
}

.penra-tour-option[data-tour-option-kind="field"] .penra-tour-option-kind {
    color: var(--bs-warning, #ffc107);
}

.penra-tour-option-meaning {
    flex: 1 1 auto;
    color: var(--bs-secondary-color, rgba(255, 255, 255, 0.75));
}

.penra-tour-option-show {
    flex: 0 0 auto;
    align-self: flex-start;
    font-size: 0.7rem;
    padding: 0.05rem 0.45rem;
    border-radius: 0.3rem;
    border: 1px solid var(--bs-border-color, rgba(255, 255, 255, 0.2));
    background: transparent;
    color: var(--bs-secondary-color, rgba(255, 255, 255, 0.8));
    cursor: pointer;
    white-space: nowrap;
}

.penra-tour-option-show:hover,
.penra-tour-option-show:focus-visible {
    color: #fff;
    border-color: var(--bs-primary, #0d6efd);
}

.penra-tour-show {
    margin-top: 0.75rem;
    font-size: 0.78rem;
    padding: 0.15rem 0.6rem;
    border-radius: 0.3rem;
    border: 1px solid var(--bs-border-color, rgba(255, 255, 255, 0.2));
    background: transparent;
    color: var(--bs-secondary-color, rgba(255, 255, 255, 0.8));
    cursor: pointer;
}

.penra-tour-show[hidden] {
    display: none;
}

.penra-tour-show:hover {
    color: #fff;
    border-color: var(--bs-primary, #0d6efd);
}

.penra-tour-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--bs-border-color, rgba(255, 255, 255, 0.12));
}

.penra-tour-footer-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.8rem;
}

.penra-tour-footer-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
}

.penra-tour-btn {
    min-width: 4.6rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.25rem 0.8rem;
    border-radius: 0.3rem;
    border: 1px solid var(--bs-border-color, rgba(255, 255, 255, 0.25));
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.penra-tour-btn.is-primary {
    background: var(--bs-primary, #0d6efd);
    border-color: var(--bs-primary, #0d6efd);
    color: #fff;
}

.penra-tour-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.penra-tour-link {
    font-size: 0.78rem;
    color: var(--bs-secondary-color, rgba(255, 255, 255, 0.75));
    text-decoration: none;
}

.penra-tour-link:hover {
    color: #fff;
    text-decoration: underline;
}

button.penra-tour-link {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
}

/* Resume prompt shown when the user is not on the current step's page. */
.penra-tour-chip {
    position: fixed;
    left: 1rem;
    bottom: 1rem;
    z-index: 1500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--bs-primary, #0d6efd);
    background: var(--bs-primary, #0d6efd);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.4);
}

.penra-tour-chip[hidden] {
    display: none;
}

.penra-tour-chip-title {
    font-weight: 600;
}

/* Highlight for a "Show me" target (also added alongside the help class so it
   works on pages that do not load page_help.css). */
.penra-tour-highlight {
    outline: 3px solid var(--bs-warning, #ffc107) !important;
    outline-offset: 3px;
    border-radius: 0.25rem;
}
