/* Quick Tour — guided product walkthrough overlay.
 *
 * A self-contained spotlight tour: a floating launcher pill, a dimming
 * blocker, a moving spotlight ring around the highlighted element, and a
 * popover card with the explanatory copy + navigation. Driven by
 * static/js/quick_start_tour.js and loaded globally via UNFOLD["STYLES"].
 *
 * Visual language matches the rest of the app: violet brand gradient
 * (#9333ea -> #7c3aed), the dark popover idiom from admin_help_tips.css, and
 * full dark-mode parity (Unfold toggles `.dark` on <html>). All class names
 * are `dnx-tour-*` scoped and every measurement is explicit so the tour does
 * not depend on the purged Tailwind subset being present.
 */

:root {
    --dnx-tour-brand: #7c3aed;
    --dnx-tour-brand-2: #9333ea;
    --dnx-tour-grad: linear-gradient(135deg, #9333ea, #7c3aed);
    --dnx-tour-dim: rgba(15, 23, 42, 0.62);
    --dnx-tour-card: #ffffff;
    --dnx-tour-title: #0f172a;
    --dnx-tour-text: #475569;
    --dnx-tour-muted: #64748b;
    --dnx-tour-border: #ece5ff;
}

/* ---------- Floating launcher ---------------------------------------- */

/* `button.` qualifier keeps specificity (0,1,1) above Tailwind Preflight's
 * `[type='button'] { background-image: none }` reset (0,1,0), which Unfold's
 * stylesheet loads after ours. */
button.dnx-tour-launcher {
    position: fixed;
    right: 22px;
    bottom: 22px;
    /* Sit just below Unfold's popup/overlay layer (z-50) — filters, modals and
     * dropdowns dim it instead of fighting it — while staying above page content. */
    z-index: 15;

    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px 11px 15px;

    border: none;
    border-radius: 999px;
    background: var(--dnx-tour-grad);
    color: #ffffff;
    cursor: pointer;

    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;

    box-shadow: 0 10px 26px rgba(124, 58, 237, 0.36);
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.dnx-tour-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(124, 58, 237, 0.44);
    color: #ffffff;
}

.dnx-tour-launcher:focus-visible {
    outline: 3px solid rgba(147, 51, 234, 0.45);
    outline-offset: 2px;
}

.dnx-tour-launcher .material-symbols-outlined {
    font-size: 20px;
    line-height: 1;
}

.dnx-tour-launcher[hidden] {
    display: none;
}

@media (max-width: 600px) {
    .dnx-tour-launcher__text {
        display: none;
    }
    .dnx-tour-launcher {
        padding: 13px;
    }
}

/* ---------- Overlay scaffolding -------------------------------------- */

.dnx-tour-blocker {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: transparent;
    cursor: default;
}

.dnx-tour-blocker.is-plain {
    background: var(--dnx-tour-dim);
}

.dnx-tour-spotlight {
    position: fixed;
    z-index: 100001;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-radius: 12px;
    pointer-events: none;
    box-shadow: 0 0 0 9999px var(--dnx-tour-dim),
                0 0 0 3px rgba(255, 255, 255, 0.9),
                0 0 0 6px rgba(124, 58, 237, 0.55);
    transition: top 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                left 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.dnx-tour-spotlight[hidden] {
    display: none;
}

.dnx-tour-spotlight::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 16px;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.35);
    animation: dnx-tour-pulse 1.8s ease-out infinite;
}

@keyframes dnx-tour-pulse {
    0%   { opacity: 0.9; transform: scale(1); }
    70%  { opacity: 0;   transform: scale(1.06); }
    100% { opacity: 0;   transform: scale(1.06); }
}

/* ---------- Popover card --------------------------------------------- */

.dnx-tour-popover {
    position: fixed;
    z-index: 100002;
    top: 0;
    left: 0;
    width: 468px;
    max-width: calc(100vw - 24px);

    background: var(--dnx-tour-card);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    padding: 29px 29px 23px;

    font-family: ui-sans-serif, system-ui, sans-serif;
    color: var(--dnx-tour-text);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease, top 0.2s ease, left 0.2s ease;
}

