/*
 * Guided mode (G1) — the Guide switch, the docked side panel, and the
 * highlight + tip on the element a walkthrough step points at. Every colour is
 * an --ax-* token, so dark mode follows by construction. Loaded on every panel
 * page next to autnyx-ui.css.
 */
:root {
    --ax-guide-w: 340px;
    --ax-guide-top: 4rem;      /* below the top bar: the Guide switch and user menu stay reachable */
    --ax-guide-z: 35;          /* under Filament modals (z-40+) */
    --ax-guide-tip-z: 60;      /* above modals: a step can point into one */
}

/* ── Top-bar switch ─────────────────────────────────────────────────────── */
.ax-guide-toggle-wrap { display: flex; align-items: center; }
.ax-guide-toggle {
    display: inline-flex; align-items: center; gap: .375rem;
    height: 2rem; padding: 0 .625rem 0 .5rem;
    border: 1px solid var(--ax-line); border-radius: var(--ax-radius-pill);
    background: var(--ax-panel); color: var(--ax-muted);
    font-size: var(--ax-fs-sm); font-weight: 600; line-height: 1; cursor: pointer;
}
.ax-guide-toggle:hover { border-color: var(--ax-accent-300); color: var(--ax-text); }
.ax-guide-toggle.is-on { background: var(--ax-accent-soft); border-color: var(--ax-accent-soft-border); color: var(--ax-accent-strong); }
.ax-guide-toggle-icon { width: 1rem; height: 1rem; }
.ax-guide-toggle-state {
    padding: .125rem .375rem; border-radius: var(--ax-radius-pill);
    background: var(--ax-neutral-soft); color: var(--ax-neutral-fg); font-size: var(--ax-fs-xs);
}
.ax-guide-toggle.is-on .ax-guide-toggle-state { background: var(--ax-accent); color: var(--ax-accent-fg); }
@media (max-width: 640px) { .ax-guide-toggle-label { display: none; } }

/* The top bar sits just above the docked panel, so what opens from it (global
   search results, the user menu, notifications) is never hidden behind the
   panel. Still under Filament modals (z-40+). */
.fi-topbar-ctn { z-index: calc(var(--ax-guide-z) + 1); }

/* ── Docked panel ───────────────────────────────────────────────────────── */
.ax-guide {
    position: fixed; inset-block: var(--ax-guide-top) 0; inset-inline-end: 0; z-index: var(--ax-guide-z);
    width: var(--ax-guide-w); display: flex; flex-direction: column;
    background: var(--ax-panel); color: var(--ax-text);
    border-inline-start: 1px solid var(--ax-line); box-shadow: var(--ax-shadow-md);
    font-size: var(--ax-fs-sm);
}
/* Wide screens: the page makes room, so the panel never covers work. */
html.ax-guide-docked .fi-layout { padding-inline-end: var(--ax-guide-w); }
html.ax-guide-docked .ax-guide { box-shadow: none; }

/* Small screens: a bottom sheet, not a wall. */
@media (max-width: 1023px) {
    .ax-guide {
        inset-block-start: auto; inset-inline: 0; width: auto; max-height: 48vh;
        border-inline-start: 0; border-block-start: 1px solid var(--ax-line);
        border-start-start-radius: var(--ax-radius-lg); border-start-end-radius: var(--ax-radius-lg);
    }
}

.ax-guide-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem 1rem; border-block-end: 1px solid var(--ax-line);
}
.ax-guide-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ax-ink); }
.ax-guide-brand-icon { width: 1.125rem; height: 1.125rem; color: var(--ax-accent); }
.ax-guide-icon-btn {
    display: inline-flex; padding: .25rem; border: 0; border-radius: var(--ax-radius-sm);
    background: transparent; color: var(--ax-muted); cursor: pointer;
}
.ax-guide-icon-btn:hover { background: var(--ax-neutral-soft); color: var(--ax-text); }
.ax-guide-icon { width: 1.125rem; height: 1.125rem; }

.ax-guide-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .875rem; }
.ax-guide-foot { padding: .625rem 1rem; border-block-start: 1px solid var(--ax-line); }

.ax-guide-intro { margin: 0; color: var(--ax-muted); line-height: 1.5; }

.ax-guide-card {
    padding: .875rem; border: 1px solid var(--ax-line); border-radius: var(--ax-radius-lg);
    background: var(--ax-panel-2);
}
.ax-guide-kicker {
    margin-block-end: .375rem; font-size: var(--ax-fs-xs); font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase; color: var(--ax-accent-strong);
}
.ax-guide-title { margin: 0 0 .375rem; font-size: var(--ax-fs-md); font-weight: 700; color: var(--ax-ink); line-height: 1.35; }
.ax-guide-text { margin: 0; line-height: 1.55; color: var(--ax-text); }
.ax-guide-sub { margin-block: .625rem .25rem; font-size: var(--ax-fs-xs); font-weight: 700; color: var(--ax-muted); }
.ax-guide-list { margin: 0; padding-inline-start: 1.1rem; list-style: disc; line-height: 1.5; }
.ax-guide-list li + li { margin-block-start: .2rem; }
.ax-guide-next { margin: .625rem 0 0; line-height: 1.5; color: var(--ax-text); }

