/* walkthrough.css — chrome owned by the walkthrough runner
   (webroot/resources/walkthrough.js): the fallback card and Interactive Guides launcher
   list inside #walkthroughGuidesModal.

   The fallback card is runner-owned DOM (NOT tsOverlay). It appears when a tour is
   resumed off-route ("Take me there") or when an on-route step's anchor times out
   (step copy + Back/Next/End). It repeats the tsOverlay card's visual language on
   purpose (same surface, top accent rail as progress, same button shapes) but must
   not depend on ts-overlay.css, because it is exactly the card shown when the
   overlay is unavailable. Tokens are duplicated here for that reason.

   Theming: light values on the base rules, dark values redefined as custom
   properties under body.darkmode. Every transition is killed under
   prefers-reduced-motion. No outline button variants. */

.ts-walkthrough-fallback {
    --ts-wt-accent: #1266f1;
    --ts-wt-surface: #ffffff;
    --ts-wt-border: rgba(15, 23, 42, 0.12);
    --ts-wt-rail-track: rgba(15, 23, 42, 0.08);
    --ts-wt-text: #1f2430;
    --ts-wt-text-body: #4a5163;
    --ts-wt-text-dim: #6b7280;
    --ts-wt-btn-bg: #f0f3f8;
    --ts-wt-btn-bg-hover: #e3e8f0;
    --ts-wt-btn-border: #d3d9e4;
    --ts-wt-btn-text: #24303f;
    --ts-wt-shadow: 0 18px 44px rgba(15, 18, 27, 0.18), 0 2px 8px rgba(15, 18, 27, 0.10);
    position: fixed;
    right: 16px;
    bottom: 16px;
    /* Tracks the tsOverlay tooltip layer (ts-overlay.css). Both were raised from
       2210 to clear the mobile drawer, fixed alerts and toasts; leaving this card
       behind would bury it under the scrim it is meant to replace. */
    z-index: 10070;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 340px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    padding: 18px 18px 14px;
    border-radius: 12px;
    border: 1px solid var(--ts-wt-border);
    background: var(--ts-wt-surface);
    color: var(--ts-wt-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: var(--ts-wt-shadow);
    overflow: hidden;
    transition: opacity 0.16s ease;
}

.ts-walkthrough-fallback-rail {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    height: 3px;
    background: var(--ts-wt-rail-track);
}

.ts-walkthrough-fallback-rail-fill {
    height: 100%;
    width: 100%;
    background: var(--ts-wt-accent);
}

.ts-walkthrough-fallback-progress {
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
    color: var(--ts-wt-text-dim);
}

/* Head row: progress eyebrow on the left, situation note on the right (why this
   card is here instead of a spotlight: the step is on another page, or its target
   is not on screen). */
.ts-walkthrough-fallback-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-bottom: 6px;
}

.ts-walkthrough-fallback-head .ts-walkthrough-fallback-progress {
    margin-bottom: 0;
}

.ts-walkthrough-fallback-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px 2px 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--ts-wt-accent);
    background: color-mix(in srgb, var(--ts-wt-accent) 14%, transparent);
}

.ts-walkthrough-fallback-note::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ts-wt-accent);
}

.ts-walkthrough-fallback-title {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: inherit;
}

.ts-walkthrough-fallback-body {
    margin: 0 0 14px 0;
    min-height: 0;
    overflow-y: auto;
    color: var(--ts-wt-text-body);
    white-space: pre-line;
}

