/*
 * Tour Guide Traquility Theme
 *
 * Custom styling for tourguidejs library to match Traquility design system
 * Overrides default tour.min.css with gradient header and white content body
 */

/* Override dialog background - white base with highest z-index */
.tg-dialog {
  border-radius: 20px !important;
  background: var(--traq-bg-white) !important;
  color: var(--traq-text-secondary) !important;
  max-width: 400px !important;
  box-shadow: var(--traq-shadow-primary-lg) !important;
  border: none !important;
  overflow: hidden !important;
  z-index: 10001 !important; /* Ensure dialog is above backdrop and all other elements */
}

/* Dialog header styling - gradient background */
.tg-dialog .tg-dialog-header {
  padding: 25px 25px 20px 25px !important;
  background: var(--traq-gradient-primary-alpha-98) !important;
  position: relative;
  z-index: 1;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

/* Animated background effect for header */
.tg-dialog .tg-dialog-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 50%, var(--traq-white-alpha-10) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, var(--traq-white-alpha-10) 0%, transparent 50%);
  animation: floatAnimation 6s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes floatAnimation {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10px, -10px); }
}

/* Ensure header content is above animated background */
.tg-dialog .tg-dialog-header .tg-dialog-title,
.tg-dialog .tg-dialog-header .tg-dialog-close-btn {
  position: relative;
  z-index: 1;
}

.tg-dialog .tg-dialog-header .tg-dialog-title {
  color: var(--traq-text-white) !important;
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  margin: 0 !important;
  flex: 1 !important; /* Allow title to take available space */
  padding-right: 15px !important; /* Space between title and close button */
}

/* Close button styling - positioned at far right */
.tg-dialog .tg-dialog-header .tg-dialog-close-btn {
  opacity: 0.8 !important;
  filter: brightness(0) invert(1);
  transition: all 0.3s ease;
  flex-shrink: 0 !important; /* Prevent button from shrinking */
  margin-left: auto !important; /* Push to the right */
}

.tg-dialog .tg-dialog-header .tg-dialog-close-btn:hover {
  opacity: 1 !important;
  transform: rotate(90deg);
}

/* Dialog body styling - white background with dark text */
.tg-dialog .tg-dialog-body {
  padding: 25px !important;
  background: var(--traq-bg-white) !important;
  color: var(--traq-text-secondary) !important;
  font-size: 1rem !important;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* Progress dots styling - now in white body area */
.tg-dialog .tg-dialog-dots {
  padding: 12px 0 !important;
  margin: 15px 25px 10px 25px !important;
  border-bottom: none !important;
  background: var(--traq-bg-white) !important;
  position: relative;
  z-index: 1;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.tg-dialog .tg-dialog-dots>span.tg-dot {
  width: 10px !important;
  height: 10px !important;
  background: #cbd5e0 !important;
  margin: 0 5px !important;
  transition: all 0.3s ease;
}

.tg-dialog .tg-dialog-dots>span.tg-dot.tg-dot-active {
  background: var(--traq-color-primary) !important;
  transform: scale(1.2);
  box-shadow: var(--traq-shadow-primary-sm);
}

/* Progress bar styling */
.tg-dialog .tg-dialog-progress-bar {
  background: var(--traq-bg-gray) !important;
  height: 6px !important;
  margin-top: 15px !important;
}

.tg-dialog .tg-dialog-progress-bar>.tg-bar {
  background: var(--traq-color-primary) !important;
  box-shadow: var(--traq-shadow-primary-sm);
}

/* Footer styling - white background */
.tg-dialog .tg-dialog-footer {
  padding: 0 25px 25px 25px !important;
  background: var(--traq-bg-white) !important;
  position: relative;
  z-index: 1;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  align-items: center !important;
}

/* Step progress text - dark color for white background */
.tg-dialog .tg-dialog-footer .tg-dialog-footer-sup {
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
  order: -1 !important; /* Move progress text above buttons */
  margin: 0 0 10px 0 !important;
  padding: 8px 0 !important;
  border-top: 1px solid var(--traq-bg-gray) !important;
}

.tg-dialog .tg-dialog-footer .tg-dialog-footer-sup .tg-step-progress {
  color: var(--traq-text-light) !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
  line-height: 4 !important;
}

/* Footer buttons container - buttons come after progress due to order */
.tg-dialog .tg-dialog-footer .tg-dialog-footer-body {
  display: contents !important;
}

/* Button styling - solid primary gradient buttons */
.tg-dialog .tg-dialog-footer button.tg-dialog-btn {
  padding: 10px 20px !important;
  border: none !important;
  background: var(--traq-gradient-primary) !important;
  color: var(--traq-text-white) !important;
  border-radius: 50px !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  transition: all 0.3s ease !important;
  white-space: nowrap !important;
  box-shadow: var(--traq-shadow-primary-sm);
  flex: 1 1 0 !important;
  min-width: 0 !important;
  max-width: 150px !important;
}

/* Ensure second button pushes to the right */
.tg-dialog .tg-dialog-footer button.tg-dialog-btn + button.tg-dialog-btn {
  margin-left: auto !important;
}

.tg-dialog .tg-dialog-footer button.tg-dialog-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--traq-shadow-primary-md);
}