.dnx-tour-popover.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.dnx-tour-arrow {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--dnx-tour-card);
    transform: rotate(45deg);
    box-shadow: -3px -3px 8px rgba(15, 23, 42, 0.06);
}

.dnx-tour-arrow[hidden] {
    display: none;
}

.dnx-tour-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--dnx-tour-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.dnx-tour-close:hover {
    background: rgba(124, 58, 237, 0.1);
    color: var(--dnx-tour-brand);
}

.dnx-tour-close .material-symbols-outlined {
    font-size: 26px;
    line-height: 1;
}

.dnx-tour-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 13px;
    padding: 5px 13px;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.1);
    color: var(--dnx-tour-brand);
    font-size: 12.6px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dnx-tour-eyebrow .material-symbols-outlined {
    font-size: 16px;
    line-height: 1;
}

.dnx-tour-title {
    margin: 0 0 10px;
    padding-right: 34px;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--dnx-tour-title);
}

.dnx-tour-body {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.6;
    color: var(--dnx-tour-text);
}

.dnx-tour-body strong {
    color: var(--dnx-tour-title);
    font-weight: 700;
}

.dnx-tour-body a {
    color: var(--dnx-tour-brand);
    font-weight: 600;
    text-decoration: underline;
}

.dnx-tour-body code {
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(124, 58, 237, 0.1);
    color: var(--dnx-tour-brand);
    font-size: 0.85em;
    font-weight: 600;
}

/* ---------- Footer: progress + navigation ---------------------------- */

.dnx-tour-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px 14px;
    margin-top: 26px;
}

.dnx-tour-dots {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
    flex-shrink: 0;
    margin-inline-end: auto;
}

.dnx-tour-dot {
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.22);
    transition: transform 0.15s ease, background 0.15s ease;
}

.dnx-tour-dot.is-active {
    background: var(--dnx-tour-brand);
    transform: scale(1.45);
}

.dnx-tour-dot.is-done {
    background: rgba(124, 58, 237, 0.5);
}

.dnx-tour-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dnx-tour-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 21px;
    border-radius: 13px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 1.03rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.dnx-tour-btn--primary {
    background: var(--dnx-tour-grad);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.3);
}

.dnx-tour-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.4);
    color: #ffffff;
}

.dnx-tour-btn--ghost {
    background: transparent;
    color: var(--dnx-tour-muted);
    border-color: transparent;
}

.dnx-tour-btn--ghost:hover {
    background: rgba(124, 58, 237, 0.08);
    color: var(--dnx-tour-brand);
}

.dnx-tour-btn--ghost[hidden] {
    display: none;
}

.dnx-tour-skip {
    background: none;
    border: none;
    padding: 5px 3px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--dnx-tour-muted);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
    margin-inline-end: 14px;
}

.dnx-tour-skip:hover {
    color: var(--dnx-tour-brand);
}

.dnx-tour-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}

.dnx-tour-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dnx-tour-muted);
    letter-spacing: 0.02em;
}

/* ---------- Dark mode (Unfold toggles `.dark` on <html>) ------------- */

.dark .dnx-tour-popover {
    --dnx-tour-card: #1f2937;
    --dnx-tour-title: #f9fafb;
    --dnx-tour-text: #cbd5e1;
    --dnx-tour-muted: #94a3b8;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.dark .dnx-tour-arrow {
    box-shadow: -3px -3px 8px rgba(0, 0, 0, 0.2);
}

.dark .dnx-tour-spotlight {
    box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.7),
                0 0 0 3px rgba(15, 23, 42, 0.9),
                0 0 0 6px rgba(167, 139, 250, 0.7);
}

.dark .dnx-tour-eyebrow,
.dark .dnx-tour-body code {
    background: rgba(167, 139, 250, 0.16);
    color: #c4b5fd;
}

.dark .dnx-tour-body a {
    color: #c4b5fd;
}

/* ---------- Reduced motion ------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .dnx-tour-spotlight,
    .dnx-tour-popover,
    .dnx-tour-launcher,
    .dnx-tour-btn {
        transition: none;
    }
    .dnx-tour-spotlight::after {
        animation: none;
    }
}