@import url("https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=Space+Mono:wght@400;700&display=swap");

*, *::after, *::before {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

/* ========================================
   ROOT / SHIPMENT DETAILS CARD
   ======================================== */
.root {
  padding: 0;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08);
  background: #fff;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
}

figure {
  display: flex;
  flex-direction: column;
  padding: 0;
}

figure figcaption {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Shipment info rows ── */
.qua {
  font-weight: 600;
  color: #6b7280;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 20px 0;
  font-family: 'DM Sans', sans-serif;
}

.ans {
  color: #1f2937;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 2px 20px 12px;
  border-bottom: 1px solid #f3f4f6;
  font-family: 'DM Sans', sans-serif;
}

.ans:last-of-type {
  border-bottom: none;
}

/* Make the tracking ID stand out */
#v_tracking_id {
  font-family: 'Space Mono', monospace;
  color: #2563eb;
  font-weight: 700;
  font-size: 0.88rem;
}

/* ── Status badge (hidden labels reused as data) ── */
#v_status {
  display: none !important;
}

/* ========================================
   SHIPMENT ROUTE VISUAL
   ======================================== */
.route-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: #f9fafb;
  border-top: 1px solid #f3f4f6;
}

.route-bar .origin,
.route-bar .destination {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-bar .route-track {
  flex: 1;
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.route-bar .route-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #10b981);
  border-radius: 2px;
  transition: width 1s ease;
}

.route-bar .route-icon {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  filter: none;
  transition: right 1s ease;
}

/* ── Status pill ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 20px 16px;
  font-family: 'DM Sans', sans-serif;
}

.status-pill.in-transit {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.status-pill.delivered {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.status-pill .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ========================================
   TIMELINE
   ======================================== */
.shipment-timeline {
  padding: 24px 20px 16px;
  border-top: 1px solid #f3f4f6;
}

.timeline-step {
  display: flex;
  gap: 14px;
  position: relative;
  opacity: 0;
  transform: translateY(8px);
  animation: stepFadeIn 0.4s ease forwards;
}

.timeline-step:nth-child(1) { animation-delay: 0.05s; }
.timeline-step:nth-child(2) { animation-delay: 0.1s; }
.timeline-step:nth-child(3) { animation-delay: 0.15s; }
.timeline-step:nth-child(4) { animation-delay: 0.2s; }
.timeline-step:nth-child(5) { animation-delay: 0.25s; }

@keyframes stepFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Indicator column (icon + line) ── */
.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.4s ease;
  /* Default: pending */
  background: #f3f4f6;
  border: 2px solid #e5e7eb;
  color: #9ca3af;
}

.step-line {
  width: 2px;
  height: 28px;
  flex-shrink: 0;
  transition: background 0.4s ease;
  /* Default: pending */
  background: #e5e7eb;
}

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

/* ── Step body ── */
.step-body {
  padding-bottom: 20px;
  min-height: 52px;
}

.timeline-step:last-child .step-body {
  padding-bottom: 4px;
}

.step-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 2px;
  line-height: 1.3;
  transition: color 0.3s;
}

.step-desc {
  font-size: 0.76rem;
  color: #9ca3af;
  margin: 0;
  line-height: 1.4;
  transition: color 0.3s;
}

/* ── COMPLETED state ── */
.timeline-step.completed .step-icon {
  background: #ecfdf5;
  border-color: #10b981;
  color: #10b981;
}

.timeline-step.completed .step-line {
  background: #10b981;
}

.timeline-step.completed .step-title {
  color: #374151;
}

.timeline-step.completed .step-desc {
  color: #6b7280;
}

/* ── ACTIVE state ── */
.timeline-step.active .step-icon {
  background: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
  animation: activeGlow 2s infinite;
}

@keyframes activeGlow {
  0%, 100% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); }
  50% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.05); }
}

.timeline-step.active .step-line {
  background: #e5e7eb;
}

.timeline-step.active .step-title {
  color: #2563eb;
}

.timeline-step.active .step-desc {
  color: #6b7280;
}

/* ── PENDING state ── */
.timeline-step.pending .step-icon {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #d1d5db;
}

.timeline-step.pending .step-line {
  background: #e5e7eb;
}

.timeline-step.pending .step-title {
  color: #d1d5db;
}

.timeline-step.pending .step-desc {
  color: #e5e7eb;
}

/* ========================================
   TRACKING FORM ENHANCEMENTS
   ======================================== */
#trackForm textarea {
  font-family: 'Space Mono', monospace;
  font-size: 0.9rem;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.3s, box-shadow 0.3s;
  resize: none;
}

#trackForm textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

#trackResponse p span {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ── "Nothing to see" placeholder ── */
#nothingtosee {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif;
  font-style: italic;
}

/* ── Tracking result reveal animation ── */
#trackingResultBox {
  animation: revealCard 0.5s ease-out;
}

@keyframes revealCard {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .qua { font-size: 0.65rem; padding: 10px 16px 0; }
  .ans { font-size: 0.85rem; padding: 2px 16px 10px; }
  .shipment-timeline { padding: 20px 16px 12px; }
  .step-icon { width: 28px; height: 28px; }
  .step-icon svg { width: 13px; height: 13px; }
  .step-line { height: 24px; }
  .step-title { font-size: 0.82rem; }
  .step-desc { font-size: 0.72rem; }
  .route-bar { padding: 12px 16px; }
}

/* ========================================
   HIDE OLD STEP BLOCKS (backward compat)
   ======================================== */
.order-track {
  display: none !important;
}