/* ─── TRACK ORDER PAGE STYLES ─── */

.track-section {
  padding: 160px 20px 100px;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.track-header {
  text-align: center;
  margin-bottom: 60px;
}

.track-header h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.1;
}

.track-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 500px;
  margin: 0 auto;
}

/* Track Search Form */
.track-form-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.track-form-container.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-20px);
  position: absolute;
}

.track-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 40px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.track-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.1rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.track-input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 15px rgba(99, 102, 241, 0.2);
}

.btn-track {
  margin-top: 10px;
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-track:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -8px rgba(168, 85, 247, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.track-error {
  color: #ef4444;
  text-align: center;
  margin-top: 16px;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s;
}

.track-error.active {
  opacity: 1;
}

/* Tracking Results View */
.track-results {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(40px);
  position: absolute;
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.track-results.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  position: relative;
}

/* Order Info Card */
.order-info-card {
  padding: 32px 40px;
  margin-bottom: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
}

.order-detail-group h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  font-weight: 600;
}

.order-detail-group p {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
}

.order-detail-group .highlight {
  color: var(--primary);
  background: -webkit-linear-gradient(45deg, var(--primary), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Timeline */
.timeline-wrapper {
  padding: 40px;
}

.timeline {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 40px;
}

/* The background connecting line */
.timeline::before {
  content: '';
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  z-index: 0;
}

/* The active progress line */
.timeline-progress {
  position: absolute;
  top: 24px;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  border-radius: 2px;
  z-index: 1;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.6);
  overflow: hidden;
}

.timeline-progress::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  animation: loading-line 2s infinite linear;
  opacity: 1;
  transition: opacity 0.5s ease;
}

/* Hide the loading animation if the process is completely finished */
.timeline-progress.finished::after {
  opacity: 0;
  animation: none;
}

@keyframes loading-line {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* Individual Stage Nodes */
.timeline-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 120px;
  text-align: center;
}

.stage-dot {
  width: 52px;
  height: 52px;
  background: var(--bg);
  border: 4px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  color: rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

.stage-dot svg {
  width: 24px;
  height: 24px;
  transition: all 0.3s ease;
}

#stage1 {
  --stage-color: #3b82f6;
  --stage-shadow: rgba(59, 130, 246, 0.5);
  --stage-bg: rgba(21, 20, 20, 0.966);
}

#stage2 {
  --stage-color: #f59e0b;
  --stage-shadow: rgba(245, 158, 11, 0.5);
  --stage-bg: rgba(21, 20, 20, 0.966);
}

#stage3 {
  --stage-color: #8b5cf6;
  --stage-shadow: rgba(139, 92, 246, 0.5);
  --stage-bg: rgba(21, 20, 20, 0.966);
}

#stage4 {
  --stage-color: #ef4444;
  --stage-shadow: rgba(239, 68, 68, 0.5);
  --stage-bg: rgba(21, 20, 20, 0.966);
}

#stage5 {
  --stage-color: #06b6d4;
  --stage-shadow: rgba(6, 182, 212, 0.5);
  --stage-bg: rgba(21, 20, 20, 0.966);
}

#stage6 {
  --stage-color: #10ca8c;
  --stage-shadow: rgba(16, 185, 129, 0.5);
  --stage-bg: rgba(16, 185, 129, 0.582);
}

.timeline-stage.completed .stage-dot {
  border-color: transparent;
  background: var(--stage-color);
  color: #fff;
  box-shadow: 0 10px 20px -5px var(--stage-shadow);
}

.timeline-stage.completed-stage6 .stage-dot {
  border-color: transparent;
  background: var(--stage-color);
  color: #fff;
  box-shadow: 0 0 20px var(--stage-shadow), inset 0 0 10px var(--stage-bg);
  animation: pulse-border-dynamic 2s infinite;
}

.timeline-stage.active .stage-dot {
  border-color: var(--stage-color);
  background: var(--stage-bg);
  color: var(--stage-color);
  box-shadow: 0 0 20px var(--stage-shadow), inset 0 0 10px var(--stage-bg);
  animation: pulse-border-dynamic 2s infinite;
}

.timeline-stage.active .stage-dot svg {
  transform: scale(1.1);
}

@keyframes pulse-border-dynamic {
  0% {
    box-shadow: 0 0 0 0 var(--stage-shadow), inset 0 0 10px var(--stage-bg);
  }

  70% {
    box-shadow: 0 0 0 15px transparent, inset 0 0 10px var(--stage-bg);
  }

  100% {
    box-shadow: 0 0 0 0 transparent, inset 0 0 10px var(--stage-bg);
  }
}

.stage-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.timeline-stage.completed .stage-label,
.timeline-stage.active .stage-label {
  color: var(--text);
}

.reset-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s;
  display: block;
  margin: 0 auto;
}

.reset-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

/* Dynamic Stage Message */
.stage-message-container {
  position: relative;
  margin-top: 20px;
  margin-bottom: 40px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.stage-message-container.active {
  opacity: 1;
  transform: translateY(0);
}

.stage-message-pointer {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 12px solid rgba(255, 255, 255, 0.05);
  position: absolute;
  top: -12px;
  left: 0;
  transform: translateX(-50%);
  transition: left 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
  filter: drop-shadow(0 -1px 1px var(--msg-color, rgb(66, 205, 255)));
}

.stage-message-pointer::after {
  content: '';
  position: absolute;
  top: 1px;
  left: -9px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 11px solid var(--bg);
}

.stage-message-box {
  padding: 24px;
  border: 1.5px solid var(--msg-color, var(--cyan));
  background: var(--msg-bg, rgba(6, 182, 212, 0.05));
  box-shadow: 0 0 20px var(--msg-bg, rgba(6, 182, 212, 0.1)), inset 0 0 10px var(--msg-bg, rgba(6, 182, 212, 0.05));
  text-align: center;
  position: relative;
  z-index: 1;
}

.stage-message-box:hover {
  border: 2.5px solid var(--msg-color, var(--cyan));
}

.stage-message-box h4 {
  font-size: 1.2rem;
  color: var(--msg-color, var(--cyan));
  margin-bottom: 8px;
}

.stage-message-box p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Confetti Container & Particles */
#confettiContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti-particle {
  position: absolute;
  width: 10px;
  height: 20px;
  opacity: 0;
  transform-origin: center;
  animation: confetti-fall 3s ease-in-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-10vh) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* Responsive Timeline */
@media (max-width: 768px) {
  .timeline {
    flex-direction: column;
    align-items: flex-start;
    gap: 40px;
  }

  .timeline::before {
    top: 0;
    bottom: 0;
    left: 24px;
    width: 4px;
    height: auto;
  }

  .timeline-progress {
    top: 0;
    left: 24px;
    width: 4px;
    height: 0;
    transition: height 1s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .timeline-progress::after {
    background: linear-gradient(180deg, transparent, rgb(42, 220, 255), transparent);
    animation: loading-line-vertical 2s infinite linear;
  }

  @keyframes loading-line-vertical {
    0% {
      transform: translateY(-100%);
    }

    100% {
      transform: translateY(100%);
    }
  }

  .timeline-stage {
    flex-direction: row;
    width: 100%;
    text-align: left;
    gap: 24px;
  }

  .stage-dot {
    margin-bottom: 0;
    width: 48px;
    height: 48px;
  }

  .timeline .stage-message-container {
    width: calc(100% - 72px);
    margin-left: 72px;
    margin-top: -20px;
    /* pull it closer to the active stage above it */
    margin-bottom: 0;
  }
}