/**
 * Onboarding Tutorial Styles
 *
 * Provides spotlight effect with contextual tooltips
 * for guiding first-time users through the app.
 */

/* Overlay backdrop */
.onboarding-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
  /* Prevent CLS by not affecting layout */
  contain: layout style paint;
  will-change: opacity;
}

.onboarding-overlay.fade-out {
  opacity: 0;
}

/* Spotlight highlight */
.onboarding-spotlight {
  position: absolute;
  border: 3px solid #00D9FF;  /* Cyan accent */
  border-radius: 8px;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.75),  /* Dim everything outside */
    0 0 20px rgba(0, 217, 255, 0.6),   /* Cyan glow */
    0 0 40px rgba(0, 217, 255, 0.4);
  pointer-events: auto;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10001;
}

/* Tooltip bubble */
.onboarding-tooltip {
  position: absolute;
  background: white;
  border-radius: 12px;
  padding: 0;
  max-width: 400px;
  min-width: 300px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 10002;
  pointer-events: auto;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
  visibility: visible;
}

/* Tooltip header */
.onboarding-tooltip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 12px 20px;
  border-bottom: 1px solid #e0e0e0;
}

.onboarding-tooltip-title {
  color: #1565c0;
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  flex: 1;
}

.onboarding-close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  margin-left: 12px;
}

.onboarding-close-btn:hover {
  background: #f5f5f5;
  color: #333;
}

.onboarding-close-btn:active {
  background: #e0e0e0;
}

.onboarding-tooltip-progress {
  color: #666;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.onboarding-esc-hint {
  color: #999;
  font-size: 12px;
  font-weight: 400;
  font-style: italic;
}

/* Tooltip body */
.onboarding-tooltip-body {
  padding: 16px 20px;
}

.onboarding-tooltip-message {
  color: #333;
  margin: 0;
  line-height: 1.6;
  font-size: 15px;
}

.onboarding-tooltip-icon {
  font-size: 20px;
  margin-right: 8px;
}

.onboarding-tooltip-summary {
  margin: 16px 0 0 0;
  padding: 0;
  list-style: none;
}

.onboarding-tooltip-summary li {
  color: #1565c0;
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.5;
}

.onboarding-tooltip-hint {
  margin: 12px 0 0 0;
  padding: 10px;
  background: #f0f9ff;
  border-left: 3px solid #00D9FF;
  border-radius: 4px;
  font-size: 14px;
  color: #555;
}

/* Tooltip footer */
.onboarding-tooltip-footer {
  padding: 12px 20px 20px 20px;
}

.onboarding-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Buttons */
.onboarding-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
}

.onboarding-btn:focus {
  outline: 2px solid #00D9FF;
  outline-offset: 2px;
}

.onboarding-btn-primary {
  background: #00D9FF;
  color: white;
}

.onboarding-btn-primary:hover {
  background: #00c4e6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
}

.onboarding-btn-primary:active {
  transform: translateY(0);
}

.onboarding-btn-secondary {
  background: transparent;
  color: #666;
  border: 1px solid #ccc;
}

.onboarding-btn-secondary:hover {
  background: #f5f5f5;
  border-color: #999;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .onboarding-tooltip {
    max-width: calc(100vw - 40px);
    left: 50% !important;
    bottom: 20px !important;
    top: auto !important;
    right: auto !important;
    transform: translateX(-50%) !important;
  }

  .onboarding-tooltip.mobile-position {
    position: fixed;
  }

  .onboarding-tooltip-header {
    padding: 16px 16px 10px 16px;
  }

  .onboarding-tooltip-title {
    font-size: 18px;
  }

  .onboarding-tooltip-body {
    padding: 12px 16px;
  }

  .onboarding-tooltip-message {
    font-size: 14px;
  }

  .onboarding-tooltip-footer {
    padding: 10px 16px 16px 16px;
  }

  .onboarding-buttons {
    flex-direction: column;
  }

  .onboarding-btn {
    width: 100%;
  }

  .onboarding-spotlight {
    border-width: 2px;
  }
}

/* Center modal mode (no spotlight) */
.onboarding-tooltip:has(+ .onboarding-spotlight[style*="display: none"]) {
  max-width: 500px;
}

/* Animations */
@keyframes onboardingFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.onboarding-tooltip {
  animation: onboardingFadeIn 0.3s ease;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .onboarding-overlay,
  .onboarding-spotlight,
  .onboarding-tooltip,
  .onboarding-btn {
    transition: none;
    animation: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .onboarding-spotlight {
    border-width: 4px;
    border-color: #00ffff;
  }

  .onboarding-tooltip {
    border: 2px solid #000;
  }
}
