/* CmTour — first-visit page tutorials (paired with public/js/cm-tour.js).
   Theme-aware via Bootstrap CSS variables; respects prefers-reduced-motion.
   Replaced the old intro.js page guides. */

.cm-tour {
    position: fixed;
    inset: 0;
    z-index: 1080; /* above navbar (1020) + modals (1055) */
}

/* Dimmer. When a step spotlights an element the backdrop goes transparent —
   the spotlight's giant box-shadow takes over the dimming so the target
   stays bright inside the cutout. */
.cm-tour__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(13, 17, 23, .55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .28s ease, background .28s ease;
}
.cm-tour.is-open .cm-tour__backdrop { opacity: 1; }
.cm-tour.has-spotlight .cm-tour__backdrop {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.cm-tour__spotlight {
    position: absolute;
    border-radius: .9rem;
    box-shadow: 0 0 0 200vmax rgba(13, 17, 23, .55);
    outline: 2px solid rgba(96, 165, 250, .95);
    outline-offset: 2px;
    pointer-events: none;
    transition: top .3s ease, left .3s ease, width .3s ease, height .3s ease;
    animation: cm-tour-spot-pulse 2s ease-in-out infinite;
}

@keyframes cm-tour-spot-pulse {
    0%, 100% { outline-color: rgba(96, 165, 250, .95); }
    50%      { outline-color: rgba(96, 165, 250, .45); }
}

.cm-tour__card {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(.94);
    width: min(26rem, calc(100vw - 2rem));
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    border-radius: 1.25rem;
    box-shadow: 0 1.5rem 3.5rem rgba(0, 0, 0, .25);
    padding: 1.5rem 1.5rem 1.25rem;
    opacity: 0;
    transition: opacity .28s ease, transform .28s ease, top .3s ease, bottom .3s ease;
}
.cm-tour.is-open .cm-tour__card {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Dodge the spotlight: pin the card to whichever half the target isn't in. */
.cm-tour__card--low {
    top: auto;
    bottom: 1.5rem;
    transform: translate(-50%, 0) scale(.94);
}
.cm-tour.is-open .cm-tour__card--low { transform: translate(-50%, 0) scale(1); }
.cm-tour__card--high {
    top: 4.5rem;
    transform: translate(-50%, 0) scale(.94);
}
.cm-tour.is-open .cm-tour__card--high { transform: translate(-50%, 0) scale(1); }

.cm-tour__close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    border: 0;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 1.1rem;
    line-height: 1;
    padding: .35rem;
    border-radius: .5rem;
}
.cm-tour__close:hover { background: var(--bs-secondary-bg); color: var(--bs-body-color); }

.cm-tour__icon {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .85rem;
    background: rgba(96, 165, 250, .15);
    transition: background .25s ease;
}
.cm-tour__icon img { width: 1.9rem; height: 1.9rem; }

/* Brand splash (logo: true) — the Bootly wordmark instead of an icon chip,
   with the whole step centered like a welcome card. */
.cm-tour__icon--brand {
    width: auto;
    height: auto;
    border-radius: 0;
    background: transparent !important;
    font-size: 2.1rem;
    margin-bottom: .65rem;
}
.cm-tour__card--centered .cm-tour__step,
.cm-tour__card--centered { text-align: center; }
.cm-tour__card--centered .cm-tour__dots { justify-content: center; }

/* Step content swap — directional slide + fade. */
.cm-tour__viewport { overflow: hidden; }
.cm-tour__step { transition: opacity .22s ease, transform .22s ease; }
.cm-tour__step.is-leaving-next  { opacity: 0; transform: translateX(-1.5rem); }
.cm-tour__step.is-entering-next { opacity: 0; transform: translateX(1.5rem); transition: none; }
.cm-tour__step.is-leaving-back  { opacity: 0; transform: translateX(1.5rem); }
.cm-tour__step.is-entering-back { opacity: 0; transform: translateX(-1.5rem); transition: none; }

.cm-tour__eyebrow {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    margin-bottom: .35rem;
}
.cm-tour__title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: .4rem;
}
.cm-tour__body {
    color: var(--bs-secondary-color);
    font-size: .95rem;
    line-height: 1.55;
    margin-bottom: 0;
}
.cm-tour__body b, .cm-tour__body strong { color: var(--bs-body-color); }

.cm-tour__dots {
    display: flex;
    gap: .4rem;
    margin: 1rem 0 1.1rem;
}
.cm-tour__dot {
    width: .5rem;
    height: .5rem;
    border-radius: 999px;
    background: var(--bs-border-color);
    transition: width .25s ease, background .25s ease;
}
.cm-tour__dot.is-done { background: rgba(28, 166, 114, .75); }
.cm-tour__dot.is-active { width: 1.4rem; background: var(--bs-primary); }

.cm-tour__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.cm-tour__skip {
    border: 0;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: .85rem;
    padding: .25rem 0;
}
.cm-tour__skip:hover { color: var(--bs-body-color); text-decoration: underline; }
.cm-tour__nav { display: flex; gap: .5rem; }

@media (max-width: 575.98px) {
    .cm-tour__card,
    .cm-tour__card--high,
    .cm-tour__card--low {
        left: 1rem;
        right: 1rem;
        top: auto;
        bottom: 1rem;
        width: auto;
        transform: translateY(.75rem) scale(.98);
    }
    .cm-tour.is-open .cm-tour__card { transform: translateY(0) scale(1); }
}

/* Replay affordance — bottom-left pill (chat owns bottom-right). Sits under
   the cookie banner (1080) and the tour itself; hidden while a tour runs. */
.cm-tour-replay {
    position: fixed;
    left: 1rem;
    bottom: 1rem;
    z-index: 1050;
    display: inline-flex;
    align-items: center;
    height: 2.75rem;
    padding: 0 .85rem;
    border-radius: 999px;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-secondary-color);
    box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .14);
    transition: color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.cm-tour-replay .bi { font-size: 1.05rem; line-height: 1; }
.cm-tour-replay__label {
    max-width: 0;
    margin-left: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    font-size: .85rem;
    font-weight: 600;
    transition: max-width .25s ease, margin-left .25s ease, opacity .2s ease;
}
.cm-tour-replay:hover,
.cm-tour-replay:focus-visible {
    color: var(--bs-primary);
    border-color: rgba(var(--bs-primary-rgb), .45);
    box-shadow: 0 .5rem 1.5rem rgba(var(--bs-primary-rgb), .25);
}
.cm-tour-replay:hover .cm-tour-replay__label,
.cm-tour-replay:focus-visible .cm-tour-replay__label {
    max-width: 6rem;
    margin-left: .45rem;
    opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
    .cm-tour__backdrop,
    .cm-tour__card,
    .cm-tour__step,
    .cm-tour__spotlight,
    .cm-tour__dot,
    .cm-tour-replay,
    .cm-tour-replay__label { transition: none !important; animation: none !important; }
}
