/* ══════════════════════════════════════════════════════════════════
   COACH MARKS — first-visit guided tour, one per page
   A spotlight cutout over the anchor element plus a speech bubble.
   Tap anywhere to advance; the last step ends the tour.
   Driven by scripts/features/coach-marks.js.
   ══════════════════════════════════════════════════════════════════ */

.ims-coach {
  position: fixed;
  inset: 0;
  z-index: 9500;          /* under the auth modal + toasts, over page content */
  opacity: 0;
  transition: opacity 0.28s ease;
}
.ims-coach.is-open { opacity: 1; }
/* While fading out (and before fading in) the overlay must not swallow taps —
   otherwise the click that dismissed it eats the next one too. */
.ims-coach:not(.is-open) { pointer-events: none; }

/* The dimmer. A single element whose enormous spread shadow paints everything
   outside its own box — that box is the hole, sitting over the anchor. */
.ims-coach-spot {
  position: absolute;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(3, 8, 18, 0.78);
  transition: top 0.32s cubic-bezier(0.22, 1, 0.36, 1),
              left 0.32s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
              height 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
/* Ring around the cutout so the highlighted control reads as "this one". */
.ims-coach-spot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 19px;
  border: 2px solid rgba(53, 200, 255, 0.85);
  box-shadow: 0 0 18px rgba(53, 200, 255, 0.45);
  pointer-events: none;
}
/* Steps with no anchor dim the whole screen and centre the bubble. */
.ims-coach.is-centred .ims-coach-spot { display: none; }
.ims-coach.is-centred::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 18, 0.78);
}

/* ── The bubble ────────────────────────────────────────────────── */
.ims-coach-bubble {
  position: absolute;
  z-index: 2;
  width: min(310px, calc(100vw - 2.5rem));
  padding: 0.9rem 1rem 0.8rem;
  border-radius: 16px;
  border: 1px solid rgba(53, 200, 255, 0.3);
  background: linear-gradient(155deg, rgba(12, 28, 54, 0.98), rgba(7, 16, 34, 0.98));
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.62);
  font-family: 'DM Sans', sans-serif;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.ims-coach.is-centred .ims-coach-bubble {
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%);
}
.ims-coach-bubble.is-swapping { opacity: 0; transform: translateY(6px); }
.ims-coach.is-centred .ims-coach-bubble.is-swapping { transform: translate(-50%, -46%); }

/* Arrow, pointed at the anchor. Hidden on centred steps. */
.ims-coach-arrow {
  position: absolute;
  width: 14px; height: 14px;
  background: rgba(10, 24, 46, 0.99);
  border-left: 1px solid rgba(53, 200, 255, 0.3);
  border-top: 1px solid rgba(53, 200, 255, 0.3);
  transform: rotate(45deg);
}
.ims-coach-bubble[data-side="bottom"] .ims-coach-arrow { top: -8px; }
.ims-coach-bubble[data-side="top"]    .ims-coach-arrow { bottom: -8px; transform: rotate(225deg); }
.ims-coach.is-centred .ims-coach-arrow { display: none; }

.ims-coach-title {
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.25;
  color: #eaf3ff;
  margin: 0 0 0.3rem;
}
.ims-coach-body {
  font-size: 0.79rem;
  line-height: 1.5;
  color: rgba(165, 200, 240, 0.82);
  margin: 0;
}

.ims-coach-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.8rem;
}
.ims-coach-dots { display: flex; gap: 0.28rem; }
.ims-coach-dots span {
  width: 5px; height: 5px;
  border-radius: 99px;
  background: rgba(150, 190, 240, 0.28);
  transition: width 0.25s ease, background 0.25s ease;
}
.ims-coach-dots span.is-on { width: 14px; background: #35C8FF; }

.ims-coach-next {
  border: 1px solid rgba(53, 200, 255, 0.42);
  background: rgba(53, 200, 255, 0.14);
  color: #bfe6ff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.34rem 0.85rem;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.18s ease;
}
.ims-coach-next:hover { background: rgba(53, 200, 255, 0.24); }
.ims-coach-next:focus-visible { outline: 2px solid #35C8FF; outline-offset: 2px; }

.ims-coach-skip {
  position: absolute;
  top: 0.45rem; right: 0.55rem;
  border: 0; background: none;
  color: rgba(150, 190, 240, 0.5);
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.25rem 0.3rem;
  cursor: pointer;
  border-radius: 6px;
}
.ims-coach-skip:hover { color: rgba(190, 225, 255, 0.9); }
.ims-coach-skip:focus-visible { outline: 2px solid #35C8FF; outline-offset: 1px; }

@media (prefers-reduced-motion: reduce) {
  .ims-coach,
  .ims-coach-spot,
  .ims-coach-bubble { transition: none; }
}
