/* ========================================
   Prototype A: Layout Overrides
   Scoped to #demo-mount.prototype-a when embedded
   ======================================== */

/* Prototype wrapper: grid on desktop, block otherwise */
.prototype-wrapper {
  max-width: 1380px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* When embedded, don't force full viewport height */
#demo-mount .prototype-wrapper {
  min-height: auto;
  padding: 0;
}

.prototype-inner {
  display: grid;
  width: 100%;
  gap: 0;
}

/* ========================================
   Side Panel (Desktop >1024px)
   ======================================== */
.side-panel {
  display: none;
  flex-direction: column;
  padding: 24px 20px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 20px 0 0 20px;
  min-height: 400px;
}

.panel-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
}

.panel-step {
  display: flex;
  gap: 14px;
  padding: 16px 12px;
  position: relative;
  opacity: 0.45;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel-step.is-active {
  opacity: 1;
  background: var(--color-accent-light);
  border-radius: 12px;
}

.panel-step.is-complete {
  opacity: 0.7;
}

.panel-step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.panel-step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e8e8ed;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.35s ease;
  flex-shrink: 0;
}

.panel-step.is-active .panel-step-number {
  background: var(--color-accent);
  color: white;
  box-shadow: 0 2px 8px rgba(100, 46, 255, 0.3);
}

.panel-step.is-complete .panel-step-number {
  background: #34c759;
  color: white;
}

.panel-step-line {
  width: 2px;
  flex: 1;
  min-height: 20px;
  background: #e0e0e5;
  margin: 6px 0;
  border-radius: 1px;
  transition: background 0.35s ease;
}

.panel-step.is-complete .panel-step-line {
  background: #34c759;
}

.panel-step.is-active .panel-step-line {
  background: var(--color-accent);
  opacity: 0.3;
}

.panel-step:last-child .panel-step-line {
  display: none;
}

.panel-step-content {
  padding-top: 4px;
}

.panel-step-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.panel-step-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

/* Side panel replay button — hidden until complete */
.panel-replay {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  background: var(--color-accent);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.panel-replay:hover {
  background: #5526d9;
  transform: scale(1.02);
}

.prototype-inner:has(.demo-container[data-state="complete"]) .panel-replay {
  display: flex;
}

/* ========================================
   Tablet Stepper Bar (768–1024px)
   ======================================== */
.tablet-stepper {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  border-radius: 20px 20px 0 0;
}

.tablet-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 20px;
  opacity: 0.4;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.tablet-step.is-active {
  opacity: 1;
  background: var(--color-accent-light);
}

.tablet-step.is-complete {
  opacity: 0.65;
}

.tablet-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8e8ed;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.35s ease;
}

.tablet-step.is-active .tablet-step-number {
  background: var(--color-accent);
  color: white;
  box-shadow: 0 2px 8px rgba(100, 46, 255, 0.3);
}

.tablet-step.is-complete .tablet-step-number {
  background: #34c759;
  color: white;
}

.tablet-step-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.tablet-step-connector {
  width: 24px;
  height: 2px;
  background: #e0e0e5;
  flex-shrink: 0;
  transition: background 0.35s ease;
}

.tablet-step-connector.is-complete {
  background: #34c759;
}

/* ========================================
   Play / Replay Button Overrides
   ======================================== */
/* Hide the in-stage play-again button entirely in prototype */
.prototype-a .play-again {
  display: none !important;
}

/* Hide the mobile overlay close button — we use Replay Demo instead */
.prototype-a .demo-overlay-close {
  display: none !important;
}

/* Hide tap-trigger (Play Demo) when demo is running */
.demo-container[data-state="active"] .tap-trigger,
.demo-container[data-state="step-1"] .tap-trigger,
.demo-container[data-state="step-2"] .tap-trigger,
.demo-container[data-state="step-3"] .tap-trigger {
  display: none !important;
}

/* ========================================
   Mobile Progress Strip (Phone <768px)
   ======================================== */
.mobile-strip {
  display: none;
  position: absolute;
  top: 30px;
  left: 0;
  right: 0;
  z-index: 12;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.15) 80%, transparent 100%);
}

.mobile-strip-dots {
  display: flex;
  align-items: center;
  gap: 0;
}

.mobile-strip-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  transition: all 0.35s ease;
}

.mobile-strip-dot.is-active {
  background: var(--color-accent);
  color: white;
  box-shadow: 0 2px 8px rgba(100, 46, 255, 0.4);
}

