/* ============================================================
   BizMaker – Guided Tutorial / Onboarding Overlay
   ============================================================ */

/* Overlay backdrop */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.tutorial-overlay.active {
  pointer-events: auto;
}

/* Dark mask with hole – uses box-shadow trick */
.tutorial-highlight-mask {
  position: fixed;
  z-index: 99999;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

/* Pulsing ring around highlighted element */
.tutorial-highlight-mask::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid var(--accent, #4f8cff);
  border-radius: 12px;
  animation: tutorial-pulse 1.8s ease-in-out infinite;
}

@keyframes tutorial-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

/* Tooltip / popup card */
.tutorial-popup {
  position: fixed;
  z-index: 100000;
  background: var(--card-bg, #fff);
  color: var(--text, #1a1a2e);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 0;
  max-width: 420px;
  min-width: 280px;
  width: max-content;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  font-family: inherit;
}

.tutorial-popup.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Arrow / pointer */
.tutorial-popup::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--card-bg, #fff);
  transform: rotate(45deg);
  z-index: -1;
}

.tutorial-popup[data-arrow="top"]::before {
  top: -7px;
  left: 50%;
  margin-left: -8px;
}

.tutorial-popup[data-arrow="bottom"]::before {
  bottom: -7px;
  left: 50%;
  margin-left: -8px;
}

.tutorial-popup[data-arrow="left"]::before {
  left: -7px;
  top: 50%;
  margin-top: -8px;
}

.tutorial-popup[data-arrow="right"]::before {
  right: -7px;
  top: 50%;
  margin-top: -8px;
}

/* Header with step indicator */
.tutorial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 0;
  gap: 10px;
}

.tutorial-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent, #4f8cff);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.tutorial-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--muted, #888);
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.tutorial-close:hover {
  color: var(--text, #1a1a2e);
}

/* Body */
.tutorial-body {
  padding: 12px 18px 6px;
}

.tutorial-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text, #1a1a2e);
}

.tutorial-text {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted, #666);
  margin: 0;
}

/* Footer with navigation buttons */
.tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 16px;
  gap: 8px;
}

/* Progress dots */
.tutorial-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border, #ddd);
  transition: all 0.3s;
}

.tutorial-dot.active {
  background: var(--accent, #4f8cff);
  transform: scale(1.3);
}

.tutorial-dot.done {
  background: var(--success, #27ae60);
}

/* Buttons */
.tutorial-nav-btns {
  display: flex;
  gap: 6px;
}

.tutorial-btn {
  border: none;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}

.tutorial-btn-skip {
  background: transparent;
  color: var(--muted, #888);
}

.tutorial-btn-skip:hover {
  color: var(--text, #1a1a2e);
  background: var(--bg-alt, #f5f5f5);
}

.tutorial-btn-prev {
  background: var(--bg-alt, #f0f0f0);
  color: var(--text, #333);
}

.tutorial-btn-prev:hover {
  background: var(--border, #ddd);
}

.tutorial-btn-next {
  background: var(--accent, #4f8cff);
  color: #fff;
}

.tutorial-btn-next:hover {
  filter: brightness(1.1);
}

.tutorial-btn-finish {
  background: var(--success, #27ae60);
  color: #fff;
}

.tutorial-btn-finish:hover {
  filter: brightness(1.1);
}

/* Welcome / intro modal (centered, no highlight) */
.tutorial-welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 100001;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.tutorial-welcome-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.tutorial-welcome-card {
  background: var(--card-bg, #fff);
  border-radius: 18px;
  padding: 36px 32px 28px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tutorial-welcome-overlay.visible .tutorial-welcome-card {
  transform: translateY(0) scale(1);
}

.tutorial-welcome-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.tutorial-welcome-card h2 {
  font-size: 1.4rem;
  margin: 0 0 10px;
  color: var(--text, #1a1a2e);
}

.tutorial-welcome-card p {
  font-size: 0.92rem;
  color: var(--muted, #666);
  line-height: 1.6;
  margin: 0 0 22px;
}

.tutorial-welcome-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.tutorial-welcome-actions .tutorial-btn {
  padding: 10px 24px;
  font-size: 0.9rem;
}

/* Trigger button (floating) */
.tutorial-trigger {
  /* Move to bottom-left to avoid overlapping bottom-right toasts */
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: auto;
  z-index: 45; /* keep below toasts (toast z-index: 50) */
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary, #6b8afd); /* clearer contrast */
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(70, 90, 170, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.tutorial-trigger:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(70, 90, 170, 0.25);
}

.tutorial-trigger .tutorial-trigger-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--success, #5bb98c); /* less aggressive than red */
  border: 2px solid var(--card-bg, #fff);
}

/* Dark theme adjustments */
.dark-theme .tutorial-highlight-mask {
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.78);
}

.dark-theme .tutorial-popup {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  .tutorial-popup {
    max-width: calc(100vw - 32px);
    min-width: 0;
    width: calc(100vw - 32px);
    left: 16px !important;
    right: 16px !important;
  }

  .tutorial-popup::before {
    display: none;
  }

  .tutorial-welcome-card {
    padding: 28px 20px 22px;
  }

  .tutorial-trigger {
    bottom: 16px;
    left: 16px;
    right: auto;
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
  }
}