.tg-dialog .tg-dialog-footer button.tg-dialog-btn:active {
  transform: translateY(0);
  box-shadow: var(--traq-shadow-primary-sm);
}

.tg-dialog .tg-dialog-footer button.tg-dialog-btn.disabled {
  opacity: 0.5 !important;
  pointer-events: none !important;
}

/* Step progress text - dark color for white background */
.tg-dialog .tg-dialog-footer .tg-dialog-footer-sup {

/* Arrow styling */
.tg-dialog .tg-arrow {
  background: var(--traq-gradient-primary) !important;
  border: 2px solid var(--traq-white-alpha-20);
  box-shadow: var(--traq-shadow-primary-sm);
}

/* Backdrop styling - ensure it covers navigation elements */
.tg-backdrop {
  box-shadow: var(--traq-primary-alpha-40) 0 0 1px 2px, var(--traq-primary-alpha-30) 0 0 0 1000vh !important;
  border: 2px solid var(--traq-primary-alpha-60) !important;
  border-radius: 12px !important;
  transition: all 400ms ease-in-out !important;
  z-index: 10000 !important; /* Higher than navigation (1000) and other UI elements */
}

/* Pulse animation for highlighted element */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: var(--traq-primary-alpha-40) 0 0 1px 2px, var(--traq-primary-alpha-30) 0 0 0 1000vh;
  }
  50% {
    box-shadow: var(--traq-primary-alpha-60) 0 0 1px 3px, var(--traq-primary-alpha-30) 0 0 0 1000vh;
  }
}

.tg-backdrop.tg-backdrop-animate {
  animation: pulseGlow 2s ease-in-out infinite;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .tg-dialog {
    max-width: 90vw !important;
    margin: 10px !important;
  }

  .tg-dialog .tg-dialog-header {
    padding: 20px !important;
  }

  .tg-dialog .tg-dialog-body {
    padding: 20px !important;
    font-size: 0.95rem !important;
  }

  .tg-dialog .tg-dialog-footer {
    padding: 0 20px 20px 20px !important;
  }

  .tg-dialog .tg-dialog-dots {
    margin: 15px 20px !important;
  }

  .tg-dialog .tg-dialog-header .tg-dialog-title {
    font-size: 1.1rem !important;
  }

  .tg-dialog .tg-dialog-footer button.tg-dialog-btn {
    padding: 10px 16px !important;
    font-size: 0.85rem !important;
  }
}

/* Loading state with spinner animation */
.tg-dialog.tg-dialog-loading .tg-dialog-header .tg-dialog-spinner {
  animation: spinPulse 1.5s ease-in-out infinite !important;
}

@keyframes spinPulse {
  0%, 100% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.1);
  }
}
