/* Tutorial Overlay */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  pointer-events: none;
}

/* Tutorial Modal */
.tutorial-modal {
  position: fixed;
  z-index: 10003;
  pointer-events: auto;
  max-width: 350px;
  min-width: 280px;
}

.tutorial-modal.tutorial-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.tutorial-modal.tutorial-left {
  left: 20px;
}

.tutorial-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  border: 2px solid #4682B4;
}

.tutorial-header {
  background: linear-gradient(135deg, #4682B4, #5F9EA0);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tutorial-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.tutorial-progress {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  min-width: 65px;
}

.tutorial-body {
  padding: 20px;
  direction: rtl;
}

.tutorial-body p {
  margin: 0;
  line-height: 1.6;
  color: #333;
  font-size: 15px;
}

.tutorial-footer {
  padding: 15px 20px;
  background: #f8f9fa;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid #e9ecef;
  direction: rtl;
}

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

.tutorial-next,
.tutorial-done {
  background: #4682B4;
  color: white;
}

.tutorial-next:hover,
.tutorial-done:hover {
  background: #5F9EA0;
  transform: translateY(-1px);
}

.tutorial-prev {
  background: #6c757d;
  color: white;
}

.tutorial-prev:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

.tutorial-skip {
  background: transparent;
  color: #6c757d;
  border: 1px solid #dee2e6;
}

.tutorial-skip:hover {
  background: #f8f9fa;
  color: #495057;
}

.tutorial-highlight::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  background: rgba(70, 130, 180, 0.3);
  border: 2px solid #4682B4;
  border-radius: 8px;
  animation: tutorialPulse 2s infinite;
  pointer-events: none;
  z-index: -1;
}

/* Four-rectangle overlay system for cutout effect */
.tutorial-overlay.has-cutout {
  background: transparent;
  pointer-events: none;
}

.tutorial-overlay-rect {
  position: fixed;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9998;
  pointer-events: none;
}

.tutorial-cutout {
  position: fixed;
  background: transparent;
  z-index: 10001;
  border: 3px solid #4682B4;
  border-radius: 8px;
  pointer-events: none;
  animation: tutorialPulse 2s infinite;
}

/* Make highlighted elements appear above the overlay */
.tutorial-highlight {
  z-index: 10002 !important;
}

/* Tutorial arrow indicators */
.tutorial-modal::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border: 10px solid transparent;
}

.tutorial-modal.tutorial-top::after {
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: white;
}

.tutorial-modal.tutorial-bottom::after {
  top: -20px;
  left: 20px;
  border-bottom-color: white;
}

.tutorial-modal.tutorial-left::after {
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  border-left-color: white;
}

.tutorial-modal.tutorial-right::after {
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  border-right-color: white;
}

/* Animation */
@keyframes tutorialPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(70, 130, 180, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(70, 130, 180, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(70, 130, 180, 0);
  }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .tutorial-modal {
    max-width: 300px;
    min-width: 260px;
  }

  .tutorial-modal.tutorial-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  /* Default mobile positioning for most steps */
  .tutorial-modal.tutorial-top,
  .tutorial-modal.tutorial-bottom,
  .tutorial-modal.tutorial-left,
  .tutorial-modal.tutorial-right {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  /* Special mobile positioning for stage 3 (map step) */
  .tutorial-modal.tutorial-bottom {
    position: fixed;
    bottom: 20px;
    left: 50%;
    top: auto;
    transform: translateX(-50%);
  }

  .tutorial-modal::after {
    display: none;
  }

  .tutorial-header h3 {
    font-size: 16px;
  }

  .tutorial-body p {
    font-size: 14px;
  }

  .tutorial-footer {
    flex-wrap: wrap;
  }

  .tutorial-btn {
    font-size: 13px;
    padding: 6px 12px;
  }
}

/* Hide tutorial on very small screens */
@media (max-width: 480px) {
  .tutorial-modal {
    max-width: 280px;
    min-width: 240px;
  }
}