/* Enhanced Tour Guide Styles - Fixed and Improved */
.tour-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-all);
  pointer-events: none;
}

.tour-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.tour-highlight {
  position: absolute;
  background: transparent;
  border: 4px solid var(--primary-500);
  border-radius: var(--radius-xl);
  z-index: var(--z-modal);
  pointer-events: none;
  display: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
  transition: var(--transition-all);
  animation: tourPulse 2s infinite;
}

@keyframes tourPulse {
  0%,
  100% {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 20px var(--primary-500);
  }
  50% {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7), 0 0 30px var(--primary-400);
  }
}

.tour-tooltip {
  position: absolute;
  width: 360px;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(20px);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-2xl);
  z-index: var(--z-tooltip);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9) translateY(10px);
  transition: var(--transition-all);
  overflow: hidden;
}

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

/* Enhanced Tooltip Positioning */
.tour-tooltip.top {
  transform-origin: bottom center;
}

.tour-tooltip.bottom {
  transform-origin: top center;
}

.tour-tooltip.left {
  transform-origin: right center;
}

.tour-tooltip.right {
  transform-origin: left center;
}

.tour-tooltip.show.top {
  transform: scale(1) translateY(0);
}

.tour-tooltip.show.bottom {
  transform: scale(1) translateY(0);
}

.tour-tooltip.show.left {
  transform: scale(1) translateX(0);
}

.tour-tooltip.show.right {
  transform: scale(1) translateX(0);
}

/* Enhanced Tooltip Arrows */
.tour-tooltip::before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border: 12px solid transparent;
  z-index: 1;
}

.tour-tooltip::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border: 10px solid transparent;
  z-index: 2;
}

.tour-tooltip.top::before {
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: var(--border-light);
}

.tour-tooltip.top::after {
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: var(--surface-glass-strong);
}

.tour-tooltip.bottom::before {
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: var(--border-light);
}

.tour-tooltip.bottom::after {
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: var(--surface-glass-strong);
}

.tour-tooltip.left::before {
  right: -24px;
  top: 50%;
  transform: translateY(-50%);
  border-left-color: var(--border-light);
}

.tour-tooltip.left::after {
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  border-left-color: var(--surface-glass-strong);
}

.tour-tooltip.right::before {
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
  border-right-color: var(--border-light);
}

.tour-tooltip.right::after {
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  border-right-color: var(--surface-glass-strong);
}

/* Enhanced Tour Content */
.tour-header {
  padding: var(--space-6) var(--space-8);
  border-bottom: 2px solid var(--border-light);
  background: linear-gradient(135deg, var(--surface-elevated) 0%, var(--surface) 100%);
  position: relative;
}

.tour-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: var(--space-8);
  right: var(--space-8);
  height: 3px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
}

.tour-step-counter {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tour-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.025em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tour-description {
  padding: var(--space-6) var(--space-8);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  margin: 0;
}

.tour-actions {
  padding: var(--space-6) var(--space-8);
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}

.tour-progress {
  width: 100%;
  height: 6px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
  overflow: hidden;
  position: relative;
}

.tour-progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: var(--transition-all);
  position: relative;
}

.tour-progress-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 2s infinite;
}

.tour-nav {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.tour-nav .btn {
  flex: 1;
  justify-content: center;
  font-weight: var(--font-semibold);
}

.tour-prev {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.tour-prev:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.tour-next,
.tour-finish {
  background: var(--gradient-primary);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-lg);
}

.tour-next:hover,
.tour-finish:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.tour-skip {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  transition: var(--transition-all);
  text-align: center;
  width: 100%;
}

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

.tour-skip:focus {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
  .tour-tooltip {
    width: calc(100vw - 40px);
    max-width: 320px;
    left: 20px !important;
    right: 20px !important;
  }

  .tour-tooltip.left,
  .tour-tooltip.right {
    left: 20px !important;
    right: 20px !important;
  }

  .tour-tooltip::before,
  .tour-tooltip::after {
    display: none;
  }

  .tour-header {
    padding: var(--space-4) var(--space-6);
  }

  .tour-title {
    font-size: var(--text-xl);
  }

  .tour-description {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-sm);
  }

  .tour-actions {
    padding: var(--space-4) var(--space-6);
  }

  .tour-nav {
    flex-direction: column;
    gap: var(--space-3);
  }

  .tour-nav .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .tour-tooltip {
    width: calc(100vw - 20px);
    left: 10px !important;
    right: 10px !important;
  }

  .tour-header {
    padding: var(--space-3) var(--space-4);
  }

  .tour-title {
    font-size: var(--text-lg);
  }

  .tour-description {
    padding: var(--space-3) var(--space-4);
  }

  .tour-actions {
    padding: var(--space-3) var(--space-4);
  }
}

/* Enhanced Accessibility */
.tour-tooltip:focus-within {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

.tour-prev:focus,
.tour-next:focus,
.tour-finish:focus {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Enhanced High Contrast Mode */
@media (prefers-contrast: high) {
  .tour-highlight {
    border-width: 6px !important;
    border-color: var(--text-primary) !important;
  }

  .tour-tooltip {
    border-width: 3px !important;
    border-color: var(--text-primary) !important;
  }

  .tour-progress {
    background: var(--text-primary) !important;
  }

  .tour-progress-bar {
    background: var(--primary-600) !important;
  }
}

/* Enhanced Print Styles */
@media print {
  .tour-overlay,
  .tour-highlight,
  .tour-tooltip {
    display: none !important;
  }
}

/* Enhanced Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .tour-overlay,
  .tour-tooltip,
  .tour-highlight,
  .tour-progress-bar {
    transition: none !important;
    animation: none !important;
  }

  .tour-tooltip.show {
    transform: none !important;
  }

  @keyframes tourPulse {
    0%,
    100% {
      border-color: var(--primary-500);
      box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
    }
  }
}

/* Enhanced Animation Performance */
.tour-highlight,
.tour-tooltip,
.tour-progress-bar {
  will-change: transform, opacity;
}

.tour-overlay.active .tour-highlight {
  will-change: auto;
}

.tour-tooltip.show {
  will-change: auto;
}
