/* RouteBeam — track page */

@keyframes track-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(12px, -18px) scale(1.04); }
}

@keyframes track-fade-up {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes track-pulse {
  0%, 100% { box-shadow: 0 0 0 4px #fff, 0 0 0 8px rgba(255, 107, 74, 0.18); }
  50% { box-shadow: 0 0 0 4px #fff, 0 0 0 14px rgba(255, 107, 74, 0.08); }
}

@keyframes track-rail-fill {
  from { width: 0; }
  to { width: var(--rail-progress, 0%); }
}

@keyframes track-icon-pop {
  0% { transform: scale(0.85); opacity: 0; }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); opacity: 1; }
}

.page-track {
  background: #f4f7fb;
}

.page-track .footer {
  margin-top: 48px;
}

.track-shell {
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  isolation: isolate;
}

.track-bg {
  position: absolute;
  inset: -40px 0 auto;
  height: 420px;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.track-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: track-float 14s ease-in-out infinite;
}

.track-bg-orb--a {
  width: 320px;
  height: 320px;
  top: -80px;
  right: -60px;
  background: radial-gradient(circle, rgba(13, 148, 136, 0.35) 0%, transparent 70%);
}

.track-bg-orb--b {
  width: 280px;
  height: 280px;
  top: 40px;
  left: -80px;
  background: radial-gradient(circle, rgba(255, 107, 74, 0.22) 0%, transparent 70%);
  animation-delay: -5s;
}

.track-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
}

[data-animate] {
  opacity: 0;
  transform: translateY(22px);
}

[data-animate].is-visible {
  animation: track-fade-up 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.track-kicker {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
}

/* Search panel */
.track-search-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 32px;
  padding: 28px 32px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(226, 232, 240, 0.9);
  backdrop-filter: blur(12px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 24px 48px rgba(15, 23, 42, 0.06);
}

.track-search-copy {
  max-width: 52ch;
}

.track-search-copy h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.85rem, 3.2vw, 2.5rem);
  letter-spacing: -0.03em;
  color: #0f172a;
  line-height: 1.1;
}

.track-lead {
  margin: 12px 0 0;
  color: #64748b;
  font-size: 0.96rem;
  line-height: 1.55;
}

/* Unified search bar */
.track-search-bar {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.track-search-bar-field {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 18px;
  border-right: 1px solid #eef2f6;
}

.track-search-bar-field--brand {
  flex: 0 1 220px;
  max-width: 240px;
}

.track-search-bar-field--order {
  flex: 1 1 auto;
  min-width: min(100%, 280px);
}

.track-search-bar-field label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
  line-height: 1;
}

.track-search-input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  color: #0f172a;
  outline: none;
}

.track-search-input--mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.track-search-input::placeholder {
  color: #cbd5e1;
  font-weight: 500;
}

.track-search-input:focus {
  color: #0f172a;
}

.track-search-bar-field:focus-within {
  background: #fafbfc;
}

.track-search-btn {
  flex: 0 0 auto;
  align-self: center;
  margin: 8px 10px 8px 6px;
  padding: 14px 22px;
  border-radius: 12px;
  white-space: nowrap;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.track-search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(255, 107, 74, 0.28);
}

.track-search-btn svg {
  transition: transform 0.2s ease;
}

.track-search-btn:hover svg {
  transform: translateX(3px);
}

/* Not found */
.track-not-found,
.track-empty {
  text-align: center;
  padding: 48px 32px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.05);
}

.track-not-found-icon,
.track-empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  color: #94a3b8;
  animation: track-icon-pop 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

.track-not-found-icon svg,
.track-empty-icon svg {
  width: 100%;
  height: 100%;
}

.track-not-found h2,
.track-empty h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.5rem;
  color: #0f172a;
}

.track-not-found p,
.track-empty p {
  margin: 12px auto 0;
  max-width: 46ch;
  color: #64748b;
  line-height: 1.6;
}

.track-not-found strong {
  color: #334155;
  font-weight: 700;
}

.track-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
}

.track-suggestions-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #94a3b8;
  margin-right: 4px;
}

.track-suggestion-pill {
  display: inline-flex;
  padding: 9px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #cbd5e1;
  font-size: 0.84rem;
  font-weight: 700;
  color: #0f766e;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.track-suggestion-pill:hover {
  transform: translateY(-2px);
  border-color: #0d9488;
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.15);
}

.track-brand-tag {
  margin: 12px 0 0;
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ecfeff;
  color: #0f766e;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Receipt card */
.track-receipt {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 28px 60px rgba(15, 23, 42, 0.08);
}

.track-receipt-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 32px 36px;
  background: linear-gradient(135deg, #fff 0%, #f8fafc 55%, #f0fdfa 100%);
  border-bottom: 1px solid #eef2f6;
}

.track-awb {
  margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: clamp(1.35rem, 2.5vw, 1.9rem);
  letter-spacing: -0.02em;
  color: #0f172a;
}

.track-route-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
  color: #475569;
  font-weight: 600;
  font-size: 0.92rem;
}

