/* GameRover Tour System Styles */

.tour-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

/* iOS Capacitor: Extend tour overlay to cover safe areas */
body.ios-capacitor-app .tour-overlay {
  top: calc(0px - env(safe-area-inset-top));
  left: calc(0px - env(safe-area-inset-left));
  right: calc(0px - env(safe-area-inset-right));
  bottom: calc(0px - env(safe-area-inset-bottom));
}

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

.tour-overlay.tour-closing {
  opacity: 0;
  visibility: hidden;
}

.tour-spotlight {
  position: absolute;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.8);
  transition: all 0.4s ease;
  z-index: 10001;
}

.tour-spotlight.circle {
  border-radius: 50%;
}

.tour-card {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: white;
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  min-width: 300px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  z-index: 10002;
  opacity: 0;
  transition: all 0.3s ease;
}

.tour-card.active {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.tour-card.fade-content .tour-card-header,
.tour-card.fade-content .step-counter,
.tour-card.fade-content .tour-card-content,
.tour-card.fade-content .tour-navigation {
  opacity: 0.3;
  transition: opacity 0.15s ease;
}

body.dark .tour-card {
  background: #1f2937;
  color: #f9fafb;
}

.tour-card h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
}

body.dark .tour-card h3 {
  color: #f9fafb;
}

.tour-card h3 img {
  height: 30px;
  display: inherit;
  vertical-align: text-bottom;
}

.tour-card .step-counter {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

body.dark .tour-card .step-counter {
  color: #9ca3af;
}

.tour-card-header {
  position: relative;
  margin-bottom: 8px;
  transition: opacity 0.15s ease;
}

.step-counter {
  margin-bottom: 16px;
  transition: opacity 0.15s ease;
}

.tour-close-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.2s ease;
  z-index: 1;
  /* Touch improvements for iOS */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tour-close-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

body.dark .tour-close-btn {
  color: #9ca3af;
}

body.dark .tour-close-btn:hover {
  background: #374151;
  color: #f9fafb;
}

.tour-inline-logo {
  height: 24px !important;
  width: auto !important;
  vertical-align: middle;
  margin: 0 4px;
}

.tour-inline-icon {
  height: 20px !important;
  width: auto !important;
  vertical-align: middle;
  margin: 0 2px;
}

.tour-card-content {
  margin-bottom: 20px;
  transition: opacity 0.15s ease;
}

.tour-card p {
  margin: 0 0 12px 0;
  font-size: 16px;
  line-height: 1.5;
  color: #374151;
}

body.dark .tour-card p {
  color: #d1d5db;
}

.tour-card p img {
  height: 16px;
  filter: brightness(0) invert(1);
}

.tour-card-image {
  width: 100%;
  height: auto;
  background: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px 0;
}

.tour-card-image img {
  max-width: 500px;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

/* Specific style for complete.png icon only */
.tour-card-image img[src*='complete.png'] {
  height: 150px;
}

@media (max-width: 1000px) {
  .tour-card-image img[src*='complete-mobile.png'] {
    height: 100px;
  }
}

.tour-card-image.placeholder {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 14px;
  font-weight: 500;
}

.tour-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  transition: opacity 0.15s ease;
}

.tour-nav-buttons {
  display: flex;
  gap: 8px;
}

.tour-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tour-btn:hover {
  transform: translateY(-1px);
}

.tour-btn.primary {
  background: #3b82f6;
  color: white;
}

.tour-btn.primary:hover {
  background: #2563eb;
}

.tour-btn.secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

body.dark .tour-btn.secondary {
  background: #4b5563;
  color: #f9fafb;
  border: 1px solid #6b7280;
}

.tour-btn.secondary:hover {
  background: #e5e7eb;
}

body.dark .tour-btn.secondary:hover {
  background: #6b7280;
}

.tour-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.tour-progress {
  display: flex;
  gap: 6px;
  align-items: center;
}

.tour-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  transition: all 0.2s ease;
}

.tour-progress-dot.active {
  background: #3b82f6;
  transform: scale(1.25);
}

.tour-progress-dot.completed {
  background: #10b981;
}

.tour-skip {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10003;
}

body.dark .tour-skip {
  background: rgba(31, 41, 55, 0.9);
  color: #f9fafb;
}

.tour-skip:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px);
}

body.dark .tour-skip:hover {
  background: rgba(31, 41, 55, 1);
}

/* Arrow pointing to highlighted elements */
.tour-arrow {
  position: absolute;
  z-index: 10002;
  pointer-events: none;
}

.tour-arrow::before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border: 8px solid transparent;
}

.tour-arrow.top::before {
  border-bottom-color: white;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
}

.tour-arrow.bottom::before {
  border-top-color: white;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
}

.tour-arrow.left::before {
  border-right-color: white;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
}

.tour-arrow.right::before {
  border-left-color: white;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
}

body.dark .tour-arrow.top::before {
  border-bottom-color: #1f2937;
}

body.dark .tour-arrow.bottom::before {
  border-top-color: #1f2937;
}

body.dark .tour-arrow.left::before {
  border-right-color: #1f2937;
}

body.dark .tour-arrow.right::before {
  border-left-color: #1f2937;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .tour-card {
    max-width: 85vw;
    min-width: unset;
    width: 85vw;
    padding: 24px;
    margin: 0;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1) !important;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  }

  /* iOS Capacitor app specific adjustments */
  body.ios-capacitor-app .tour-card {
    top: 45%;
    transform: translate(-50%, -45%) scale(1) !important;
  }

  body.ios-capacitor-app .tour-card.active {
    transform: translate(-50%, -45%) scale(1);
  }


  .tour-card.active {
    transform: translate(-50%, -50%) scale(1);
  }

  .tour-card h3 {
    font-size: 20px;
    line-height: 1.3;
    margin-bottom: 12px;
  }

  .tour-card p {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 16px;
  }

  .tour-card-image {
    padding: 16px 0;
    max-height: 250px;
  }

  .tour-card-image img {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
  }

  .step-counter {
    font-size: 15px;
    margin-bottom: 0;
  }

  .tour-navigation {
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
  }

  .tour-progress {
    justify-content: center;
    gap: 8px;
  }

  .tour-progress-dot {
    width: 10px;
    height: 10px;
  }

  .tour-nav-buttons {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .tour-btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 15px;
    border-radius: 8px;
    font-weight: 600;
  }

  .tour-close-btn {
    top: 8px;
    right: 8px;
    font-size: 22px;
    padding: 8px 10px;
  }
}

/* Animation for tour entrance */
@keyframes tourSlideIn {
  from {
    transform: translate(-50%, -50%) translateY(20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) translateY(0) scale(1);
    opacity: 1;
  }
}

/* Pulse effect for highlighted elements */
@keyframes tourPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.tour-spotlight.pulse {
  animation: tourPulse 2s infinite;
}
