/* Delivery tracking — public page. Self-contained: no external framework,
   just this stylesheet + track-delivery.js building markup into #app. */

:root {
  --ink: #0b1220;
  --ink-soft: #4b5875;
  --ink-faint: #8a93a8;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --line: #e6eaf2;
  --sky: #0ea5e9;
  --cyan: #06b6d4;
  --blue: #2563eb;
  --amber: #f59e0b;
  --green: #16a34a;
  --red: #ef4444;
  --shadow-lg: 0 24px 60px -20px rgba(15, 45, 90, 0.35);
  --shadow-sm: 0 8px 24px -12px rgba(15, 45, 90, 0.25);
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #eaf6ff 0%, #f6fbff 38%, #f4f7fb 100%);
  overflow-x: hidden;
}

.msi {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  vertical-align: middle;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* ── Ambient fluid background ─────────────────────────────────────────── */
.bg-fluid {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  will-change: transform;
}
.blob-a {
  width: 46vw;
  height: 46vw;
  max-width: 620px;
  max-height: 620px;
  top: -14vw;
  left: -10vw;
  background: radial-gradient(circle at 30% 30%, var(--sky), transparent 70%);
  animation: drift-a 22s ease-in-out infinite;
}
.blob-b {
  width: 38vw;
  height: 38vw;
  max-width: 520px;
  max-height: 520px;
  top: 20vh;
  right: -12vw;
  background: radial-gradient(circle at 60% 40%, var(--cyan), transparent 70%);
  animation: drift-b 26s ease-in-out infinite;
}
.blob-c {
  width: 34vw;
  height: 34vw;
  max-width: 460px;
  max-height: 460px;
  bottom: -12vw;
  left: 18vw;
  background: radial-gradient(circle at 50% 50%, var(--blue), transparent 70%);
  opacity: 0.3;
  animation: drift-c 30s ease-in-out infinite;
}
@keyframes drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4vw, 5vh) scale(1.08); }
}
@keyframes drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5vw, 4vh) scale(1.1); }
}
@keyframes drift-c {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(3vw, -4vh) scale(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
}

/* ── Layout ────────────────────────────────────────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}
@media (min-width: 760px) {
  .page { max-width: 820px; padding: 36px 24px 56px; }
}
@media (min-width: 1100px) {
  .page { max-width: 1080px; padding: 44px 32px 64px; }
}

.fade-in {
  animation: fadeIn 0.5s ease both;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Glass card ────────────────────────────────────────────────────────── */
.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ── Brand row ─────────────────────────────────────────────────────────── */
.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 22px;
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  background: #fff;
}
.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
}