.mobile-strip-dot.is-complete {
  background: #34c759;
  color: white;
}

.mobile-strip-bar {
  width: 24px;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 1px;
}

.mobile-strip-caption {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  max-width: 300px;
  line-height: 1.3;
  min-height: 1.2em;
  transition: opacity 0.3s ease;
}

/* ========================================
   Desktop Breakpoint (>1024px)
   ======================================== */
@media (min-width: 1025px) {
  .prototype-inner {
    grid-template-columns: 240px 1fr;
  }

  .side-panel {
    display: flex;
  }

  .tablet-stepper {
    display: none !important;
  }

  .mobile-strip {
    display: none !important;
  }

  /* Hide the original horizontal timeline and step instruction */
  .prototype-a .demo-timeline {
    display: none !important;
  }

  .prototype-a .step-instruction {
    display: none !important;
  }

  /* Adjust demo-container gap since we removed the timeline/instruction */
  .prototype-a .demo-container {
    gap: 0 !important;
  }

  /* Round only the right side of the stage */
  .prototype-a .desktop-stage {
    border-radius: 0 var(--stage-radius) var(--stage-radius) 0;
  }

  /* Match overlay border-radius to the stage */
  .prototype-a .trigger-area {
    border-radius: 0 var(--stage-radius) var(--stage-radius) 0;
  }
}

/* ========================================
   Tablet Breakpoint (768–1024px)
   ======================================== */
@media (min-width: 768px) and (max-width: 1024px) {
  .side-panel {
    display: none !important;
  }

  .tablet-stepper {
    display: flex;
  }

  /* Hide stepper until demo starts */
  .prototype-inner:has(.demo-container[data-state="idle"]) .tablet-stepper {
    display: none !important;
  }

  .mobile-strip {
    display: none !important;
  }

  /* Hide original timeline and step instruction */
  .prototype-a .demo-timeline {
    display: none !important;
  }

  .prototype-a .step-instruction {
    display: none !important;
  }

  .prototype-a .demo-container {
    gap: 0 !important;
    position: relative;
  }

  /* Show Replay button on complete (even on non-touch desktop) */
  .prototype-a .demo-container[data-state="complete"] .tap-trigger {
    display: flex;
    position: absolute;
    top: auto;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
  }

  /* Show all inbox rows including the "new" email */
  .prototype-a .window-sidebar {
    max-height: none;
  }

  /* Stage gets flat top to join with stepper bar */
  .prototype-a .desktop-stage {
    border-radius: 0 0 var(--stage-radius) var(--stage-radius);
  }
}

/* ========================================
   Phone Breakpoint (<768px)
   ======================================== */
@media (max-width: 767px) {
  .side-panel {
    display: none !important;
  }

  .tablet-stepper {
    display: none !important;
  }

  .mobile-strip {
    display: flex;
  }

  /* Hide original timeline and step instruction */
  .prototype-a .demo-timeline {
    display: none !important;
  }

  .prototype-a .step-instruction {
    display: none !important;
  }

  .prototype-a .demo-container {
    gap: 0 !important;
  }

  /* Show Replay button on complete (even on non-touch desktop) */
  .prototype-a .demo-container[data-state="complete"] .tap-trigger {
    display: flex;
    position: absolute;
    top: auto;
    bottom: 6%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
  }

  /* Hide menu bar on mobile — it doesn't scale properly */
  .prototype-a .menu-bar {
    display: none !important;
  }

  /* Remove the dark stage background that peeks through at rounded edges */
  .prototype-a .desktop-stage {
    background: transparent;
  }

  /* Position mobile strip flush at top to cover stage edge */
  .mobile-strip {
    top: 0;
    padding-top: 10px;
  }

  /* Hide last 3 dock icons on mobile to reduce crowding */
  .prototype-a .dock-icon:nth-child(n+6) {
    display: none;
  }

  /* Shift Mail App window down so progress strip text is readable */
  .prototype-a .app-window {
    top: 52%;
    max-height: 70%;
  }

  /* Compact inbox rows so both fit without clipping */
  .prototype-a .sidebar-header {
    padding: 8px 12px;
  }

  .prototype-a .window-list {
    padding: 4px;
  }

  .prototype-a .window-row {
    padding: 8px 10px;
  }

  /* Hide preview text on non-highlighted rows to save vertical space */
  .prototype-a .window-row:not(.is-selected) .row-preview {
    display: none;
  }
}