.track-route-line svg {
  color: #94a3b8;
}

.track-status-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.track-status {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.track-status--delivered {
  background: #ecfdf5;
  color: #047857;
}

.track-status--intransit {
  background: #fff7ed;
  color: #c2410c;
}

.track-status--pending {
  background: #f0f9ff;
  color: #0369a1;
}

.track-status--cancelled {
  background: #fef2f2;
  color: #b91c1c;
}

.track-updated {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 600;
}

/* Milestones */
.track-milestones {
  --rail-progress: 0%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 28px 36px 32px;
  border-bottom: 1px solid #eef2f6;
  position: relative;
}

.track-milestones::before {
  content: "";
  position: absolute;
  left: 36px;
  right: 36px;
  top: 42px;
  height: 2px;
  background: #e2e8f0;
  z-index: 0;
}

.track-milestones::after {
  content: "";
  position: absolute;
  left: 36px;
  top: 42px;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, #0d9488, #14b8a6);
  z-index: 0;
  animation: track-rail-fill 1s cubic-bezier(0.22, 1, 0.36, 1) 0.4s forwards;
}

.track-milestone {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.track-milestone-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #cbd5e1;
  box-shadow: 0 0 0 4px #fff;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.track-milestone-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #94a3b8;
  max-width: 8ch;
  line-height: 1.25;
}

.track-milestone.is-done .track-milestone-dot {
  border-color: #0d9488;
  background: #0d9488;
}

.track-milestone.is-done .track-milestone-label {
  color: #0f766e;
}

.track-milestone.is-active .track-milestone-dot {
  border-color: #ff6b4a;
  background: #fff;
  animation: track-pulse 2s ease-in-out infinite;
}

.track-milestone.is-active .track-milestone-label {
  color: #ea580c;
}

/* Body */
.track-receipt-body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 0;
}

.track-log-section {
  padding: 28px 36px 36px;
  border-right: 1px solid #eef2f6;
}

.track-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}

.track-section-head h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
}

.track-section-head span {
  font-size: 0.78rem;
  font-weight: 700;
  color: #94a3b8;
}

.track-log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.track-log-item {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid #f1f5f9;
}

.track-log-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.track-log-item time {
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.track-log-item strong {
  display: block;
  font-size: 0.94rem;
  color: #0f172a;
}

.track-log-item p {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.5;
}

.track-log-item.is-current {
  margin: 0 -12px;
  padding: 16px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7ed 0%, #fffbeb 100%);
  border-top-color: transparent;
}

.track-log-item.is-current + .track-log-item {
  border-top-color: transparent;
}

.track-facts {
  padding: 28px 24px 36px;
  background: linear-gradient(180deg, #fafbfc 0%, #f8fafc 100%);
}

.track-fact-card {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid #e8edf2;
}

.track-fact-card:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.track-fact-card h3 {
  margin: 0 0 12px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
}

.track-fact-card--muted h3 {
  color: #94a3b8;
}

.track-dl {
  margin: 0;
}

.track-dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
}

.track-dl dt {
  margin: 0;
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 600;
}

.track-dl dd {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: #0f172a;
  text-align: right;
  word-break: break-word;
}

@media (max-width: 900px) {
  .track-search-panel {
    padding: 22px 20px;
  }

  .track-search-bar {
    flex-direction: column;
    overflow: visible;
    border-radius: 16px;
  }

  .track-search-bar-field {
    border-right: 0;
    border-bottom: 1px solid #eef2f6;
  }

  .track-search-bar-field--brand {
    flex: 1 1 auto;
    max-width: none;
  }

  .track-search-bar-field--order {
    min-width: 0;
  }

  .track-search-btn {
    width: calc(100% - 16px);
    margin: 0 8px 8px;
    justify-content: center;
  }

  .track-receipt-body {
    grid-template-columns: 1fr;
  }

  .track-log-section {
    border-right: 0;
    border-bottom: 1px solid #eef2f6;
  }

  .track-milestones {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 22px;
  }

  .track-milestones::before,
  .track-milestones::after {
    display: none;
  }

  .track-status-block {
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .track-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .track-search-panel {
    padding: 20px 16px;
  }

  .track-search-bar-field {
    padding: 12px 14px;
  }

  .track-receipt-head,
  .track-log-section,
  .track-facts {
    padding-left: 20px;
    padding-right: 20px;
  }

  .track-log-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .track-milestones {
    padding-left: 20px;
    padding-right: 20px;
  }

  .track-not-found,
  .track-empty {
    padding: 36px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-animate],
  [data-animate].is-visible {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .track-bg-orb,
  .track-milestone.is-active .track-milestone-dot,
  .track-milestones::after {
    animation: none;
  }

  .track-milestones::after {
    width: var(--rail-progress, 0%);
  }
}
