/**
 * MYPEAS Onboarding Tour Styles
 *
 * Progressive onboarding system with spotlight overlays
 * and contextual tooltips for profile pages.
 */

/* ============================================================================
   CSS Variables
   ============================================================================ */
:root {
  --tour-overlay-bg: rgba(0, 0, 0, 0.4);
  --tour-spotlight-padding: 8px;
  --tour-spotlight-radius: 12px;
  --tour-tooltip-bg: #ffffff;
  --tour-tooltip-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
  --tour-tooltip-radius: 12px;
  --tour-primary: #1bb978;
  --tour-primary-hover: #0e8856;
  --tour-text: #1e293b;
  --tour-text-secondary: #64748b;
  --tour-z-overlay: 10000;
  --tour-z-spotlight: 10001;
  --tour-z-tooltip: 10002;
}

/* ============================================================================
   Overlay - darkens the entire page
   ============================================================================ */
.tour-overlay {
  position: fixed;
  inset: 0;
  background: var(--tour-overlay-bg);
  z-index: var(--tour-z-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tour-overlay--active {
  opacity: 1;
  visibility: visible;
}

/* ============================================================================
   Spotlight - highlights the target element
   ============================================================================ */
.tour-spotlight {
  position: absolute;
  z-index: var(--tour-z-spotlight);
  pointer-events: none;
  border-radius: var(--tour-spotlight-radius);
  box-shadow: 0 0 0 9999px var(--tour-overlay-bg);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pulse animation for emphasis */
.tour-spotlight--pulse {
  animation: tour-pulse 2s ease-in-out infinite;
}

@keyframes tour-pulse {
  0%, 100% {
    box-shadow: 0 0 0 9999px var(--tour-overlay-bg), 0 0 0 0 rgba(27, 185, 120, 0.4);
  }
  50% {
    box-shadow: 0 0 0 9999px var(--tour-overlay-bg), 0 0 0 8px rgba(27, 185, 120, 0.2);
  }
}

/* ============================================================================
   Tooltip - explanatory callout
   ============================================================================ */
.tour-tooltip {
  position: absolute;
  z-index: var(--tour-z-tooltip);
  background: var(--tour-tooltip-bg);
  border-radius: var(--tour-tooltip-radius);
  box-shadow: var(--tour-tooltip-shadow);
  padding: 20px 24px;
  max-width: 340px;
  min-width: 280px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.tour-tooltip--active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Tooltip arrow */
.tour-tooltip::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--tour-tooltip-bg);
  transform: rotate(45deg);
  box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.04);
}

/* Arrow positions */
.tour-tooltip--top::before {
  bottom: -8px;
  left: 50%;
  margin-left: -8px;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.04);
}

.tour-tooltip--bottom::before {
  top: -8px;
  left: 50%;
  margin-left: -8px;
}

.tour-tooltip--left::before {
  right: -8px;
  top: 50%;
  margin-top: -8px;
  box-shadow: 2px -2px 4px rgba(0, 0, 0, 0.04);
}

.tour-tooltip--right::before {
  left: -8px;
  top: 50%;
  margin-top: -8px;
}

/* ============================================================================
   Tooltip Content
   ============================================================================ */
.tour-tooltip__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tour-tooltip__step-indicator {
  font-size: 12px;
  font-weight: 600;
  color: var(--tour-primary);
  background: rgba(27, 185, 120, 0.1);
  padding: 4px 10px;
  border-radius: 12px;
}

.tour-tooltip__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--tour-text-secondary);
  font-size: 18px;
  line-height: 1;
  transition: color 0.2s ease;
}

.tour-tooltip__close:hover {
  color: var(--tour-text);
}

.tour-tooltip__content {
  color: var(--tour-text);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ============================================================================
   Tooltip Actions
   ============================================================================ */
.tour-tooltip__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tour-tooltip__skip {
  background: none;
  border: none;
  color: var(--tour-text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.2s ease;
}

.tour-tooltip__skip:hover {
  color: var(--tour-text);
}

.tour-tooltip__nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tour-tooltip__btn {
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tour-tooltip__btn--prev {
  background: #f1f5f9;
  color: var(--tour-text);
}

.tour-tooltip__btn--prev:hover {
  background: #e2e8f0;
}

.tour-tooltip__btn--next {
  background: var(--tour-primary);
  color: #ffffff;
}

.tour-tooltip__btn--next:hover {
  background: var(--tour-primary-hover);
}

.tour-tooltip__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================================
   Progress Dots
   ============================================================================ */
.tour-tooltip__progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.tour-tooltip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e2e8f0;
  transition: all 0.2s ease;
}

.tour-tooltip__dot--active {
  background: var(--tour-primary);
  transform: scale(1.2);
}

.tour-tooltip__dot--completed {
  background: var(--tour-primary);
}

/* ============================================================================
   Highlighted Element State
   ============================================================================ */
.tour-highlight {
  position: relative;
  z-index: var(--tour-z-spotlight) !important;
  pointer-events: auto !important;
}

/* ============================================================================
   Track Impact Button Pulse (always-on for Tour 3)
   ============================================================================ */
.tour-track-impact-pulse {
  animation: track-impact-pulse 2s ease-in-out infinite;
  position: relative;
}

.tour-track-impact-pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid var(--tour-primary);
  animation: track-impact-ring 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes track-impact-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(27, 185, 120, 0.4);
  }
  50% {
    box-shadow: 0 0 12px 4px rgba(27, 185, 120, 0.3);
  }
}

@keyframes track-impact-ring {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.05);
  }
}

/* ============================================================================
   Mobile Responsive
   ============================================================================ */
@media (max-width: 768px) {
  .tour-tooltip {
    max-width: calc(100vw - 32px);
    min-width: 260px;
    padding: 16px 20px;
  }

  .tour-tooltip__content {
    font-size: 14px;
  }

  .tour-tooltip__actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .tour-tooltip__skip {
    width: 100%;
    text-align: center;
    padding: 8px;
  }

  .tour-tooltip__nav {
    width: 100%;
  }

  .tour-tooltip__btn {
    flex: 1;
    text-align: center;
  }
}

/* ============================================================================
   Reduced Motion
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  .tour-overlay,
  .tour-spotlight,
  .tour-tooltip,
  .tour-tooltip__dot {
    transition: none;
  }

  .tour-spotlight--pulse,
  .tour-track-impact-pulse,
  .tour-track-impact-pulse::after {
    animation: none;
  }
}