/* ── Hero: DO number + status pill ────────────────────────────────────── */
.hero {
  padding: 30px 26px 26px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.14), rgba(37, 99, 235, 0.08));
  z-index: -1;
}
.hero-lottie {
  display: block;
  width: 112px;
  height: 112px;
  margin: -6px auto 2px;
}
.hero-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 6px;
}
.hero-do {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0 0 14px;
  word-break: break-all;
  background: linear-gradient(120deg, var(--blue), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13.5px;
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.status-pill .msi { font-size: 18px; }
.status-pill.pending { background: linear-gradient(120deg, #94a3b8, #64748b); }
.status-pill.progress { background: linear-gradient(120deg, var(--sky), var(--blue)); }
.status-pill.delivered { background: linear-gradient(120deg, #22c55e, var(--green)); }
.status-pill.partial { background: linear-gradient(120deg, #fbbf24, var(--amber)); }
.status-pill.returned { background: linear-gradient(120deg, #f87171, var(--red)); }

/* ── Fluid stepper ─────────────────────────────────────────────────────── */
.stepper-card {
  margin-top: 18px;
  padding: 30px 22px 22px;
}
.stepper {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
}
.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 2;
}
/* Only an already-reached step (done or current) is interactive — a
   future step has nothing of its own to show yet, so it stays inert. */
.step.clickable { cursor: pointer; }
.step:focus-visible { outline: none; }
.step:focus-visible .step-node { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.3); }
.step.viewing .step-node { outline: 3px solid rgba(37, 99, 235, 0.35); outline-offset: 2px; }
.step-node {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 20px;
  transition: border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease,
    background 0.4s ease;
}
.step.done .step-node {
  border-color: var(--cyan);
  background: linear-gradient(135deg, var(--sky), var(--blue));
  color: #fff;
}
.step.active .step-node {
  border-color: var(--sky);
  background: linear-gradient(135deg, var(--sky), var(--blue));
  color: #fff;
  box-shadow: 0 0 0 6px rgba(14, 165, 233, 0.18);
  animation: pulse-ring 2.2s ease-out infinite;
}
.step.error .step-node {
  border-color: var(--red);
  background: linear-gradient(135deg, #f87171, var(--red));
  color: #fff;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.35); }
  70% { box-shadow: 0 0 0 10px rgba(14, 165, 233, 0); }
  100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}
.step-label {
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  max-width: 84px;
}
.step.done .step-label, .step.active .step-label { color: var(--ink); }

.stepper-track {
  position: absolute;
  top: 21px;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--line);
  border-radius: 4px;
  z-index: 1;
}
.stepper-track-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--sky), var(--cyan), var(--blue));
  background-size: 200% 100%;
  animation: fluid-shift 3.5s linear infinite;
  transition: width 0.8s cubic-bezier(0.65, 0, 0.35, 1);
  width: 0%;
}
.stepper-track-fill.is-error {
  background: linear-gradient(90deg, #f87171, var(--red));
  animation: none;
}
@keyframes fluid-shift {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .stepper-track-fill, .step.active .step-node { animation: none; }
}

.stepper-note {
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-soft);
  font-size: 13.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}
.stepper-note .msi { color: var(--blue); font-size: 18px; }
.stepper-note.error { background: #fef2f2; color: #b91c1c; }
.stepper-note.error .msi { color: var(--red); }
.note-time { font-weight: 800; color: var(--ink); }
.note-sep { color: var(--ink-faint); }

/* ── Proof-of-delivery photo thumbnail ─────────────────────────────────── */
.proof-photo-wrap {
  margin-top: 12px;
}
.proof-photo-thumb {
  display: block;
  width: 100%;
  max-width: 220px;
  height: 140px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.proof-photo-thumb:hover,
.proof-photo-thumb:focus-visible {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
  outline: none;
}
.proof-photo-caption {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.proof-photo-caption .msi { font-size: 16px; }

/* ── Full-screen photo lightbox ────────────────────────────────────────── */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(11, 18, 32, 0.88);
  cursor: zoom-out;
}
.photo-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.photo-lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.photo-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ── Details card ──────────────────────────────────────────────────────── */
.details-card {
  margin-top: 18px;
  padding: 22px;
}
.details-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin: 0 0 14px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--ink-soft); }
.detail-row .value { font-weight: 700; text-align: right; }

.item-list { margin-top: 4px; }
.item-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.item-row:last-child { border-bottom: none; }
.item-name { font-size: 14px; font-weight: 600; }
.item-qty { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.item-qty b { color: var(--ink); }

/* ── Search card (no DO number yet) ───────────────────────────────────── */
.search-card {
  padding: 34px 26px;
  text-align: center;
}
.search-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(37, 99, 235, 0.12));
  color: var(--blue);
}
.search-icon .msi { font-size: 30px; }
.search-title {
  font-size: 19px;
  font-weight: 800;
  margin: 0 0 6px;
}
.search-sub {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0 0 22px;
}
.search-form {
  display: flex;
  gap: 10px;
}
.search-input {
  flex: 1;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  font-size: 15px;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-input::placeholder { color: var(--ink-faint); text-transform: none; font-weight: 500; }
.search-input:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.14);
}
.btn {
  border: none;
  border-radius: 14px;
  padding: 13px 22px;
  font-family: inherit;
  font-weight: 800;
  font-size: 14.5px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(120deg, var(--sky), var(--blue));
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -14px rgba(37, 99, 235, 0.55); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }
.form-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--red);
  font-weight: 600;
}

/* ── Loading skeleton ──────────────────────────────────────────────────── */
.skeleton-wrap { padding: 30px 26px; }
.sk {
  border-radius: 12px;
  background: linear-gradient(90deg, #eef2f8 25%, #f8fafc 37%, #eef2f8 63%);
  background-size: 400% 100%;
  animation: sk-shimmer 1.4s ease infinite;
}
@keyframes sk-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.sk-line { height: 14px; margin: 0 auto 10px; }

/* ── Error state ───────────────────────────────────────────────────────── */
.error-card {
  padding: 40px 26px;
  text-align: center;
}
.error-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fef2f2;
  color: var(--red);
}
.error-icon .msi { font-size: 30px; }
.error-title { font-size: 18px; font-weight: 800; margin: 0 0 6px; }
.error-sub { font-size: 13.5px; color: var(--ink-soft); margin: 0 0 22px; }

/* ── Footer ────────────────────────────────────────────────────────────── */
.footer-note {
  text-align: center;
  margin-top: 28px;
  font-size: 12px;
  color: var(--ink-faint);
}

/* Companies can have many custom statuses (see Manage Statuses) — on a
   narrow screen a step-per-status tracker no longer fits by squeezing, so
   it becomes a horizontally-scrollable strip instead of wrapping/crushing
   labels. left:0/right:0 on .stepper-track still stretches to the full
   (unclipped) content width of its scrolling parent, so the progress line
   stays aligned with the steps even though it's wider than the viewport. */
@media (max-width: 600px) {
  .stepper-card { padding: 26px 0 20px; }
  .stepper {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 22px 6px;
    scrollbar-width: thin;
  }
  .step { flex: 0 0 auto; width: 78px; }
  .stepper-note { margin-left: 22px; margin-right: 22px; }
}

@media (max-width: 420px) {
  .hero-do { font-size: 24px; }
  .step-label { font-size: 11px; max-width: 68px; }
  .search-form { flex-direction: column; }
}
