/* tour.css — Guided Onboarding Tour (2026-08-31 redesign).
   Auto-play cursor + spotlight with attached tooltip, step dots,
   per-step icons, Next/Back when paused, completion confetti.
   Built from app.css tokens for automatic theming. */

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: transparent;
  cursor: default;
}

.tour-spotlight {
  position: fixed;
  z-index: 200;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 4px var(--accent-bg), 0 0 0 2px var(--accent), 0 0 0 9999px rgba(15, 17, 20, 0.5);
  pointer-events: none;
  transition: top 0.35s cubic-bezier(0.4, 0, 0.2, 1), left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.35s cubic-bezier(0.4, 0, 0.2, 1), height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.tour-target {
  position: relative;
  z-index: 201;
}

/* --- Tooltip: attached card with arrow ----------------------------------- */
.tour-tooltip {
  position: fixed;
  z-index: 202;
  width: 340px;
  max-width: calc(100vw - 24px);
  background: var(--panel);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.08);
  padding: 16px 20px 14px;
  font-family: var(--font-body);
  text-align: left;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: auto;
}
.tour-tooltip.is-visible { opacity: 1; transform: translateY(0); }

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

/* CSS arrow pointing toward target — direction set via data-placement attr */
.tour-tooltip-arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  transform: rotate(45deg);
  pointer-events: none;
}
.tour-tooltip[data-placement="bottom"] .tour-tooltip-arrow {
  top: -7px; left: 50%; margin-left: -6px;
  border-bottom: none; border-right: none;
}
.tour-tooltip[data-placement="top"] .tour-tooltip-arrow {
  bottom: -7px; left: 50%; margin-left: -6px;
  border-top: none; border-left: none;
}
.tour-tooltip[data-placement="left"] .tour-tooltip-arrow {
  right: -7px; top: 50%; margin-top: -6px;
  border-left: none; border-bottom: none;
}
.tour-tooltip[data-placement="right"] .tour-tooltip-arrow {
  left: -7px; top: 50%; margin-top: -6px;
  border-right: none; border-top: none;
}

.tour-tooltip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.tour-tooltip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 17px;
  flex-shrink: 0;
}

.tour-tooltip-step {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: auto;
}

.tour-tooltip-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  padding: 4px;
  margin: -4px -4px -4px 0;
  border-radius: 8px;
  cursor: pointer;
}
.tour-tooltip-close:hover { color: var(--txt); background: var(--accent-bg); }
.tour-tooltip-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tour-tooltip-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--txt);
}

.tour-tooltip-desc {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--txt-soft);
}

/* --- Progress bar (auto-play timer) -------------------------------------- */
.tour-progress-bar {
  position: relative;
  height: 3px;
  border-radius: 999px;
  background: var(--accent-bg);
  overflow: hidden;
  margin: 0 0 14px;
}
.tour-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.1s linear;
}

/* --- Step dots ----------------------------------------------------------- */
.tour-step-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tour-step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-2);
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.tour-step-dot.is-done {
  background: var(--accent);
}
.tour-step-dot.is-current {
  width: 8px;
  height: 8px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}

/* --- Action bar ---------------------------------------------------------- */
.tour-tooltip-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

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

.tour-tooltip-skip {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 4px;
}
.tour-tooltip-skip:hover { color: var(--txt-soft); text-decoration: underline; }
.tour-tooltip-skip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.tour-tooltip-pause {
  appearance: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--txt-soft);
}
.tour-tooltip-pause:hover { background: var(--accent-bg); color: var(--txt); }
.tour-tooltip-pause:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tour-tooltip-back {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--txt-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
}
.tour-tooltip-back:hover { color: var(--txt); }
.tour-tooltip-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.tour-tooltip-next {
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  cursor: pointer;
  background: var(--accent);
  color: var(--panel);
}
.tour-tooltip-next:hover { filter: brightness(1.06); }
.tour-tooltip-next:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 480px) {
  .tour-tooltip { width: calc(100vw - 16px); padding: 14px 16px 12px; }
}

/* --- Completion card ----------------------------------------------------- */
.tour-overlay.tour-complete { background: rgba(15, 17, 20, 0.4); transition: background 0.3s ease; }

.tour-tooltip.tour-complete {
  top: 50%;
  left: 50%;
  bottom: auto;
  width: 380px;
  padding: 24px 28px;
  text-align: center;
  transform: translate(-50%, -50%) scale(0.95);
  border-radius: 16px;
}
.tour-tooltip.tour-complete.is-visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.tour-tooltip.tour-complete .tour-tooltip-arrow { display: none; }
.tour-tooltip.tour-complete .tour-tooltip-header { justify-content: flex-end; margin-bottom: 0; }
.tour-tooltip.tour-complete .tour-tooltip-icon { display: none; }
.tour-tooltip.tour-complete .tour-tooltip-title { font-size: 20px; margin-top: 4px; text-align: center; }
.tour-tooltip.tour-complete .tour-tooltip-desc { text-align: center; margin-bottom: 20px; }
.tour-tooltip.tour-complete .tour-tooltip-actions { display: none; }
.tour-tooltip.tour-complete .tour-progress-bar { display: none; }

/* Animated checkmark for completion */
.tour-check-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px auto 16px;
}
.tour-check-svg {
  width: 56px;
  height: 56px;
}
.tour-check-circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 157;
  stroke-dashoffset: 157;
  animation: tour-draw-circle 0.5s ease-out 0.1s forwards;
}
.tour-check-tick {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: tour-draw-tick 0.35s ease-out 0.5s forwards;
}
@keyframes tour-draw-circle {
  to { stroke-dashoffset: 0; }
}
@keyframes tour-draw-tick {
  to { stroke-dashoffset: 0; }
}

.tour-tooltip-finish {
  appearance: none;
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 20px;
  cursor: pointer;
  background: var(--accent);
  color: var(--panel);
}
.tour-tooltip-finish:hover { filter: brightness(1.06); }
.tour-tooltip-finish:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Confetti canvas ----------------------------------------------------- */
.tour-confetti {
  position: fixed;
  inset: 0;
  z-index: 204;
  pointer-events: none;
}

/* --- Fake auto-play cursor ----------------------------------------------- */
.tour-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 203;
  width: 28px;
  height: 28px;
  pointer-events: none;
  transform: translate(-4px, -4px);
  transition: top 0.6s cubic-bezier(0.65, 0, 0.35, 1), left 0.6s cubic-bezier(0.65, 0, 0.35, 1);
  filter: drop-shadow(0 2px 4px rgba(15, 17, 20, 0.3));
}
.tour-cursor svg { display: block; width: 100%; height: 100%; }
.tour-cursor-arrow { fill: var(--accent); stroke: var(--panel); stroke-width: 1.5; }

.tour-cursor.is-clicking { animation: tour-cursor-click 0.4s ease-out; }
@keyframes tour-cursor-click {
  0% { transform: translate(-4px, -4px) scale(1); }
  40% { transform: translate(-4px, -4px) scale(0.8); }
  100% { transform: translate(-4px, -4px) scale(1); }
}

.tour-cursor-ripple {
  position: fixed;
  z-index: 203;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  pointer-events: none;
  animation: tour-ripple 0.5s ease-out forwards;
}
@keyframes tour-ripple {
  0% { transform: scale(0.3); opacity: 0.9; }
  100% { transform: scale(2.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tour-cursor { transition: none; }
  .tour-cursor.is-clicking { animation: none; }
  .tour-cursor-ripple { animation: none; display: none; }
  .tour-check-circle { animation: none; stroke-dashoffset: 0; }
  .tour-check-tick { animation: none; stroke-dashoffset: 0; }
}
