/*
 * tour.css — styles for the AgentsBooks guided tour engine.
 *
 * Reuses the existing brand tokens (var(--accent), var(--accent-light),
 * var(--accent-glow), var(--card), var(--border), var(--text)) so the
 * tour matches the red/orange platform theme on light and dark surfaces.
 *
 * Contract:
 *   .ab-tour-mask         → fixed full-viewport dim container (4 rects)
 *   .ab-tour-mask__rect   → one of the 4 dimming rectangles
 *   .ab-tour-hole         → the red/orange ring around the highlighted element
 *   .ab-tour-popover      → the step card (title, body, dots, buttons)
 *   .ab-tour-btn          → step buttons; --primary variant is brand-gradient
 *   .ab-tour-step-dot     → progress indicator dots in the popover footer
 *
 * Z-index layering:
 *   mask rects: 100000
 *   hole ring:  100001
 *   popover:    100002
 *   launcher:   9000 (below tours, above normal content)
 */

/* ── Mask ───────────────────────────────────────────────────── */
.ab-tour-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100000;
}

.ab-tour-mask__rect {
    position: absolute;
    background: rgba(12, 10, 8, 0.62);
    pointer-events: auto;
    transition: all 0.18s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .ab-tour-mask__rect {
        transition: none;
    }
}

.ab-tour-hole {
    position: fixed;
    border-radius: 14px;
    box-shadow:
        0 0 0 3px var(--accent, #EA5332),
        0 0 0 6px rgba(234, 83, 50, 0.22),
        0 0 40px 6px rgba(234, 83, 50, 0.35);
    pointer-events: none;
    z-index: 100001;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    animation: ab-tour-pulse 2.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .ab-tour-hole {
        animation: none;
        transition: none;
    }
}

@keyframes ab-tour-pulse {

    0%,
    100% {
        box-shadow:
            0 0 0 3px var(--accent, #EA5332),
            0 0 0 6px rgba(234, 83, 50, 0.22),
            0 0 30px 4px rgba(234, 83, 50, 0.28);
    }

    50% {
        box-shadow:
            0 0 0 3px var(--accent-light, #FF6D4A),
            0 0 0 8px rgba(255, 109, 74, 0.3),
            0 0 50px 8px rgba(255, 109, 74, 0.45);
    }
}

/* ── Popover ────────────────────────────────────────────────── */
.ab-tour-popover {
    position: fixed;
    z-index: 100002;
    min-width: 280px;
    max-width: 400px;
    padding: 1.1rem 1.2rem 1rem;
    background: var(--card, #ffffff);
    color: var(--text, #0f172a);
    border: 1px solid var(--border, rgba(234, 83, 50, 0.25));
    border-radius: 16px;
    box-shadow:
        0 18px 50px rgba(12, 10, 8, 0.28),
        0 6px 18px rgba(234, 83, 50, 0.18);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.94rem;
    line-height: 1.45;
    animation: ab-tour-pop-in 0.22s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .ab-tour-popover {
        animation: none;
    }
}

@keyframes ab-tour-pop-in {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(4px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ab-tour-popover::before {
    /* brand top stripe */
    content: "";
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, var(--accent, #EA5332), var(--accent-light, #FF6D4A));
}

.ab-tour-popover__close {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text, #0f172a);
    opacity: 0.55;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    transition: opacity 0.15s, background 0.15s;
}

.ab-tour-popover__close:hover,
.ab-tour-popover__close:focus-visible {
    opacity: 1;
    background: rgba(234, 83, 50, 0.1);
    outline: none;
}

.ab-tour-popover__title {
    margin: 0.2rem 1.6rem 0.4rem 0;
    font-family: 'Clash Display', 'Inter', sans-serif;
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--accent, #EA5332);
    letter-spacing: -0.01em;
}

.ab-tour-popover__body {
    margin: 0 0 0.9rem;
    color: var(--text, #0f172a);
    opacity: 0.92;
}

.ab-tour-popover__body p {
    margin: 0 0 0.4rem;
}

.ab-tour-popover__body strong {
    color: var(--accent, #EA5332);
}

.ab-tour-popover__body code {
    padding: 0.05rem 0.35rem;
    background: rgba(234, 83, 50, 0.08);
    border-radius: 6px;
    font-size: 0.88em;
    color: var(--accent, #EA5332);
}

.ab-tour-popover__dots {
    display: flex;
    gap: 5px;
    margin-bottom: 0.75rem;
}

.ab-tour-step-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(234, 83, 50, 0.22);
    transition: background 0.15s, transform 0.15s;
}

.ab-tour-step-dot.is-active {
    background: var(--accent, #EA5332);
    transform: scale(1.25);
}

.ab-tour-popover__buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.ab-tour-btn {
    padding: 0.5rem 0.95rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}

.ab-tour-btn:focus-visible {
    outline: 2px solid var(--accent, #EA5332);
    outline-offset: 2px;
}

.ab-tour-btn--primary {
    color: #fff;
    background: linear-gradient(135deg, var(--accent, #EA5332), var(--accent-light, #FF6D4A));
    box-shadow: 0 4px 14px rgba(234, 83, 50, 0.38);
}

.ab-tour-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(234, 83, 50, 0.5);
}

.ab-tour-btn--ghost {
    background: transparent;
    color: var(--text, #0f172a);
    border-color: var(--border, rgba(234, 83, 50, 0.25));
}

.ab-tour-btn--ghost:hover {
    background: rgba(234, 83, 50, 0.08);
    color: var(--accent, #EA5332);
}

/* ── Nav launcher (base.html #nav-tour-btn) ─────────────────── */
/* The tour launcher lives in the top nav as a ghost `?` icon button
   styled by `.social-action-btn` (shared with notifications, chat,
   theme toggle). We only need to hide it while a tour is playing. */
body.ab-tour-active #nav-tour-btn {
    opacity: 0;
    pointer-events: none;
}
