/* ═══════════════════════════════════════════════════════════
   Tour — guided tour styling (R8)
   ═══════════════════════════════════════════════════════════ */

/* Backdrop — covers viewport, blocks pointer events except spotlight/tooltip */
.tour-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 10000;
  pointer-events: none; /* clicks handled by capture-phase listener */
  animation: tourFadeIn 0.25s ease;
}
@keyframes tourFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Spotlight — single-element technique using huge box-shadow */
.tour-spotlight {
  position: relative;
  z-index: 10001 !important;
  box-shadow:
    0 0 0 4px rgba(20, 184, 166, 0.85),
    0 0 0 9999px rgba(15, 23, 42, 0.55) !important;
  border-radius: 6px !important;
  transition: box-shadow 0.2s ease;
}

/* When tour is active, kill text selection on body to avoid distraction */
body.tour-active {
  -webkit-user-select: none;
  user-select: none;
}

/* Tooltip popup */
.tour-tooltip {
  position: fixed;
  z-index: 10002;
  background: #fff;
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  padding: 18px 20px;
  max-width: 380px;
  min-width: 280px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-800, #1E293B);
  -webkit-user-select: text;
  user-select: text;
  animation: tourTooltipIn 0.2s ease;
}
@keyframes tourTooltipIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tour-tooltip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--gray-500, #64748B);
  margin-bottom: 8px;
  font-weight: 500;
}
.tour-actor {
  background: var(--teal-light, #CCFBF1);
  color: var(--teal-dark, #0D9488);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
}
.tour-progress {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.tour-tooltip-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--gray-900, #0F172A);
}
.tour-tooltip-body {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--gray-700, #334155);
}
.tour-tooltip-hint {
  font-size: 12px;
  background: var(--amber-light, #FEF3C7);
  color: #78350F;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.tour-tooltip-controls {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.tour-btn {
  background: #fff;
  border: 1px solid var(--gray-300, #CBD5E1);
  color: var(--gray-700, #334155);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.tour-btn:hover { background: var(--gray-100, #F1F5F9); }
.tour-btn-next {
  background: var(--teal, #14B8A6);
  color: #fff;
  border-color: var(--teal, #14B8A6);
}
.tour-btn-next:hover { background: var(--teal-dark, #0D9488); border-color: var(--teal-dark, #0D9488); }
.tour-btn-exit {
  margin-right: auto;
  color: var(--gray-500, #64748B);
}

/* Shake animation for off-target click feedback */
.tour-shake {
  animation: tourShake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes tourShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

/* Toast — transient feedback */
.tour-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900, #0F172A);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 10003;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  animation: tourToastIn 0.2s ease, tourToastOut 0.3s ease 1.7s forwards;
}
@keyframes tourToastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes tourToastOut { to { opacity: 0; transform: translate(-50%, -10px); } }

/* Completion modal */
.tour-completion-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10010;
  animation: tourFadeIn 0.25s ease;
}
.tour-completion-card {
  background: #fff;
  border-radius: var(--radius-xl, 16px);
  padding: 36px 40px;
  text-align: center;
  max-width: 440px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}
.tour-completion-icon {
  font-size: 56px;
  margin-bottom: 12px;
}
.tour-completion-card h2 {
  font-size: 22px;
  margin-bottom: 10px;
  color: var(--gray-900, #0F172A);
}
.tour-completion-card p {
  color: var(--gray-700, #334155);
  margin-bottom: 8px;
}
.tour-completion-meta {
  font-size: 12px;
  color: var(--gray-500, #64748B) !important;
  margin-bottom: 20px !important;
}

/* Tour launcher button (header) */
.tour-launcher-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--teal, #14B8A6), var(--teal-dark, #0D9488));
  color: #fff;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  margin-right: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.tour-launcher-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(20, 184, 166, 0.35);
}
.tour-badge-new {
  background: #fff;
  color: var(--teal-dark, #0D9488);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  margin-left: 4px;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .tour-tooltip {
    left: 12px !important;
    right: 12px !important;
    max-width: none;
    bottom: 12px !important;
    top: auto !important;
  }
  .tour-launcher-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
}
