/* =============================================================================
   First-run interactive tour — spotlight overlay + tooltip card
   Uses --primary-color (#4FB6C2) for the highlight ring + primary buttons.
   ============================================================================= */

.tour-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: auto;
  /* No background here — the dimming is done by the spotlight's giant
     box-shadow so we can punch a transparent hole through it. */
  background: transparent;
}

/* Hole around the highlighted element. Position/size set inline by JS.
   The huge box-shadow creates the dimmed area outside the hole. */
.tour-spotlight {
  position: fixed;
  z-index: 9001;
  border-radius: 12px;
  background: transparent;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.62);
  outline: 2px solid var(--primary-color);
  outline-offset: 4px;
  transition: top 0.25s ease, left 0.25s ease,
              width 0.25s ease, height 0.25s ease;
  pointer-events: none;
}

/* Centered "no target" mode — full-screen dim, no hole. */
.tour-spotlight.tour-spotlight-centered {
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  outline: none;
  /* shadow still dims the whole viewport */
}

/* Tooltip card */
.tour-card {
  position: fixed;
  z-index: 9002;
  width: min(360px, calc(100vw - 32px));
  background: var(--surface-elevated, #fff);
  color: var(--text-primary, #0f172a);
  border: 1px solid var(--border-color, rgba(15, 23, 42, 0.1));
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  padding: 18px 18px 14px;
  transition: top 0.2s ease, left 0.2s ease;
}

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

.tour-card-step {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 1;
}

.tour-card-close {
  border: none;
  background: transparent;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.tour-card-close:hover {
  background: var(--surface, #f8f9fb);
  color: var(--text-primary, #0f172a);
}

.tour-card-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.3;
}

.tour-card-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary, #475569);
  margin: 0 0 16px;
}

/* Progress dots get their own row above the action buttons so the
   Next button can never get pushed off the card by a long step list. */
.tour-card-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  max-height: 48px;
  overflow-y: auto;
}

.tour-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.tour-card-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border-color, rgba(15, 23, 42, 0.18));
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  font: inherit;
  flex: 0 0 auto;
}
.tour-card-dot:hover {
  background: var(--primary-hover, #3A9BA6);
  transform: scale(1.2);
}
.tour-card-dot.active {
  background: var(--primary-color);
  transform: scale(1.3);
}
.tour-card-dot:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.tour-card-btn {
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background 0.15s ease, transform 0.05s ease;
  font-family: inherit;
}
.tour-card-btn:active { transform: scale(0.97); }

.tour-card-btn-ghost {
  background: transparent;
  color: var(--text-secondary, #64748b);
}
.tour-card-btn-ghost:hover {
  background: var(--surface, #f8f9fb);
  color: var(--text-primary, #0f172a);
}

.tour-card-btn-secondary {
  background: var(--surface, #f8f9fb);
  color: var(--text-primary, #0f172a);
}
.tour-card-btn-secondary:hover {
  background: var(--border-color, rgba(15, 23, 42, 0.08));
}

.tour-card-btn-primary {
  background: var(--primary-color);
  color: #fff;
}
.tour-card-btn-primary:hover {
  background: var(--primary-hover, #3A9BA6);
}

/* Arrow on the card pointing toward the highlighted element. */
.tour-card-arrow {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--surface-elevated, #fff);
  border: 1px solid var(--border-color, rgba(15, 23, 42, 0.1));
  transform: rotate(45deg);
}
.tour-card[data-placement="top"] .tour-card-arrow {
  bottom: -8px; left: 50%; margin-left: -7px;
  border-top: none; border-left: none;
}
.tour-card[data-placement="bottom"] .tour-card-arrow {
  top: -8px; left: 50%; margin-left: -7px;
  border-bottom: none; border-right: none;
}
.tour-card[data-placement="left"] .tour-card-arrow {
  right: -8px; top: 50%; margin-top: -7px;
  border-left: none; border-bottom: none;
}
.tour-card[data-placement="right"] .tour-card-arrow {
  left: -8px; top: 50%; margin-top: -7px;
  border-right: none; border-top: none;
}
.tour-card[data-placement="center"] .tour-card-arrow {
  display: none;
}

/* Mobile (small screens): the card is positioned by JS just like desktop,
   but constrained to full available width minus margins so it always fits. */
@media (max-width: 768px) {
  .tour-card {
    width: calc(100vw - 24px);
    max-width: 420px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 14px 14px 12px;
  }
  .tour-card-title { font-size: 16px; }
  .tour-card-body { font-size: 13px; margin-bottom: 12px; }
  .tour-card-progress { max-height: 36px; margin-bottom: 10px; }
  .tour-card-btn { padding: 7px 12px; font-size: 13px; }
  .tour-card-arrow { display: none !important; }
  /* Centered "no target" mode still works via the JS-set inline transform. */
  .tour-spotlight.tour-spotlight-centered {
    outline: none;
  }
}

/* Extra-narrow phones — shrink dots so even ~20-step Pro tours fit. */
@media (max-width: 380px) {
  .tour-card-dot { width: 6px; height: 6px; }
  .tour-card-progress { gap: 4px; }
}

/* iOS / Capacitor — respect safe areas so the card and buttons stay
   above the home indicator and below the notch. */
html.ios-app .tour-card,
html.capacitor .tour-card {
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 32px);
  overflow-y: auto;
}
