/* tutorial-engine.css — shared styles for the guided-tour overlay.
   Tool-agnostic; reuses design tokens from base.css. Load before any
   per-tool tutorial CSS. */

.tut-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  pointer-events: none; /* clicks pass through to the spotlighted control */
}

/* Highlight ring around the target — no page dimming. A double box-shadow
   draws a crisp red ring plus a soft glow so it's obvious what to act on while
   the rest of the page stays fully visible. Non-interactive (clicks pass to
   the target underneath). */
.tut-spotlight {
  position: fixed;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 0 0 3px var(--red), 0 0 0 6px rgba(192, 57, 43, 0.25);
  transition: top .2s ease, left .2s ease, width .2s ease, height .2s ease;
}

.tut-tooltip {
  position: fixed;
  background: var(--white);
  border: 2px solid var(--red);
  border-radius: 12px;
  padding: 18px 22px 20px;
  max-width: 360px;
  width: calc(100% - 32px);
  box-shadow: 0 10px 38px rgba(0, 0, 0, 0.28);
  pointer-events: all;
  animation: popupFadeIn .15s ease;
  color: var(--dark);
}

/* Red arrow triangles pointing toward the target, matching the red border so
   the offset window stays visually connected to what it points at. */
.tut-tooltip::before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border: 10px solid transparent;
}
.tut-tooltip.tut-arrow-up::before    { bottom: 100%; left: 50%; transform: translateX(-50%); border-bottom-color: var(--red); }
.tut-tooltip.tut-arrow-down::before  { top: 100%;    left: 50%; transform: translateX(-50%); border-top-color: var(--red); }
.tut-tooltip.tut-arrow-left::before  { right: 100%;  top: 50%;  transform: translateY(-50%); border-right-color: var(--red); }
.tut-tooltip.tut-arrow-right::before { left: 100%;   top: 50%;  transform: translateY(-50%); border-left-color: var(--red); }
.tut-tooltip.tut-centered::before    { display: none; }

.tut-step-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.tut-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.tut-dot.active { background: var(--red); }
.tut-dot.done   { background: #e6a9a1; } /* faded red */

.tut-count {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}
.tut-title {
  margin: 0 0 8px;
  font-size: 1.08rem;
  color: var(--red);
}
.tut-body {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--gray);
}
.tut-body a { color: var(--red); }

.tut-hint {
  margin-top: 12px;
  padding: 9px 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 8px;
  font-size: 0.86rem;
  color: #6b5300;
  animation: popupFadeIn .15s ease;
}

.tut-showme {
  margin-top: 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.83rem;
  color: var(--gray);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.tut-showme:hover { border-color: var(--red); color: var(--red); }

.tut-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}
/* Primary row: the step's CTA / waiting line (+ optional Skip), right-aligned. */
.tut-actions-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  flex-wrap: wrap;
}
/* Nav row: 3-column grid so Back sits left, the primary Next/Finish button is
   centred, and Exit/Replay sits right — middle stays dead-centre even when the
   Back cell is empty (step 0). */
.tut-actions-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.tut-btn {
  font-size: 0.88rem;
  cursor: pointer;
  border-radius: 6px;
  padding: 8px 14px;
  border: none;
  background: none;
}
.tut-btn-next {
  background: var(--red);
  color: var(--white);
  font-weight: 600;
  grid-column: 2;
  justify-self: center;
}
.tut-btn-next:hover { filter: brightness(1.08); }
.tut-btn-back { color: var(--gray); grid-column: 1; justify-self: start; }
.tut-btn-back[disabled] { opacity: 0.4; cursor: default; }
.tut-btn-skip { color: var(--muted); grid-column: 3; justify-self: end; }
.tut-btn-skipone { color: var(--red); margin-left: auto; }

/* Status line shown in place of "Next" on a 'do' step until completed. It is
   deliberately NOT styled like a button — early testers clicked a boxed,
   button-shaped gate instead of the real control. It's plain muted italic text
   with a small "waiting" dot; clicking it pulses the real target (see JS). */
.tut-gate {
  font-size: 0.82rem;
  font-style: italic;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  padding: 7px 0;
  cursor: default;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.tut-gate::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  animation: tut-gate-blink 1.1s ease-in-out infinite;
}
@keyframes tut-gate-blink { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.tut-gate.passed {
  font-style: normal;
  font-weight: 600;
  color: #166534;
}
.tut-gate.passed::before { animation: none; background: #16a34a; }

/* Quick attention pulse on the highlighted target (e.g. when a user clicks the
   status line instead of the real control). */
.tut-spotlight-pulse { animation: tut-spotlight-pulse 0.6s ease-out 2; }
@keyframes tut-spotlight-pulse {
  0%   { box-shadow: 0 0 0 3px var(--red), 0 0 0 6px rgba(192, 57, 43, 0.25); }
  50%  { box-shadow: 0 0 0 5px var(--red), 0 0 0 12px rgba(192, 57, 43, 0.45); }
  100% { box-shadow: 0 0 0 3px var(--red), 0 0 0 6px rgba(192, 57, 43, 0.25); }
}

.tut-cta {
  display: inline-block;
  margin-top: 4px;
  background: var(--red);
  color: var(--white) !important;
  text-decoration: none;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
}
.tut-cta:hover { filter: brightness(1.08); }
