/* Interactive Tutorial System Styles */

/* Tutorial Modal */
.tutorial-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent; /* No background - we use box-shadow for the grey overlay */
  z-index: 10100; /* Higher than the highlight overlay (10000) */
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 2rem;
  pointer-events: none; /* Allow clicking through to the form */
}

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

.tutorial-modal-content {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  max-width: 450px;
  width: 100%;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  position: relative;
  z-index: 10101; /* Highest z-index */
  pointer-events: auto; /* Re-enable clicking on the modal content */
  margin-top: 0;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.tutorial-modal-header {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  padding: 2rem;
  border-radius: 1rem 1rem 0 0;
  color: white;
}

.tutorial-modal-header h2 {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 0;
}

.tutorial-modal-header .practice-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.tutorial-modal-body {
  padding: 2rem;
}

.tutorial-progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.tutorial-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
  transition: width 0.3s ease;
  border-radius: 9999px;
}

.tutorial-progress-text {
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.tutorial-step {
  min-height: 200px;
}

.tutorial-step h3 {
  color: #111827;
  margin-bottom: 1rem;
}

.tutorial-step p {
  color: #4b5563;
  line-height: 1.75;
  margin-bottom: 1.5rem;
}

.tutorial-modal-footer {
  padding: 1.5rem 2rem;
  background: #f9fafb;
  border-radius: 0 0 1rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.tutorial-modal-footer button {
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.tutorial-btn-skip {
  background: transparent;
  color: #6b7280;
}

.tutorial-btn-skip:hover {
  color: #374151;
}

.tutorial-btn-prev {
  background: #e5e7eb;
  color: #374151;
}

.tutorial-btn-prev:hover {
  background: #d1d5db;
}

.tutorial-btn-prev:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tutorial-btn-next {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  flex: 1;
  max-width: 200px;
}

.tutorial-btn-next:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

/* Element Highlighting */
.tutorial-highlight {
  position: relative !important;
  z-index: 10000 !important;
  /* Use box-shadow to create both the blue border AND the dark overlay around it */
  box-shadow: 0 0 0 4px #3b82f6,
              0 0 0 8px rgba(59, 130, 246, 0.4),
              0 0 0 9999px rgba(0, 0, 0, 0.7) !important;
  border-radius: 0.5rem !important;
  animation: tutorialPulse 2s infinite;
}

/* Ensure highlighted element has white background and is fully visible */
.tutorial-highlight input,
.tutorial-highlight select,
.tutorial-highlight textarea,
.tutorial-highlight button {
  background: white !important;
  position: relative !important;
}

/* For container elements (divs) that are highlighted */
.tutorial-highlight:not(input):not(select):not(textarea):not(button) {
  background: white !important;
}

@keyframes tutorialPulse {
  0%, 100% {
    box-shadow: 0 0 0 4px #3b82f6,
                0 0 0 8px rgba(59, 130, 246, 0.4),
                0 0 0 9999px rgba(0, 0, 0, 0.7);
  }
  50% {
    box-shadow: 0 0 0 4px #3b82f6,
                0 0 0 12px rgba(59, 130, 246, 0.3),
                0 0 0 9999px rgba(0, 0, 0, 0.7);
  }
}

/* Tutorial Overlay */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 9998;
  pointer-events: none;
  transition: opacity 0.3s;
}

/* Validation Error Toast */
.tutorial-validation-error {
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Tutorial Launcher Cards */
.tutorial-card {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.tutorial-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-color: #3b82f6;
  transform: translateY(-2px);
}

.tutorial-card.completed {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.tutorial-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1rem;
}

.tutorial-card-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.tutorial-card.completed .tutorial-card-icon {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.tutorial-card-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.tutorial-card-badge.practice {
  background: #dbeafe;
  color: #1e40af;
}

.tutorial-card-badge.completed {
  background: #d1fae5;
  color: #065f46;
}

.tutorial-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

.tutorial-card-description {
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.tutorial-card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: #9ca3af;
  margin-bottom: 1rem;
}

.tutorial-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.tutorial-card-footer {
  display: flex;
  gap: 0.5rem;
}

.tutorial-card-button {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  text-align: center;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.tutorial-card-button.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
}

.tutorial-card-button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.tutorial-card-button.secondary {
  background: #f3f4f6;
  color: #374151;
}

.tutorial-card-button.secondary:hover {
  background: #e5e7eb;
}

/* Video Container */
.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  background: #000;
  border-radius: 0.5rem;
}

.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Tutorial Complete Animation */
.tutorial-complete {
  animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsive */
@media (max-width: 640px) {
  .tutorial-modal {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
  }

  .tutorial-modal-content {
    max-width: 100%;
    margin: 0;
    max-height: 70vh;
    border-radius: 1rem 1rem 0 0;
    animation: slideInUp 0.3s ease-out;
  }

  @keyframes slideInUp {
    from {
      transform: translateY(100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  .tutorial-modal-header {
    padding: 1.5rem;
  }

  .tutorial-modal-body {
    padding: 1.5rem;
  }

  .tutorial-modal-footer {
    flex-direction: column;
    padding: 1rem 1.5rem;
  }

  .tutorial-btn-next {
    max-width: 100%;
  }
}

/* Practice Mode Banner */
.practice-mode-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-left: 4px solid #f59e0b;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.practice-mode-banner-icon {
  font-size: 1.5rem;
}

.practice-mode-banner-text {
  flex: 1;
}

.practice-mode-banner-title {
  font-weight: 600;
  color: #92400e;
  margin-bottom: 0.25rem;
}

.practice-mode-banner-description {
  font-size: 0.875rem;
  color: #78350f;
}
