/* Onboarding Tour Styles - Family Finance Tracker */
/* Interactive guided tour for new users */

/* ============================================
   OVERLAY AND SPOTLIGHT
   ============================================ */

.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 9998;
  pointer-events: none;
  transition: background var(--duration-normal) var(--ease-standard);
}

.tour-overlay--active {
  background: rgba(0, 0, 0, 0.75);
  pointer-events: auto;
}

.tour-spotlight {
  position: fixed;
  border-radius: var(--radius-lg);
  z-index: 9999;
  pointer-events: none;
  transition: all 0.4s var(--ease-standard);
  background: transparent;
  display: none;
  /* Visible glowing border to highlight the target element */
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.75),
    0 0 0 3px rgba(33, 128, 141, 0.8),
    0 0 20px rgba(33, 128, 141, 0.4),
    0 0 40px rgba(33, 128, 141, 0.2);
}

/* Spotlight appearance animation */
.tour-spotlight--visible {
  animation: spotlightAppear 0.3s ease-out;
}

@keyframes spotlightAppear {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.tour-spotlight--pulse {
  animation: spotlightPulse 2s ease-in-out infinite;
}

@keyframes spotlightPulse {
  0%, 100% {
    box-shadow:
      0 0 0 9999px rgba(0, 0, 0, 0.75),
      0 0 0 3px rgba(33, 128, 141, 0.8),
      0 0 20px rgba(33, 128, 141, 0.4),
      0 0 40px rgba(33, 128, 141, 0.2);
  }
  50% {
    box-shadow:
      0 0 0 9999px rgba(0, 0, 0, 0.75),
      0 0 0 5px rgba(33, 128, 141, 1),
      0 0 30px rgba(33, 128, 141, 0.6),
      0 0 60px rgba(33, 128, 141, 0.3);
  }
}

/* ============================================
   TOOLTIP
   ============================================ */

.tour-tooltip {
  position: fixed;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-28);
  max-width: 420px;
  min-width: 320px;
  z-index: 10000;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 30px rgba(33, 128, 141, 0.15);
  border: 1px solid rgba(33, 128, 141, 0.2);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.3s var(--ease-standard),
              transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.tour-tooltip__arrow {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  transform: rotate(45deg);
  z-index: -1;
}

/* Arrow positions */
.tour-tooltip[data-position="bottom"] .tour-tooltip__arrow {
  top: -9px;
  left: 50%;
  margin-left: -8px;
  border-right: none;
  border-bottom: none;
}

.tour-tooltip[data-position="top"] .tour-tooltip__arrow {
  bottom: -9px;
  left: 50%;
  margin-left: -8px;
  border-left: none;
  border-top: none;
}

.tour-tooltip[data-position="left"] .tour-tooltip__arrow {
  right: -9px;
  top: 50%;
  margin-top: -8px;
  border-left: none;
  border-bottom: none;
}

.tour-tooltip[data-position="right"] .tour-tooltip__arrow {
  left: -9px;
  top: 50%;
  margin-top: -8px;
  border-right: none;
  border-top: none;
}

.tour-tooltip__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-teal-400));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-20);
  box-shadow:
    0 4px 12px rgba(33, 128, 141, 0.3),
    0 0 20px rgba(33, 128, 141, 0.2);
  flex-shrink: 0;
}

.tour-tooltip__icon i {
  font-size: var(--font-size-2xl);
  color: white;
}

.tour-tooltip__title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin: 0 0 var(--space-8) 0;
  line-height: var(--line-height-tight);
}

.tour-tooltip__content {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-20) 0;
  line-height: var(--line-height-normal);
}

.tour-tooltip__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-16);
}

.tour-tooltip__hints {
  display: flex;
  gap: var(--space-12);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin-top: var(--space-16);
  padding-top: var(--space-12);
  border-top: 1px solid var(--color-border);
}

