/* ==========================================================================
   Onboarding Tour — Overlay, Highlight & Tooltip
   ========================================================================== */

/* Overlay: covers everything EXCEPT the sidebar */
.tour-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 260px;
  background: rgba(0, 0, 0, 0.50);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 9998;
  animation: tour-fade-in 0.4s ease;
}
@media (min-width: 901px) and (max-width: 1100px) {
  .tour-overlay { left: 220px; }
}
@media (max-width: 900px) {
  .tour-overlay { left: 0; }
}
@keyframes tour-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Highlighted element cutout */
.tour-highlight {
  position: absolute;
  z-index: 9999;
  border-radius: 10px;
  background: transparent;
  box-shadow:
    0 0 0 4px var(--accent, #3b82f6),
    0 0 20px rgba(59, 130, 246, 0.35),
    0 0 60px rgba(59, 130, 246, 0.15);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: tour-highlight-enter 0.5s ease;
}
@keyframes tour-highlight-enter {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.tour-highlight::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 14px;
  border: 2px solid var(--accent, #3b82f6);
  animation: tour-ring-pulse 2s ease-in-out infinite;
}
@keyframes tour-ring-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.01); }
}

/* ── Sidebar nav item highlight ─────────────────────────────────── */
.nav-item.tour-active-nav {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(99, 102, 241, 0.18)) !important;
  color: #60a5fa !important;
  font-weight: 700 !important;
  position: relative;
  z-index: 10001;
  border-radius: 8px;
  box-shadow:
    0 0 12px rgba(59, 130, 246, 0.30),
    0 0 30px rgba(59, 130, 246, 0.12),
    inset 0 0 0 1px rgba(59, 130, 246, 0.25);
  animation: tour-nav-glow 2s ease-in-out infinite;
  transition: all 0.3s ease;
}
.nav-item.tour-active-nav svg {
  opacity: 1 !important;
  stroke: #60a5fa !important;
}
.nav-item.tour-active-nav::before {
  content: "" !important;
  position: absolute !important;
  inset-inline-start: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 3px !important;
  height: 22px !important;
  border-radius: 0 3px 3px 0 !important;
  background: #3b82f6 !important;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6) !important;
}
@keyframes tour-nav-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(59, 130, 246, 0.30), 0 0 30px rgba(59, 130, 246, 0.12), inset 0 0 0 1px rgba(59, 130, 246, 0.25); }
  50% { box-shadow: 0 0 18px rgba(59, 130, 246, 0.45), 0 0 40px rgba(59, 130, 246, 0.20), inset 0 0 0 1px rgba(59, 130, 246, 0.35); }
}
[data-theme="light"] .nav-item.tour-active-nav {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(37, 99, 235, 0.08)) !important;
  color: #2563eb !important;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.20), 0 0 30px rgba(37, 99, 235, 0.08), inset 0 0 0 1px rgba(37, 99, 235, 0.20);
}
[data-theme="light"] .nav-item.tour-active-nav svg {
  stroke: #2563eb !important;
}

/* Keep sidebar above overlay during tour */
.tour-sidebar-elevated {
  z-index: 10000 !important;
}

/* ── Tooltip ──────────────────────────────────────────────────────── */
.tour-tooltip {
  position: fixed;
  z-index: 10002;
  background: var(--card-bg, #1a1a2e);
  border: 1px solid rgba(59, 130, 246, 0.20);
  border-radius: 16px;
  padding: 22px 24px;
  max-width: 380px;
  min-width: 280px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.35),
    0 0 30px rgba(59, 130, 246, 0.08);
  animation: tour-tooltip-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
[data-theme="light"] .tour-tooltip {
  background: #fff;
  border-color: rgba(37, 99, 235, 0.15);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12), 0 0 30px rgba(37, 99, 235, 0.06);
}
@keyframes tour-tooltip-in {
  from { opacity: 0; transform: translateY(12px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.tour-tooltip__step {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent, #3b82f6);
  margin-bottom: 6px;
  background: rgba(59, 130, 246, 0.10);
  padding: 3px 10px;
  border-radius: 20px;
}
.tour-tooltip__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #fff);
  margin-bottom: 6px;
  line-height: 1.3;
}
.tour-tooltip__desc {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text2, rgba(255,255,255,0.7));
  margin-bottom: 16px;
}
.tour-tooltip__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tour-btn {
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}
.tour-btn-primary {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.30);
}
.tour-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.40);
}
.tour-btn-skip {
  background: transparent;
  color: var(--text3, rgba(255,255,255,0.4));
  padding: 9px 10px;
  font-size: 0.78rem;
}
.tour-btn-skip:hover {
  color: var(--text, #fff);
}

.tour-tooltip__progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 14px;
}
.tour-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border, rgba(255,255,255,0.12));
  transition: all 0.3s ease;
}
.tour-dot.active {
  background: var(--accent, #3b82f6);
  width: 20px;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.40);
}
.tour-dot.done {
  background: var(--accent, #3b82f6);
  opacity: 0.35;
}

/* ── Responsive tooltip ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .tour-tooltip {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    max-width: 100%;
    min-width: 0;
    border-radius: 20px 20px 0 0;
    padding: 20px 20px calc(env(safe-area-inset-bottom, 12px) + 12px);
    animation: tour-slide-up 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  @keyframes tour-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
}

/* Tablet: tooltip in sidebar area */
@media (min-width: 901px) and (max-width: 1200px) {
  .tour-tooltip {
    max-width: 320px;
  }
}
