/**
 * RevolutionEd Interactive Tutorial System Styles
 * ================================================
 * This stylesheet provides all styling for the step-through tutorial experience.
 * Used in conjunction with tutorial-system.js
 */

/* ==========================================================================
   Scroll Lock During Tutorial
   ========================================================================== */

/* 
 * Note: User scroll is blocked via JavaScript (wheel event prevention).
 * We do NOT use position:fixed or overflow:hidden on body because that
 * breaks scrollIntoView() for elements inside modals and containers.
 * The tutorial system programmatically scrolls elements into view.
 */

/* ==========================================================================
   Tutorial Overlay & Backdrop
   ========================================================================== */

.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.tutorial-overlay.active {
  pointer-events: auto;
}

.tutorial-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.15);
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tutorial-overlay.active .tutorial-backdrop {
  opacity: 1;
}

/* ==========================================================================
   Spotlight Effect
   ========================================================================== */

.tutorial-spotlight {
  position: absolute;
  z-index: 10002;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  border-radius: 8px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.tutorial-spotlight::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 3px solid #005C99;
  border-radius: 12px;
  animation: tutorial-pulse 2s ease-in-out infinite;
}

@keyframes tutorial-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 92, 153, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(0, 92, 153, 0);
  }
}

/* ==========================================================================
   Tooltip Container
   ========================================================================== */

.tutorial-tooltip {
  position: absolute;
  z-index: 10003;
  max-width: 420px;
  min-width: 320px;
  width: max-content;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.tutorial-overlay.active .tutorial-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* Tooltip Arrow */
.tutorial-tooltip::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #ffffff;
  transform: rotate(45deg);
  z-index: -1;
}

/* Arrow positions */
.tutorial-tooltip.position-top::before {
  bottom: -8px;
  left: 50%;
  margin-left: -8px;
  box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.1);
}

.tutorial-tooltip.position-bottom::before {
  top: -8px;
  left: 50%;
  margin-left: -8px;
  box-shadow: -2px -2px 8px rgba(0, 0, 0, 0.1);
}

.tutorial-tooltip.position-left::before {
  right: -8px;
  top: 50%;
  margin-top: -8px;
  box-shadow: 4px -2px 8px rgba(0, 0, 0, 0.1);
}

.tutorial-tooltip.position-right::before {
  left: -8px;
  top: 50%;
  margin-top: -8px;
  box-shadow: -2px 4px 8px rgba(0, 0, 0, 0.1);
}

/* Center position - no arrow */
.tutorial-tooltip.position-center::before {
  display: none;
}

/* ==========================================================================
   Tooltip Header
   ========================================================================== */

.tutorial-tooltip-header {
  background: linear-gradient(135deg, #005C99 0%, #102950 100%);
  color: #ffffff !important;
  padding: 1rem 1.25rem;
  border-radius: 16px 16px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.tutorial-tooltip-header h1,
.tutorial-tooltip-header h2,
.tutorial-tooltip-header h3,
.tutorial-tooltip-header h4,
.tutorial-tooltip-header h5,
.tutorial-tooltip-header h6,
.tutorial-tooltip-title {
  color: #ffffff !important;
}

.tutorial-tooltip-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.tutorial-tooltip-title i {
  font-size: 1rem;
  opacity: 0.9;
  flex-shrink: 0;
}

.tutorial-step-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
  text-align: center;
  min-width: 50px;
}

/* ==========================================================================
   Tooltip Body
   ========================================================================== */

.tutorial-tooltip-body {
  padding: 1.25rem;
}

.tutorial-tooltip-content {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #334155;
  margin-bottom: 0;
}

.tutorial-tooltip-content strong {
  color: #102950;
}

.tutorial-tooltip-content code {
  background: #f1f5f9;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.85em;
  color: #005C99;
}

/* ==========================================================================
   Tooltip Footer & Actions
   ========================================================================== */

.tutorial-tooltip-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tutorial-btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.tutorial-btn-primary {
  background: linear-gradient(135deg, #005C99 0%, #102950 100%);
  color: #ffffff;
}

.tutorial-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 92, 153, 0.3);
}

.tutorial-btn-secondary {
  background: #f1f5f9;
  color: #64748b;
}

.tutorial-btn-secondary:hover {
  background: #e2e8f0;
  color: #334155;
}

.tutorial-btn-skip {
  background: transparent;
  color: #94a3b8;
  font-size: 0.8rem;
  padding: 0.375rem 0.75rem;
}

.tutorial-btn-skip:hover {
  color: #64748b;
  text-decoration: underline;
}

.tutorial-btn-group {
  display: flex;
  gap: 0.5rem;
}

/* ==========================================================================
   Progress Indicator
   ========================================================================== */

.tutorial-progress {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
  max-width: 180px;
}

.tutorial-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e2e8f0;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.tutorial-progress-dot.active {
  background: #005C99;
  transform: scale(1.2);
}

.tutorial-progress-dot.completed {
  background: #16a34a;
}

/* ==========================================================================
   Welcome Modal (First Step)
   ========================================================================== */

.tutorial-welcome-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10004;
  max-width: 480px;
  width: 90%;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: auto;
}

.tutorial-overlay.active .tutorial-welcome-modal {
  opacity: 1;
  pointer-events: auto;
}

