/* ═══════════════════════════════════════════════════════════════
   WayPilot – Public Tracking Page
   Design system: Clean eCommerce, Mobile-first, CSS Variables
═══════════════════════════════════════════════════════════════ */

/* ── Variables & Reset ─────────────────────────────────────── */
:root {
  --tp-primary:    #2563EB;
  --tp-secondary:  #10B981;
  --tp-accent:     #F59E0B;
  --tp-bg:         #F8FAFC;
  --tp-surface:    #FFFFFF;
  --tp-border:     #E2E8F0;
  --tp-text:       #0F172A;
  --tp-muted:      #64748B;
  --tp-radius:     14px;
  --tp-shadow:     0 4px 24px rgba(0,0,0,.07);
  --tp-shadow-lg:  0 12px 48px rgba(0,0,0,.12);
  --tp-font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --tp-mono:       'JetBrains Mono', 'Fira Code', monospace;
  --tp-transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Status colors */
.tp-status--delivered    { --tp-status-color: var(--tp-secondary); }
.tp-status--in_transit   { --tp-status-color: var(--tp-primary); }
.tp-status--out_for_delivery { --tp-status-color: var(--tp-accent); }
.tp-status--failed_attempt   { --tp-status-color: #EF4444; }
.tp-status--exception        { --tp-status-color: #EF4444; }
.tp-status--info_received    { --tp-status-color: #8B5CF6; }
.tp-status--pending          { --tp-status-color: var(--tp-muted); }

/* ── Wrapper ────────────────────────────────────────────────── */
.tp-wrap {
  font-family: var(--tp-font);
  color: var(--tp-text);
  max-width: 760px;
  margin: 0 auto;
  padding: 0px 16px 64px;
  margin-top: -100px;
}
@media (min-width: 640px) {
  .tp-wrap { padding: 0px 24px 80px; margin-top: -120px; }
}

/* ── Header / Logo ──────────────────────────────────────────── */
.tp-header {
  text-align: center;
  margin-bottom: 32px;
}
.tp-logo {
  max-height: 48px;
  width: auto;
}

/* ── Search Card ────────────────────────────────────────────── */
.tp-search-card {
  background: var(--tp-surface);
  border-radius: var(--tp-radius);
  box-shadow: var(--tp-shadow);
  padding: 40px 32px;
  text-align: center;
  transition: box-shadow var(--tp-transition);
}

.tp-search-card:focus-within {
  box-shadow: var(--tp-shadow-lg), 0 0 0 3px color-mix(in srgb, var(--tp-primary) 20%, transparent);
}

.tp-search-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
  animation: tp-float 3s ease-in-out infinite;
}

@keyframes tp-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.tp-search-title {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 8px;
  color: var(--tp-text);
}

.tp-search-subtitle {
  color: var(--tp-muted);
  font-size: 15px;
  margin: 0 0 28px;
  line-height: 1.5;
}

/* ── Search Input Group ─────────────────────────────────────── */
.tp-input-group {
  display: flex;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
}

.tp-input {
  flex: 1;
  height: 52px;
  padding: 0 18px;
  border: 2px solid var(--tp-border);
  border-radius: 10px;
  font-size: 15px;
  font-family: var(--tp-mono);
  color: var(--tp-text);
  background: var(--tp-bg);
  transition: border-color var(--tp-transition), box-shadow var(--tp-transition);
  outline: none;
  min-width: 0;
}

.tp-input:focus {
  border-color: var(--tp-primary);
  background: var(--tp-surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tp-primary) 15%, transparent);
}

.tp-input::placeholder { color: var(--tp-muted); font-family: var(--tp-font); }

/* ── Buttons ────────────────────────────────────────────────── */
.tp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--tp-transition);
  white-space: nowrap;
  text-decoration: none;
}

.tp-btn-primary {
  background: var(--tp-primary);
  color: #fff;
  min-width: 110px;
}
.tp-btn-primary:hover  { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 16px color-mix(in srgb, var(--tp-primary) 40%, transparent); }
.tp-btn-primary:active { transform: translateY(0); }

.tp-btn-ghost {
  background: transparent;
  color: var(--tp-muted);
  font-size: 14px;
}
.tp-btn-ghost:hover { color: var(--tp-primary); }

/* Spinner */
.tp-spinner {
  width: 20px; height: 20px;
  animation: tp-spin 0.8s linear infinite;
}
@keyframes tp-spin { to { transform: rotate(360deg); } }

/* ── Error ──────────────────────────────────────────────────── */
.tp-error {
  margin-top: 14px;
  padding: 10px 16px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #B91C1C;
  border-radius: 8px;
  font-size: 14px;
  text-align: left;
}

/* ── Result ─────────────────────────────────────────────────── */
.tp-result {
  animation: tp-fadeup 0.4s ease both;
}