.tour-tooltip__hint {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.tour-tooltip__hint kbd {
  background: var(--color-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-family: var(--font-family-mono);
  font-size: 10px;
}

/* ============================================
   PROGRESS DOTS
   ============================================ */

.tour-progress {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.tour-progress__counter {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin-right: var(--space-8);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.tour-progress__dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tour-progress__dot--active {
  background: var(--color-primary);
  transform: scale(1.3);
  box-shadow: 0 0 0 3px rgba(33, 128, 141, 0.2);
}

.tour-progress__dot--completed {
  background: var(--color-success);
  transform: scale(1);
}

/* ============================================
   NAVIGATION BUTTONS
   ============================================ */

.tour-buttons {
  display: flex;
  gap: var(--space-8);
  align-items: center;
}

.tour-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-18);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
  border: none;
  gap: var(--space-6);
}

.tour-btn--primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-teal-500));
  color: var(--color-btn-primary-text);
}

.tour-btn--primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(33, 128, 141, 0.3);
}

.tour-btn--secondary {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.tour-btn--secondary:hover {
  background: var(--color-secondary);
  color: var(--color-text);
}

.tour-btn--skip {
  background: transparent;
  color: var(--color-text-secondary);
  padding: var(--space-8);
  opacity: 0.7;
}

.tour-btn--skip:hover {
  color: var(--color-text);
  opacity: 1;
}

/* ============================================
   WELCOME MODAL
   ============================================ */

.tour-welcome {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease-standard),
              visibility 0.4s var(--ease-standard);
}

.tour-welcome--visible {
  opacity: 1;
  visibility: visible;
}

.tour-welcome__content {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-40);
  max-width: 500px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-card-border);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.tour-welcome__content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-teal-300), var(--color-primary));
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.tour-welcome--visible .tour-welcome__content {
  transform: scale(1) translateY(0);
}

.tour-welcome__icon {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-teal-400) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-28);
  box-shadow:
    0 10px 40px -10px rgba(33, 128, 141, 0.5),
    inset 0 2px 0 0 rgba(255, 255, 255, 0.2);
  position: relative;
}

.tour-welcome__icon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-teal-400));
  opacity: 0.3;
  filter: blur(12px);
  z-index: -1;
  animation: iconGlow 2s ease-in-out infinite alternate;
}

@keyframes iconGlow {
  0% { opacity: 0.3; transform: scale(1); }
  100% { opacity: 0.5; transform: scale(1.05); }
}

.tour-welcome__icon i {
  font-size: 40px;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tour-welcome__title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin: 0 0 var(--space-12) 0;
}

.tour-welcome__subtitle {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-24) 0;
  line-height: var(--line-height-normal);
}

.tour-welcome__features {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  margin-bottom: var(--space-28);
  text-align: left;
}

.tour-welcome__feature {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

.tour-welcome__feature i {
  color: var(--color-success);
  font-size: var(--font-size-base);
}

.tour-welcome__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.tour-welcome__actions .tour-btn {
  width: 100%;
  padding: var(--space-14) var(--space-24);
  font-size: var(--font-size-base);
}

/* ============================================
   COMPLETE MODAL
   ============================================ */

.tour-complete {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease-standard),
              visibility 0.4s var(--ease-standard);
}

.tour-complete--visible {
  opacity: 1;
  visibility: visible;
}

.tour-complete__content {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-40);
  max-width: 500px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-card-border);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.tour-complete__content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-success), #34d399, var(--color-success));
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}

.tour-complete--visible .tour-complete__content {
  transform: scale(1) translateY(0);
}

.tour-complete__icon {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-success) 0%, #34d399 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-28);
  box-shadow:
    0 10px 40px -10px rgba(16, 185, 129, 0.5),
    inset 0 2px 0 0 rgba(255, 255, 255, 0.2);
  position: relative;
}

.tour-complete__icon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-success), #34d399);
  opacity: 0.3;
  filter: blur(12px);
  z-index: -1;
  animation: iconGlow 2s ease-in-out infinite alternate;
}