/* The running step */
.ax-guide-step { border-color: var(--ax-accent-soft-border); background: var(--ax-accent-soft); }
.ax-guide-progress { display: flex; align-items: center; gap: .625rem; margin-block-end: .625rem; font-size: var(--ax-fs-xs); color: var(--ax-muted); font-weight: 600; }
.ax-guide-progress progress {
    flex: 1; height: .375rem; border: 0; border-radius: var(--ax-radius-pill);
    background: var(--ax-line); overflow: hidden; appearance: none; -webkit-appearance: none;
}
.ax-guide-progress progress::-webkit-progress-bar { background: var(--ax-line); border-radius: var(--ax-radius-pill); }
.ax-guide-progress progress::-webkit-progress-value { background: var(--ax-accent); border-radius: var(--ax-radius-pill); }
.ax-guide-progress progress::-moz-progress-bar { background: var(--ax-accent); border-radius: var(--ax-radius-pill); }
.ax-guide-wait { display: flex; align-items: center; gap: .5rem; margin: .75rem 0 0; font-size: var(--ax-fs-xs); color: var(--ax-muted); }
.ax-guide-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--ax-accent); animation: ax-guide-blink 1.4s ease-in-out infinite; }
.ax-guide-actions { display: flex; align-items: center; gap: .75rem; margin-block-start: .875rem; flex-wrap: wrap; }
.ax-guide-meta-actions { display: flex; align-items: center; justify-content: center; gap: .5rem; color: var(--ax-faint); }

