/* Walkthrough Overlay */
.walkthrough-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: none;
  z-index: 9998;
  pointer-events: none;
}

.walkthrough-tooltip {
  position: fixed; /* important */
  z-index: 10002;
}

/* Completely disable movement animations while we place the tooltip */
.walkthrough-tooltip.wt-positioning {
  transition: none !important;
}

/* Hide without layout/transition artifacts */
.walkthrough-tooltip.wt-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.walkthrough-highlight {
  position: absolute;
  border: 3px solid #1976d2;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.2), 0 0 20px rgba(25, 118, 210, 0.5),
    inset 0 0 20px rgba(25, 118, 210, 0.2);
  pointer-events: none;
  z-index: 9999;
  transition: all 0.2s ease-out;
  /* Removed animation to prevent flashing */
}

.walkthrough-highlight::after {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  pointer-events: none; /* Changed to none to allow interactions with highlighted element */
  z-index: -1; /* Lower z-index so it doesn't block */
}

@keyframes highlight-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7),
      0 0 20px rgba(25, 118, 210, 0.5), inset 0 0 20px rgba(25, 118, 210, 0.2);
  }
  50% {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7),
      0 0 30px rgba(25, 118, 210, 0.8), inset 0 0 30px rgba(25, 118, 210, 0.4);
  }
}

.walkthrough-tooltip {
  position: fixed;
  background: white;
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(25, 118, 210, 0.1);
  z-index: 10002; /* Higher than highlight to ensure buttons are clickable */
  animation: tooltip-appear 0.3s ease-out;
  pointer-events: auto;
  /* Ensure tooltip and its children are always interactive */
  user-select: none;
  -webkit-user-select: none;
}

@keyframes tooltip-appear {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.walkthrough-tooltip h3 {
  margin: 0 0 12px 0;
  font-size: 1.25rem;
  color: #0d1b2a;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.walkthrough-tooltip .step-indicator {
  display: inline-block;
  background: #1976d2;
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 8px;
}

.walkthrough-tooltip p {
  margin: 0 0 20px 0;
  color: #263238;
  line-height: 1.6;
  font-size: 0.9375rem;
  font-weight: 500;
}

.walkthrough-tooltip .tooltip-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.walkthrough-tooltip button {
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-size: 0.875rem;
}

.walkthrough-tooltip .btn-skip {
  background: #e3f2fd;
  color: #1976d2;
}

.walkthrough-tooltip .btn-skip:hover {
  background: #bbdefb;
}

.walkthrough-tooltip .btn-next {
  background: #1976d2;
  color: white;
}

.walkthrough-tooltip .btn-next:hover {
  background: #1565c0;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(25, 118, 210, 0.25);
}

.walkthrough-tooltip .btn-prev {
  background: #f5f5f5;
  color: #546e7a;
}

.walkthrough-tooltip .btn-prev:hover {
  background: #e0e0e0;
}

.walkthrough-tooltip .btn-finish {
  background: #2e7d32;
  color: white;
}

.walkthrough-tooltip .btn-finish:hover {
  background: #1b5e20;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(46, 125, 50, 0.25);
}

/* Start Tour Button */
.start-tour-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  background: #1976d2;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.25);
  z-index: 10001;
  transition: all 0.2s;
  font-size: 0.8125rem;
  display: inline-block;
  width: auto !important;
  min-width: auto !important;
  max-width: none !important;
  margin: 0 !important;
}

/* Hide tour button during loading screen */
#loading-screen ~ .start-tour-btn,
body:has(#loading-screen) .start-tour-btn {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

.start-tour-btn:hover {
  background: #1565c0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.35);
}

.start-tour-btn:active {
  transform: translateY(0);
}

/* Tooltip Arrow */
.walkthrough-tooltip::before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border: 12px solid transparent;
  z-index: -1; /* Place arrow behind tooltip content but visible */
}

/* Arrow pointing UP (tooltip is below element) */
.walkthrough-tooltip.tooltip-top::before {
  top: -24px; /* Position above tooltip */
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: white; /* Arrow points up */
  border-top: none;
}

/* Arrow pointing DOWN (tooltip is above element) */
.walkthrough-tooltip.tooltip-bottom::before {
  bottom: -24px; /* Position below tooltip */
  left: 50%;
  transform: translateX(-50%);
  border-top-color: white; /* Arrow points down */
  border-bottom: none;
}

/* Arrow pointing RIGHT (tooltip is to the left of element) */
.walkthrough-tooltip.tooltip-left::before {
  left: -24px; /* Position to the left of tooltip */
  top: 50%;
  transform: translateY(-50%);
  border-right-color: white; /* Arrow points right */
  border-left: none;
}

/* Arrow pointing LEFT (tooltip is to the right of element) */
.walkthrough-tooltip.tooltip-right::before {
  right: -24px; /* Position to the right of tooltip */
  top: 50%;
  transform: translateY(-50%);
  border-left-color: white; /* Arrow points left */
  border-right: none;
}