.tutorial-welcome-header {
  background: linear-gradient(135deg, #005C99 0%, #102950 100%);
  color: #ffffff !important;
  padding: 2rem;
  text-align: center;
}

.tutorial-welcome-header h1,
.tutorial-welcome-header h2,
.tutorial-welcome-header h3,
.tutorial-welcome-header h4,
.tutorial-welcome-header h5,
.tutorial-welcome-header h6 {
  color: #ffffff !important;
}

.tutorial-welcome-icon {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.75rem;
}

.tutorial-welcome-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color:white !important; 
}

.tutorial-welcome-subtitle {
  font-size: 0.95rem;
  opacity: 0.9;
  margin: 0;
}

.tutorial-welcome-body {
  padding: 1.5rem 2rem;
  text-align: center;
}

.tutorial-welcome-text {
  font-size: 1rem;
  line-height: 1.7;
  color: #334155;
  margin-bottom: 1.5rem;
}

.tutorial-welcome-features {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.tutorial-welcome-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: #475569;
}

.tutorial-welcome-feature i {
  width: 24px;
  height: 24px;
  background: #dbeafe;
  color: #005C99;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.tutorial-welcome-footer {
  padding: 0 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tutorial-btn-start {
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  z-index: 10010;
}

/* ==========================================================================
   Completion Modal (Final Step)
   ========================================================================== */

.tutorial-completion-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10004;
  max-width: 420px;
  width: 90%;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  text-align: center;
  opacity: 0;
  transition: all 0.3s ease;
}

.tutorial-overlay.active .tutorial-completion-modal {
  opacity: 1;
}

.tutorial-completion-header {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #ffffff !important;
  padding: 2rem;
}

.tutorial-completion-header h1,
.tutorial-completion-header h2,
.tutorial-completion-header h3,
.tutorial-completion-header h4,
.tutorial-completion-header h5,
.tutorial-completion-header h6 {
  color: #ffffff !important;
}

.tutorial-completion-icon {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2.5rem;
  animation: tutorial-checkmark 0.6s ease-out;
}

@keyframes tutorial-checkmark {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.tutorial-completion-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: #ffffff !important;
}

.tutorial-completion-body {
  padding: 1.5rem 2rem;
}

.tutorial-completion-text {
  font-size: 1rem;
  line-height: 1.6;
  color: #334155;
  margin-bottom: 1.5rem;
}

.tutorial-completion-footer {
  padding: 0 2rem 2rem;
}

.tutorial-btn-finish {
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  justify-content: center;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

/* ==========================================================================
   Support Button Integration
   ========================================================================== */

.support-base-button.tutorial-available::after {
  content: '';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  background: #E8AC32;
  border-radius: 50%;
  border: 2px solid #ffffff;
  animation: tutorial-badge-pulse 2s ease-in-out infinite;
}

@keyframes tutorial-badge-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* Review Tutorial Button in Support Modal */
.tutorial-review-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #E8AC32 0%, #d4991f 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.tutorial-review-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232, 172, 50, 0.4);
}

.tutorial-review-btn i {
  font-size: 1rem;
}

.tutorial-completed-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  background: #dcfce7;
  color: #16a34a;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 0.5rem;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
  .tutorial-tooltip {
    max-width: 320px;
    min-width: 260px;
  }

  .tutorial-tooltip-header {
    padding: 0.875rem 1rem;
  }

  .tutorial-tooltip-title {
    font-size: 1rem;
  }

  .tutorial-tooltip-body {
    padding: 1rem;
  }

  .tutorial-tooltip-content {
    font-size: 0.9rem;
  }

  .tutorial-tooltip-footer {
    padding: 0.875rem 1rem;
    flex-wrap: wrap;
  }

  .tutorial-welcome-modal,
  .tutorial-completion-modal {
    max-width: 95%;
  }

  .tutorial-welcome-header,
  .tutorial-completion-header {
    padding: 1.5rem;
  }

  .tutorial-welcome-body,
  .tutorial-completion-body {
    padding: 1.25rem 1.5rem;
  }
}

/* ==========================================================================
   Animation Utilities
   ========================================================================== */

.tutorial-fade-in {
  animation: tutorial-fade-in 0.3s ease-out forwards;
}

@keyframes tutorial-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tutorial-bounce {
  animation: tutorial-bounce 0.6s ease;
}

@keyframes tutorial-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* ==========================================================================
   Screen Lock Indicator
   ========================================================================== */

.tutorial-lock-indicator {
  position: fixed;
  top: 16px;
  left: 16px;
  transform: none;
  z-index: 10002;
  background: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tutorial-overlay.active .tutorial-lock-indicator {
  opacity: 1;
}

.tutorial-lock-indicator i {
  color: #E8AC32;
}

/* ==========================================================================
   Close Button (Top Right X)
   ========================================================================== */

.tutorial-close-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10006;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  color: #ffffff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
}

.tutorial-overlay.active .tutorial-close-btn {
  opacity: 1;
}

.tutorial-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

.tutorial-close-btn:focus {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* ==========================================================================
   Pulse Attention Animation (for pulseOnComplete)
   ========================================================================== */

@keyframes tutorial-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(40, 167, 69, 0);
    transform: scale(1.05);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    transform: scale(1);
  }
}

.tutorial-pulse-attention {
  animation: tutorial-pulse 0.8s ease-in-out infinite;
  position: relative;
  z-index: 100;
}