@keyframes successPop {
  0% { transform: scale(0) rotate(-45deg); }
  50% { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.tour-complete__icon i {
  font-size: 40px;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  animation: successPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tour-complete__title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin: 0 0 var(--space-12) 0;
}

.tour-complete__subtitle {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-24) 0;
  line-height: var(--line-height-normal);
}

.tour-complete__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.tour-complete__actions .tour-btn {
  width: 100%;
  padding: var(--space-14) var(--space-24);
  font-size: var(--font-size-base);
}

/* ============================================
   HELP BUTTON (Replay Tour)
   ============================================ */

.tour-help-btn {
  position: fixed;
  bottom: calc(var(--space-24) + env(safe-area-inset-bottom));
  left: calc(var(--space-24) + env(safe-area-inset-left));
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-teal-400));
  color: white;
  border: none;
  box-shadow:
    0 8px 24px rgba(33, 128, 141, 0.4),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 998;
  transition: all var(--duration-normal) var(--ease-standard);
}

.tour-help-btn:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow:
    0 12px 32px rgba(33, 128, 141, 0.5),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

.tour-help-btn:active {
  transform: scale(0.95);
}

.tour-help-btn i {
  font-size: var(--font-size-xl);
}

/* Hide when tour is active */
.tour-overlay--active ~ .tour-help-btn {
  display: none;
}

/* ============================================
   MOBILE ADAPTATIONS
   ============================================ */

@media (max-width: 768px) {
  .tour-tooltip {
    max-width: calc(100vw - 32px);
    min-width: auto;
    padding: var(--space-20);
  }

  .tour-tooltip__title {
    font-size: var(--font-size-base);
  }

  .tour-tooltip__content {
    font-size: var(--font-size-sm);
  }

  .tour-tooltip__actions {
    flex-direction: column;
    gap: var(--space-12);
  }

  .tour-tooltip__hints {
    display: none;
  }

  .tour-progress {
    justify-content: center;
    width: 100%;
  }

  .tour-buttons {
    width: 100%;
    justify-content: space-between;
  }

  .tour-welcome__content,
  .tour-complete__content {
    padding: var(--space-28);
    margin: var(--space-16);
  }

  .tour-welcome__icon,
  .tour-complete__icon {
    width: 72px;
    height: 72px;
  }

  .tour-welcome__icon i,
  .tour-complete__icon i {
    font-size: 32px;
  }

  .tour-welcome__title,
  .tour-complete__title {
    font-size: var(--font-size-xl);
  }

  .tour-help-btn {
    width: 48px;
    height: 48px;
    bottom: calc(var(--space-16) + env(safe-area-inset-bottom));
    left: calc(var(--space-16) + env(safe-area-inset-left));
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .tour-overlay,
  .tour-spotlight,
  .tour-tooltip,
  .tour-welcome,
  .tour-welcome__content,
  .tour-complete,
  .tour-complete__content {
    transition: none;
  }

  .tour-spotlight--pulse {
    animation: none;
  }

  .tour-complete__icon i {
    animation: none;
  }

  .tour-welcome__content::before,
  .tour-complete__content::before,
  .tour-welcome__icon::after,
  .tour-complete__icon::after {
    animation: none;
  }
}

/* ============================================
   DARK MODE ADJUSTMENTS
   ============================================ */

[data-color-scheme="dark"] .tour-spotlight {
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.85),
    0 0 0 3px rgba(50, 184, 198, 0.9),
    0 0 25px rgba(50, 184, 198, 0.5),
    0 0 50px rgba(50, 184, 198, 0.25);
}

[data-color-scheme="dark"] .tour-spotlight--pulse {
  animation-name: spotlightPulseDark;
}

[data-color-scheme="dark"] .tour-overlay--active {
  background: rgba(0, 0, 0, 0.85);
}

@keyframes spotlightPulseDark {
  0%, 100% {
    box-shadow:
      0 0 0 9999px rgba(0, 0, 0, 0.85),
      0 0 0 3px rgba(50, 184, 198, 0.9),
      0 0 25px rgba(50, 184, 198, 0.5),
      0 0 50px rgba(50, 184, 198, 0.25);
  }
  50% {
    box-shadow:
      0 0 0 9999px rgba(0, 0, 0, 0.85),
      0 0 0 5px rgba(50, 184, 198, 1),
      0 0 35px rgba(50, 184, 198, 0.6),
      0 0 70px rgba(50, 184, 198, 0.3);
  }
}