.ax-guide-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
    padding: .4rem .75rem; border: 1px solid var(--ax-line); border-radius: var(--ax-radius);
    background: var(--ax-panel); color: var(--ax-text); font-weight: 600; font-size: var(--ax-fs-sm);
    text-decoration: none; cursor: pointer; white-space: nowrap;
}
.ax-guide-btn:hover { border-color: var(--ax-accent-300); }
.ax-guide-btn-primary { background: var(--ax-accent); border-color: var(--ax-accent); color: var(--ax-accent-fg); }
.ax-guide-btn-primary:hover { background: var(--ax-accent-strong); border-color: var(--ax-accent-strong); }
.ax-guide-step > .ax-guide-btn { margin-block-start: .875rem; }
.ax-guide-back { align-self: flex-start; white-space: normal; text-align: start; }
.ax-guide-link {
    padding: 0; border: 0; background: none; color: var(--ax-muted);
    font-size: var(--ax-fs-xs); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.ax-guide-link:hover { color: var(--ax-accent-strong); }

/* Walkthrough list */
.ax-guide-items { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.ax-guide-item { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; padding-block: .625rem; }
.ax-guide-item + .ax-guide-item { border-block-start: 1px solid var(--ax-line); }
.ax-guide-item-text { min-width: 0; }
.ax-guide-item-title { display: flex; align-items: center; gap: .3rem; font-weight: 600; color: var(--ax-ink); line-height: 1.35; }
.ax-guide-item.is-suggested .ax-guide-item-title { color: var(--ax-accent-strong); }
.ax-guide-item-done { width: 1rem; height: 1rem; flex: none; color: var(--ax-success); }
.ax-guide-item-summary { margin-block-start: .15rem; color: var(--ax-muted); line-height: 1.45; }
.ax-guide-item-meta { margin-block-start: .2rem; font-size: var(--ax-fs-xs); color: var(--ax-faint); }
.ax-guide-badge {
    padding: .15rem .5rem; border-radius: var(--ax-radius-pill);
    background: var(--ax-accent-soft); color: var(--ax-accent-strong); font-size: var(--ax-fs-xs); font-weight: 700;
}

/* Finished */
.ax-guide-done { border-color: var(--ax-success-line); background: var(--ax-success-soft); }
.ax-guide-done-title { display: flex; align-items: center; gap: .4rem; margin-block-end: .375rem; font-weight: 700; color: var(--ax-success-fg); }
.ax-guide-done-icon { width: 1.125rem; height: 1.125rem; }
.ax-guide-done p { margin: 0 0 .75rem; line-height: 1.5; }

/* Collapsed: a slim tab on the edge */
.ax-guide-tab {
    position: fixed; inset-inline-end: 0; inset-block-end: 5rem; z-index: var(--ax-guide-z);
    display: inline-flex; align-items: center; gap: .375rem; padding: .5rem .625rem;
    border: 1px solid var(--ax-accent-soft-border); border-inline-end: 0;
    border-start-start-radius: var(--ax-radius-lg); border-end-start-radius: var(--ax-radius-lg);
    background: var(--ax-panel); color: var(--ax-accent-strong); box-shadow: var(--ax-shadow-md);
    font-size: var(--ax-fs-sm); font-weight: 700; cursor: pointer;
}
.ax-guide-tab-icon { width: 1rem; height: 1rem; }
.ax-guide-tab-step { padding: .1rem .375rem; border-radius: var(--ax-radius-pill); background: var(--ax-accent); color: var(--ax-accent-fg); font-size: var(--ax-fs-xs); }

/* ── Highlight + tip ────────────────────────────────────────────────────── */
.ax-guide-target {
    outline: 2px solid var(--ax-accent) !important; outline-offset: 3px;
    animation: ax-guide-pulse 1.8s ease-out infinite;
}
.fi-sidebar .ax-guide-target { outline-offset: -2px; }

/* The popup on the page: where to click for the running step */
.ax-guide-pop {
    position: fixed; z-index: var(--ax-guide-tip-z); width: min(300px, calc(100vw - 16px));
    padding: .625rem .75rem .75rem; border-radius: var(--ax-radius-lg);
    background: var(--ax-accent-700); color: #fff;   /* same deep violet in both themes: AA contrast */
    font-size: var(--ax-fs-sm); line-height: 1.45; box-shadow: var(--ax-shadow-lg, var(--ax-shadow-md));
}
.ax-guide-pop[hidden] { display: none; }
.ax-guide-pop::before {
    content: ""; position: absolute; width: .625rem; height: .625rem; background: inherit; transform: rotate(45deg);
}
.ax-guide-pop[data-side="below"]::before { top: -.3rem; left: var(--ax-guide-arrow-x, 1rem); }
.ax-guide-pop[data-side="above"]::before { bottom: -.3rem; left: var(--ax-guide-arrow-x, 1rem); }
.ax-guide-pop[data-side="right"]::before { left: -.3rem; top: var(--ax-guide-arrow-y, 1rem); }
.ax-guide-pop[data-side="float"] { left: 50%; bottom: 1.25rem; top: auto; transform: translateX(-50%); }
.ax-guide-pop[data-side="float"]::before { display: none; }
.ax-guide-pop-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .125rem; }
.ax-guide-pop-count { font-size: var(--ax-fs-xs); font-weight: 600; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.ax-guide-pop-close {
    width: 1.5rem; height: 1.5rem; margin: -.25rem -.375rem 0 0; border: 0; border-radius: var(--ax-radius-pill);
    background: transparent; color: #fff; font-size: 1.125rem; line-height: 1; cursor: pointer; opacity: .8;
}
.ax-guide-pop-close:hover, .ax-guide-pop-close:focus-visible { opacity: 1; background: rgba(255, 255, 255, .15); }
.ax-guide-pop-title { font-weight: 700; font-size: var(--ax-fs-md, 1rem); }
.ax-guide-pop-text { margin: .25rem 0 0; }
.ax-guide-pop-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .625rem; }
.ax-guide-pop-actions:empty { display: none; }
.ax-guide-pop-btn {
    padding: .3rem .75rem; border: 1px solid rgba(255, 255, 255, .6); border-radius: var(--ax-radius-pill);
    background: transparent; color: #fff; font-size: var(--ax-fs-sm); font-weight: 700; cursor: pointer;
}
.ax-guide-pop-btn.is-primary { background: #fff; border-color: #fff; color: var(--ax-accent-700); }
.ax-guide-pop-link { padding: 0; border: 0; background: none; color: #fff; font-size: var(--ax-fs-sm); text-decoration: underline; cursor: pointer; opacity: .9; }
.ax-guide-pop button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* "Show me" on a "You can…" line */
.ax-guide-showme {
    margin-inline-start: .25rem; padding: 0 .375rem; border: 1px solid var(--ax-accent-soft-border);
    border-radius: var(--ax-radius-pill); background: var(--ax-accent-soft); color: var(--ax-accent-strong);
    font-size: var(--ax-fs-xs); font-weight: 700; line-height: 1.5; cursor: pointer; white-space: nowrap;
}
.ax-guide-showme:hover, .ax-guide-showme.is-on { background: var(--ax-accent); border-color: var(--ax-accent); color: var(--ax-accent-fg); }

/* "More walkthroughs" in the panel */
.ax-guide-more { display: block; margin-top: .5rem; }
.ax-guide-kicker-app { color: var(--ax-accent-strong); }

@keyframes ax-guide-pulse {
    0%   { box-shadow: 0 0 0 0 var(--ax-accent-300); }
    70%  { box-shadow: 0 0 0 10px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes ax-guide-blink { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .ax-guide-target, .ax-guide-dot { animation: none; }
}
@media print {
    .ax-guide, .ax-guide-tab, .ax-guide-pop, .ax-guide-toggle-wrap { display: none !important; }
    html.ax-guide-docked .fi-layout { padding-inline-end: 0; }
}

/* "Show me how" on the Getting started checklist */
.ax-guide-howto {
    display: inline-flex; align-items: center; gap: .25rem; padding: 0; border: 0; background: none;
    color: var(--ax-accent-strong); font: inherit; font-weight: 700; cursor: pointer;
}
.ax-guide-howto::before { content: "▶"; font-size: .6rem; }
.ax-guide-howto:hover { text-decoration: underline; }
