/* Product tour (components/tour.js): a dimmed page with a rounded spotlight on the real element and a small card.
   Coordinates are physical (measured with getBoundingClientRect), so this file uses left/top on purpose. */

.tour { --tour-dim: color-mix(in srgb, var(--overlay) 76%, #000); position: fixed; inset: 0; z-index: 1000; touch-action: none; }
.tour-block { position: absolute; inset: 0; background: transparent; cursor: default; }

/* The hole: a box whose huge shadow is the dim layer. Centred steps shrink it to a point (whole page dimmed). */
.tour-hole {
  position: absolute; left: 0; top: 0; pointer-events: none;
  box-shadow: 0 0 0 200vmax var(--tour-dim);
  outline: 2px solid var(--brand); outline-offset: 0;
}
.tour-hole::after {
  content: ''; position: absolute; inset: -2px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 0 var(--brand-glow);
  animation: tour-pulse 1.8s var(--ease) infinite;
}
.tour-hole.is-none { outline-color: transparent; }
.tour-hole.is-none::after { display: none; }
@keyframes tour-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 45%, transparent); }
  70%, 100% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--brand) 0%, transparent); }
}
.tour.is-anim .tour-hole { transition: transform 360ms var(--ease), width 360ms var(--ease), height 360ms var(--ease), border-radius 360ms var(--ease), outline-color 200ms; }

/* The card */
.tour-card {
  position: absolute; left: 0; top: 0;
  width: min(360px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-radius: var(--r-xl);
  background: var(--bg-elevated); color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.tour.is-anim .tour-card { transition: transform 360ms var(--ease); }
.tour-card::before {
  content: ''; position: absolute; width: 14px; height: 14px;
  background: var(--bg-elevated); border: 0 solid var(--border);
  transform: rotate(45deg); display: none;
}
.tour-card.place-below::before { display: block; top: -8px; left: calc(var(--tour-arrow) - 7px); border-top-width: 1px; border-left-width: 1px; }
.tour-card.place-above::before { display: block; bottom: -8px; left: calc(var(--tour-arrow) - 7px); border-bottom-width: 1px; border-right-width: 1px; }
.tour-card.place-right::before { display: block; left: -8px; top: calc(var(--tour-arrow) - 7px); border-left-width: 1px; border-bottom-width: 1px; }
.tour-card.place-left::before { display: block; right: -8px; top: calc(var(--tour-arrow) - 7px); border-top-width: 1px; border-right-width: 1px; }

.tour-body { display: flex; align-items: flex-start; gap: var(--sp-4); animation: tour-in 220ms var(--ease); }
@keyframes tour-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Big icon: a teal tile with the logo's amber ribbon hanging from its top edge. */
.tour-mark {
  position: relative; flex: 0 0 auto;
  width: 56px; height: 56px; border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-strong);
}
.tour-ribbon {
  position: absolute; top: -3px; inset-inline-end: 9px; width: 10px; height: 16px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 74%, 0 100%);
  border-radius: 2px 2px 0 0;
}
.tour-mark.is-brand { background: var(--brand-softer); }
.tour-copy { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; padding-top: 2px; }
.tour-title { margin: 0; font-size: var(--fs-xl); font-weight: 800; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.tour-text { margin: 0; font-size: var(--fs-md); line-height: 1.65; color: var(--text-2); }
.tour-pro {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-xs); font-weight: 800; line-height: 1.5;
}

/* Centred cards (welcome, last step): icon on top, everything centred, a little more air. */
.tour.is-center .tour-card { padding: var(--sp-6) var(--sp-5) var(--sp-4); }
.tour.is-center .tour-body { flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); }
.tour.is-center .tour-mark { width: 72px; height: 72px; border-radius: 22px; }
.tour.is-center .tour-title { justify-content: center; font-size: var(--fs-2xl); }

/* Last step: guide + install */
.tour-links { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.tour-links.is-one { grid-template-columns: 1fr; }
.tour-link {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 76px; padding: var(--sp-3) var(--sp-2); border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--brand-strong);
  font: inherit; font-size: var(--fs-sm); font-weight: 800; text-align: center; cursor: pointer;
  transition: background var(--dur), transform 120ms var(--ease);
}
.tour-link span { color: var(--text); }
.tour-link:hover { background: var(--surface-3); }
.tour-link:active { transform: scale(.97); }

/* Progress */
.tour-progress { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.tour-dots { display: inline-flex; align-items: center; gap: 5px; }
.tour-dots i { width: 7px; height: 7px; border-radius: var(--r-pill); background: var(--border-strong); transition: width 220ms var(--ease), background 220ms; }
.tour-dots i.past { background: color-mix(in srgb, var(--brand) 45%, var(--border-strong)); }
.tour-dots i.on { width: 20px; background: var(--brand); }
.tour-count { font-size: var(--fs-sm); font-weight: 700; color: var(--text-3); white-space: nowrap; }

/* Buttons: one primary, «السابق» secondary, «تخطّي» quiet. */
.tour-actions { display: flex; align-items: center; gap: var(--sp-2); }
.tour-gap { flex: 1 1 auto; }
.tour-skip {
  min-height: 40px; padding: 0 var(--sp-2); margin-inline-start: calc(var(--sp-2) * -1);
  border-radius: var(--r-md); background: transparent; border: 0;
  font: inherit; font-size: var(--fs-sm); font-weight: 700; color: var(--text-3); cursor: pointer;
}
.tour-skip:hover { color: var(--text); background: var(--surface-2); }
.tour-next { min-width: 92px; }
.tour-card:focus { outline: none; }
.tour-card :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Replay entry points (Guide header, Settings row) */
.tour-replay {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  min-height: 52px; padding: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-4);
  border-radius: var(--r-lg); border: 1px dashed var(--border-strong); background: transparent;
  font: inherit; font-weight: 700; color: var(--text); text-align: start; cursor: pointer;
}
.tour-replay:hover { background: var(--surface-2); }
.tour-replay .tour-replay-ic { display: inline-flex; color: var(--brand); }
button.set-link-row { width: 100%; font: inherit; text-align: start; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .tour-hole::after { animation: none; }
  .tour-body { animation: none; }
  .tour.is-anim .tour-hole, .tour.is-anim .tour-card, .tour-dots i { transition: none; }
}