.ts-walkthrough-learn-more {
    align-self: flex-start;
    margin: -5px 0 12px;
    color: var(--ts-wt-accent);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.ts-walkthrough-learn-more:hover {
    color: var(--ts-wt-accent);
    text-decoration: underline;
}

.ts-walkthrough-learn-more:focus-visible {
    border-radius: 3px;
    outline: 2px solid var(--ts-wt-accent);
    outline-offset: 3px;
}

.ts-walkthrough-fallback-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.ts-walkthrough-fallback-actions .ts-walkthrough-fallback-btn:first-child:nth-last-child(n+3) {
    margin-right: auto;
}

.ts-walkthrough-fallback-btn {
    font: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid var(--ts-wt-btn-border);
    background: var(--ts-wt-btn-bg);
    color: var(--ts-wt-btn-text);
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.ts-walkthrough-fallback-btn:hover {
    background: var(--ts-wt-btn-bg-hover);
}

.ts-walkthrough-fallback-btn:focus {
    outline: none;
}

.ts-walkthrough-fallback-btn:focus-visible {
    box-shadow: 0 0 0 2px var(--ts-wt-surface), 0 0 0 4px var(--ts-wt-accent);
}

.ts-walkthrough-fallback-btn--primary {
    border-color: var(--ts-wt-accent);
    background: var(--ts-wt-accent);
    color: #ffffff;
}

.ts-walkthrough-fallback-btn--primary:hover {
    background: color-mix(in srgb, var(--ts-wt-accent) 88%, #000000);
    border-color: color-mix(in srgb, var(--ts-wt-accent) 88%, #000000);
}

body.darkmode .ts-walkthrough-fallback {
    --ts-wt-surface: #222235;
    --ts-wt-border: rgba(163, 177, 221, 0.22);
    --ts-wt-rail-track: rgba(163, 177, 221, 0.16);
    --ts-wt-text: #eff0f6;
    --ts-wt-text-body: #c7c9db;
    --ts-wt-text-dim: #9aa4bf;
    --ts-wt-btn-bg: rgba(255, 255, 255, 0.06);
    --ts-wt-btn-bg-hover: rgba(255, 255, 255, 0.11);
    --ts-wt-btn-border: rgba(163, 177, 221, 0.24);
    --ts-wt-btn-text: #e8ebf2;
    --ts-wt-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 18px 44px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Interactive Guides launcher list (#walkthroughGuidesModal on /trading). One row per tour:
   icon tile, name + one-line description + step count, Start. */
.ts-guides-col-heading {
    margin-bottom: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

.ts-guides-list {
    display: flex;
    flex-direction: column;
}

.ts-guides-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid rgba(15, 23, 42, 0.1);
}

/* Keyed off classes walkthrough.js applies to the first/last VISIBLE row in each column, not
   :first-child/:last-child - both columns share the same hidden-by-default row list, so the DOM
   edges are often hidden rows and the CSS pseudo-classes would miss the row that's actually first. */
.ts-guides-item.ts-guides-item--first-visible {
    border-top: 0;
    padding-top: 4px;
}

.ts-guides-item.ts-guides-item--last-visible {
    padding-bottom: 4px;
}

.ts-guides-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 16px;
    color: #1266f1;
    background: rgba(18, 102, 241, 0.12);
}

.ts-guides-text {
    flex: 1 1 auto;
    min-width: 0;
}

.ts-guides-title {
    font-weight: 600;
    line-height: 1.3;
}

.ts-guides-desc {
    font-size: 0.875rem;
    line-height: 1.4;
    color: #6b7280;
}

.ts-guides-meta {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
    color: #6b7280;
}

.ts-guides-meta span + span::before {
    content: '\00b7';
    margin: 0 6px;
}

.ts-guides-item .btn {
    flex: 0 0 auto;
}

body.darkmode .ts-guides-item {
    border-top-color: rgba(163, 177, 221, 0.16);
}

body.darkmode .ts-guides-col-heading {
    border-bottom-color: rgba(163, 177, 221, 0.16);
}

body.darkmode .ts-guides-icon {
    color: #6ea2ff;
    background: rgba(18, 102, 241, 0.18);
}

body.darkmode .ts-guides-desc,
body.darkmode .ts-guides-meta {
    color: #9aa4bf;
}

@media (max-width: 575.98px) {
    .ts-walkthrough-fallback {
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        padding: 16px 16px 12px;
    }

    .ts-walkthrough-fallback-btn {
        min-height: 40px;
        padding: 0 16px;
    }

    .ts-guides-item {
        gap: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ts-walkthrough-fallback,
    .ts-walkthrough-fallback-btn {
        transition: none;
    }
}