@keyframes tp-fadeup {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Status Hero ────────────────────────────────────────────── */
.tp-status-hero {
  background: var(--tp-surface);
  border-radius: var(--tp-radius);
  box-shadow: var(--tp-shadow);
  padding: 28px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  border-left: 5px solid var(--tp-status-color, var(--tp-primary));
}

.tp-status-icon {
  font-size: 40px;
  flex-shrink: 0;
  animation: tp-float 3s ease-in-out infinite;
}

.tp-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: color-mix(in srgb, var(--tp-status-color, var(--tp-primary)) 15%, transparent);
  color: var(--tp-status-color, var(--tp-primary));
  margin-bottom: 6px;
}

.tp-status-label {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}

.tp-status-meta {
  color: var(--tp-muted);
  font-size: 14px;
  margin: 0;
}

/* ── Details Grid ───────────────────────────────────────────── */
.tp-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 640px) {
  .tp-details-grid { grid-template-columns: repeat(4, 1fr); }
}

.tp-detail-card {
  background: var(--tp-surface);
  border-radius: 10px;
  box-shadow: var(--tp-shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tp-detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--tp-muted);
}

.tp-detail-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--tp-text);
  font-family: var(--tp-mono);
  word-break: break-all;
}

/* ── Progress Bar ───────────────────────────────────────────── */
.tp-progress-section {
  background: var(--tp-surface);
  border-radius: var(--tp-radius);
  box-shadow: var(--tp-shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.tp-progress-bar-track {
  height: 6px;
  background: var(--tp-border);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}

.tp-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--tp-primary), var(--tp-secondary));
  border-radius: 3px;
  width: 0%;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tp-progress-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.tp-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--tp-muted);
  transition: color var(--tp-transition);
}

.tp-progress-step.is-active { color: var(--tp-primary); }
.tp-progress-step.is-done   { color: var(--tp-secondary); }
.tp-progress-step.is-exception { color: #EF4444; }

.tp-step-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--tp-border);
  background: var(--tp-surface);
  transition: all var(--tp-transition);
  position: relative;
}

.tp-progress-step.is-done .tp-step-dot {
  background: var(--tp-secondary);
  border-color: var(--tp-secondary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tp-secondary) 20%, transparent);
}

.tp-progress-step.is-active .tp-step-dot {
  background: var(--tp-primary);
  border-color: var(--tp-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tp-primary) 20%, transparent);
  animation: tp-pulse 2s ease-in-out infinite;
}

@keyframes tp-pulse {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--tp-primary) 20%, transparent); }
  50%       { box-shadow: 0 0 0 8px color-mix(in srgb, var(--tp-primary) 10%, transparent); }
}

/* ── Section Title ──────────────────────────────────────────── */
.tp-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--tp-text);
  margin: 0 0 20px;
  letter-spacing: -0.2px;
}

/* ── Timeline ───────────────────────────────────────────────── */
.tp-timeline-section {
  background: var(--tp-surface);
  border-radius: var(--tp-radius);
  box-shadow: var(--tp-shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.tp-timeline {
  position: relative;
  padding-left: 28px;
}

.tp-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--tp-primary), var(--tp-border));
}

.tp-timeline-item {
  position: relative;
  padding-bottom: 24px;
  animation: tp-fadeup 0.4s ease both;
}

.tp-timeline-item:last-child { padding-bottom: 0; }

.tp-timeline-dot {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--tp-border);
  border: 2px solid var(--tp-surface);
  box-shadow: 0 0 0 2px var(--tp-border);
  z-index: 1;
}

.tp-timeline-item:first-child .tp-timeline-dot {
  background: var(--tp-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tp-primary) 25%, transparent);
}

.tp-timeline-time {
  font-size: 11px;
  color: var(--tp-muted);
  font-family: var(--tp-mono);
  margin-bottom: 2px;
}

.tp-timeline-location {
  font-size: 12px;
  font-weight: 600;
  color: var(--tp-primary);
  margin-bottom: 2px;
}

.tp-timeline-desc {
  font-size: 14px;
  color: var(--tp-text);
  line-height: 1.5;
  margin: 0;
}

/* ── Recommended Products ───────────────────────────────────── */
.tp-recommended-section {
  background: var(--tp-surface);
  border-radius: var(--tp-radius);
  box-shadow: var(--tp-shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.tp-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.tp-product-card {
  border: 1.5px solid var(--tp-border);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: var(--tp-text);
  display: flex;
  flex-direction: column;
  transition: all var(--tp-transition);
}

.tp-product-card:hover {
  border-color: var(--tp-primary);
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  transform: translateY(-2px);
}

.tp-product-img img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

.tp-product-info {
  padding: 10px 12px 6px;
  flex: 1;
}

.tp-product-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tp-product-price {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--tp-primary);
}

.tp-product-cta {
  display: block;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--tp-muted);
  border-top: 1px solid var(--tp-border);
}

/* ── Search Again ───────────────────────────────────────────── */
.tp-search-again {
  text-align: center;
  padding-top: 8px;
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .tp-search-card { padding: 28px 20px; }
  .tp-input-group { flex-direction: column; }
  .tp-btn-primary { width: 100%; }
  .tp-status-hero { flex-direction: column; text-align: center; }
  .tp-progress-steps { font-size: 9px; }
  .tp-step-dot { width: 12px; height: 12px; }
}