/* ==========================================================
   MT Agent — Onboarding Tour Styles
   eToro-style guided tour with spotlight + pulse animations
   Uses dashboard CSS variables for consistent theming.
   ========================================================== */

/* ===== Overlay (dim background) ===== */
.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: auto;
}
.tour-overlay.tour-visible {
  opacity: 1;
}

/* ===== Spotlight (cutout around target) ===== */
.tour-spotlight {
  position: fixed;
  border-radius: 8px;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.25),
    0 0 0 4px rgba(240, 180, 41, 0.25),
    0 0 30px rgba(240, 180, 41, 0.5);
  z-index: 10001;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid var(--gold2, #f0b429);
}
.tour-spotlight.tour-pulse {
  animation: tour-pulse 2s ease-in-out infinite;
}
@keyframes tour-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 9999px rgba(0, 0, 0, 0.25),
      0 0 0 4px rgba(240, 180, 41, 0.25),
      0 0 30px rgba(240, 180, 41, 0.5);
  }
  50% {
    box-shadow:
      0 0 0 9999px rgba(0, 0, 0, 0.25),
      0 0 0 10px rgba(240, 180, 41, 0.05),
      0 0 45px rgba(240, 180, 41, 0.7);
  }
}

/* ===== Tooltip card (step content) ===== */
.tour-card {
  position: fixed;
  background: var(--bg1, #161b26);
  border: 1px solid var(--border2, #3a4a63);
  border-radius: 12px;
  box-shadow: var(--shadow, 0 4px 24px rgba(0, 0, 0, 0.4));
  width: 380px;
  max-width: calc(100vw - 32px);
  z-index: 10002;
  color: var(--text, #cbd5e1);
  font-family: var(--sans, 'DM Sans', sans-serif);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.tour-card.tour-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Card placement variants (positioning handled by JS, arrow via class) */
.tour-card.tour-card-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% + 8px));
}
.tour-card.tour-card-center.tour-visible {
  transform: translate(-50%, -50%);
}

/* ===== Card internals ===== */
.tour-card-body {
  padding: 22px 24px 16px;
}
.tour-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--bright, #f1f5f9);
  margin: 0 0 10px;
  line-height: 1.3;
}
.tour-card-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text, #cbd5e1);
  margin: 0 0 4px;
  white-space: pre-line;
}

/* ===== Progress dots ===== */
.tour-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 14px 24px 4px;
}
.tour-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border2, #3a4a63);
  transition: all 0.25s ease;
}
.tour-dot.tour-dot-active {
  background: var(--gold2, #f0b429);
  width: 20px;
  border-radius: 3px;
}
.tour-dot.tour-dot-done {
  background: var(--gold, #d49000);
}

/* ===== Footer (buttons) ===== */
.tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px 20px;
  gap: 8px;
}
.tour-step-indicator {
  font-size: 12px;
  color: var(--text3, #64748b);
  font-family: var(--mono, monospace);
}
.tour-actions {
  display: flex;
  gap: 8px;
}

.tour-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  font-family: inherit;
}
.tour-btn-primary {
  background: var(--gold, #d49000);
  color: #fff;
  border-color: var(--gold, #d49000);
}
.tour-btn-primary:hover {
  background: var(--gold2, #f0b429);
  border-color: var(--gold2, #f0b429);
}
.tour-btn-secondary {
  background: transparent;
  color: var(--text2, #94a3b8);
  border-color: var(--border2, #3a4a63);
}
.tour-btn-secondary:hover {
  color: var(--bright, #f1f5f9);
  border-color: var(--text2, #94a3b8);
}
.tour-btn-ghost {
  background: transparent;
  color: var(--text3, #64748b);
  border-color: transparent;
  padding: 8px 12px;
}
.tour-btn-ghost:hover {
  color: var(--text, #cbd5e1);
}

/* ===== Close (X) button ===== */
.tour-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text3, #64748b);
  font-size: 18px;
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.tour-close:hover {
  background: var(--bg3, #252d3d);
  color: var(--bright, #f1f5f9);
}

/* ===== Welcome/CTA step (no target, center modal) ===== */
.tour-card-welcome .tour-card-body {
  text-align: center;
  padding: 32px 28px 20px;
}
.tour-card-welcome .tour-card-title {
  font-size: 22px;
  margin-bottom: 12px;
}
.tour-card-welcome .tour-card-desc {
  font-size: 15px;
}

/* ===== Restart (?) floating button — shown after tour completion ===== */
.tour-restart-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg2, #1e2535);
  border: 1px solid var(--border2, #3a4a63);
  color: var(--text2, #94a3b8);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow, 0 4px 24px rgba(0, 0, 0, 0.4));
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0.7;
}
.tour-restart-fab {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.tour-restart-fab:hover {
  opacity: 1;
  color: var(--gold2, #f0b429);
  border-color: var(--gold2, #f0b429);
  transform: scale(1.08);
}
.tour-restart-fab.tour-fab-dragging {
  cursor: grabbing !important;
  transform: scale(1.12);
  opacity: 1;
  transition: none;
}
.tour-restart-fab[hidden] {
  display: none;
}

/* Tooltip for restart button */
.tour-restart-fab::before {
  content: attr(data-tooltip);
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 10px;
  padding: 6px 10px;
  background: var(--bg1, #161b26);
  border: 1px solid var(--border2, #3a4a63);
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--text, #cbd5e1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.tour-restart-fab:hover::before {
  opacity: 1;
}

/* ===== Skip confirm dialog ===== */
.tour-confirm {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg1, #161b26);
  border: 1px solid var(--border2, #3a4a63);
  border-radius: 12px;
  box-shadow: var(--shadow, 0 4px 24px rgba(0, 0, 0, 0.4));
  padding: 24px 28px;
  z-index: 10003;
  width: 320px;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.tour-confirm-msg {
  color: var(--bright, #f1f5f9);
  font-size: 15px;
  margin: 0 0 18px;
  line-height: 1.5;
}
.tour-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* ===== Finale celebration (Step 8 CTA) ===== */
.tour-card-finale .tour-card-title::before {
  content: "🎉 ";
}
.tour-card-finale .tour-card-body {
  padding: 28px 28px 20px;
  text-align: center;
}

/* ===== Mobile adjustments ===== */
@media (max-width: 640px) {
  .tour-card {
    width: calc(100vw - 24px);
    max-width: 380px;
  }
  .tour-card-body {
    padding: 18px 20px 12px;
  }
  .tour-card-title {
    font-size: 16px;
  }
  .tour-card-desc {
    font-size: 13.5px;
  }
  .tour-footer {
    padding: 10px 20px 16px;
    flex-wrap: wrap;
  }
  .tour-step-indicator {
    width: 100%;
    text-align: center;
    margin-bottom: 6px;
  }
  .tour-actions {
    width: 100%;
    justify-content: space-between;
  }
  .tour-restart-fab {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}

/* ===== Reduced motion support ===== */
@media (prefers-reduced-motion: reduce) {
  .tour-overlay,
  .tour-card,
  .tour-spotlight,
  .tour-dot,
  .tour-btn,
  .tour-restart-fab {
    transition: none !important;
  }
  .tour-spotlight.tour-pulse {
    animation: none !important;
  }
}

/* ===== Body scroll lock while tour active ===== */
body.tour-active {
  overflow: hidden;
}
