/* ============================================================================
   ORDER TRACKING
   ----------------------------------------------------------------------------
   Shared by the panel tracker (/user/track) and the storefront tracker
   (/track), because both render partials.track-body. Loaded by both layouts so
   the same markup cannot look different depending on where it appears.

   The panel palette is redeclared here as fallbacks: the storefront layout does
   not load user-panel.css, so without these the block would render colourless.
   Identical values to user-panel.css, so loading both is harmless.
   ========================================================================== */

.trk-card {
  --up-maroon: #4A0E18;
  --up-gold: #C9A227;
  --up-cream: #FFFBF0;
  --up-ink: #2A1216;
  --up-muted: #8A7A6B;
  --up-line: #F1E4C3;

  display: grid;
  gap: 1rem;
}

.trk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
/* min-width:0 so a long order number wraps instead of forcing the row wider
   than its container -- a flex child will not shrink below its content. */
.trk-head-main { min-width: 0; }
.trk-no { font-size: 1.05rem; font-weight: 900; color: var(--up-maroon); letter-spacing: .02em; }
.trk-meta { font-size: .76rem; color: var(--up-muted); margin-top: .15rem; }

.trk-now { border-radius: 14px; padding: .85rem 1rem; border: 1px solid transparent; }
.trk-now.is-live { background: #FBF3DE; border-color: #F5DE9B; }
.trk-now.is-cancelled { background: #FEE2E2; border-color: #FECACA; }
.trk-now-label { font-weight: 900; font-size: .95rem; }
.trk-now.is-live .trk-now-label { color: #8A6813; }
.trk-now.is-cancelled .trk-now-label { color: #991B1B; }
.trk-now-hint { font-size: .78rem; color: var(--up-muted); margin-top: .15rem; }

/* Horizontal on desktop, a vertical rail on narrow screens. */
.trk-steps { display: flex; gap: .35rem; list-style: none; padding: .35rem 0 .1rem; margin: 0; }
.trk-step { flex: 1 1 0; min-width: 0; text-align: center; position: relative; }
.trk-dot {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin: 0 auto .4rem;
  border-radius: 50%; border: 2px solid var(--up-line);
  background: #fff; color: #fff; position: relative; z-index: 1;
}
.trk-dot svg { width: 12px; height: 12px; }
.trk-dot-in { width: 7px; height: 7px; border-radius: 50%; background: var(--up-line); }
.trk-step.is-done .trk-dot { background: #1F7A4D; border-color: #1F7A4D; }
.trk-step.is-now .trk-dot { background: var(--up-gold); border-color: var(--up-gold); box-shadow: 0 0 0 4px rgba(212, 175, 55, .22); }
.trk-step-label { font-size: .66rem; font-weight: 700; color: var(--up-muted); line-height: 1.3; display: block; }
.trk-step.is-done .trk-step-label { color: #1F7A4D; }
.trk-step.is-now .trk-step-label { color: var(--up-maroon); font-weight: 900; }

/* Connector rail between the dots. */
.trk-step:not(:last-child)::after {
  content: ''; position: absolute; top: 13px; left: 50%; width: 100%; height: 2px;
  background: var(--up-line); z-index: 0;
}
.trk-step.is-done:not(:last-child)::after { background: #1F7A4D; }

.trk-items { border: 1px solid var(--up-line); border-radius: 14px; overflow: hidden; }
.trk-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .85rem; background: #fff; }
.trk-item + .trk-item { border-top: 1px solid var(--up-line); }
/* Same reason as .trk-head-main: product names are long and unbreakable-ish,
   so the name column needs to be allowed to wrap. */
.trk-item-main { min-width: 0; }
.trk-item-name { font-size: .85rem; font-weight: 700; color: var(--up-ink); }
.trk-item-opts { font-size: .72rem; color: var(--up-muted); margin-top: .1rem; }
.trk-item-num { display: flex; align-items: baseline; gap: .55rem; white-space: nowrap; }
.trk-item-qty { font-size: .74rem; color: var(--up-muted); font-weight: 700; }
.trk-item-total { font-size: .88rem; font-weight: 900; color: var(--up-maroon); }

.trk-totals { display: grid; gap: .4rem; margin: 0; font-size: .82rem; }
.trk-totals > div { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.trk-totals dt { color: var(--up-muted); }
.trk-totals dd { margin: 0; font-weight: 800; color: var(--up-ink); }
.trk-totals .is-free dd { color: #1F7A4D; }
.trk-totals .is-fee dd { color: #991B1B; }
.trk-grand { border-top: 1px solid var(--up-line); padding-top: .55rem; margin-top: .15rem; }
.trk-grand dt { font-weight: 800; color: var(--up-ink); }
.trk-grand dd { font-size: 1rem; font-weight: 900; color: var(--up-maroon); }

.trk-ship { background: var(--up-cream); border: 1px solid var(--up-line); border-radius: 14px; padding: .75rem .9rem; }
.trk-ship-label { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--up-muted); margin-bottom: .25rem; }
.trk-ship-body { font-size: .82rem; color: var(--up-ink); line-height: 1.5; }

/* Public-tracker redaction. Muted rather than alarming: the order genuinely
   exists, we are just not going to hand a stranger somebody's street address. */
.trk-ship.is-hidden { background: #F7F7F8; border-style: dashed; }
.trk-ship.is-hidden .trk-ship-body { color: var(--up-muted); font-style: italic; }
.trk-ship-link { display: inline-block; margin-top: .5rem; font-size: .8rem; font-weight: 800; color: var(--up-maroon); text-decoration: underline; text-underline-offset: 3px; }

/* The status pill is defined in user-panel.css for the panel; the storefront
   layout does not load that, so the tracker brings its own copy. */
.status-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .7rem; border-radius: 99px;
  font-size: .72rem; font-weight: 800; white-space: nowrap; line-height: 1.5;
}
.status-pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.trk-card .status-pending { background: #FEF3C7; color: #92400E; }
.trk-card .status-accepted { background: #CFFAFE; color: #155E75; }
.trk-card .status-processing { background: #EDE9FE; color: #6D28D9; }
.trk-card .status-ready_for_delivery { background: #E0E7FF; color: #3730A3; }
.trk-card .status-shipped { background: #DBEAFE; color: #1E40AF; }
.trk-card .status-delivered { background: #D1FAE5; color: #065F46; }
.trk-card .status-cancelled { background: #FEE2E2; color: #991B1B; }

/* ============================================================================
   PUBLIC TRACKER SHELL (/track)
   ----------------------------------------------------------------------------
   The panel tracker wears user-panel.css and reuses up-panel; this one is a
   guest on the storefront, so it gets its own classes rather than pretending to
   be a panel. Both end up rendering partials.track-body, which is why the
   trk-* rules above are shared and the trkpage-* rules below are not.

   The hero is the page: tracking is a one-field job, so the field is the
   largest thing on screen rather than one input in a corner of a card.
   ========================================================================== */

.trk-ic { width: 18px; height: 18px; flex-shrink: 0; }

.trkpage { max-width: 52rem; margin: 0 auto; padding-bottom: 3rem; }

/* ------------------------------------------------------------------- hero -- */
.trkpage-hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 2.25rem 1.5rem 2rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(145deg, #fff 0%, #FFFBEF 55%, #F7E7C3 100%);
  border: 1px solid var(--glass-brd, #E8D9AE);
  box-shadow: 0 18px 44px rgba(74, 14, 24, .10);
}
/* A hairline of gold along the top, so the card reads as jewellery packaging
   rather than a generic SaaS panel. */
.trkpage-hero::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold) 22%, var(--gold-light) 50%, var(--gold) 78%, transparent);
}
.trkpage-hero-in { max-width: 40rem; margin: 0 auto; text-align: center; }

.trkpage-eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .85rem; border-radius: 99px; margin-bottom: .9rem;
  background: rgba(201, 162, 39, .14); color: var(--maroon);
  font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.trkpage-h1 {
  margin: 0 0 .45rem; font-size: clamp(1.6rem, 4.2vw, 2.35rem);
  font-weight: 900; letter-spacing: -.02em; line-height: 1.1; color: var(--maroon);
}
.trkpage-sub { margin: 0 auto 1.5rem; max-width: 32rem; font-size: .93rem; line-height: 1.6; color: #7A6A58; }

/* ------------------------------------------------------------------- form -- */
.trkpage-form { text-align: left; }
.trkpage-lbl {
  display: block; margin-bottom: .4rem;
  font-size: .7rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: #7A6A58;
}
/* Inline on desktop because a label, a field and a button on one line is the
   whole interaction; stacked on phones where 3-across is unreadable. */
.trkpage-inputrow { display: flex; gap: .6rem; align-items: stretch; }
.trkpage-field { position: relative; flex: 1 1 auto; min-width: 0; }
.trkpage-field-ico {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: #A9997F; pointer-events: none;
}
.trkpage-input {
  width: 100%; height: 100%;
  padding: .9rem 1rem .9rem 2.75rem;
  border-radius: 14px; border: 1.5px solid var(--glass-brd, #E8D9AE);
  background: #fff; color: var(--ink);
  font-size: 1rem; font-weight: 700; letter-spacing: .06em;
  transition: border-color .18s, box-shadow .18s;
}
.trkpage-input::placeholder { font-weight: 500; letter-spacing: .04em; color: #B8A98F; }
.trkpage-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 162, 39, .22); }

.trkpage-go {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  flex: 0 0 auto; padding: 0 1.5rem; border: none; border-radius: 14px; cursor: pointer;
  background: linear-gradient(135deg, var(--maroon-2), var(--maroon));
  color: var(--cream); font-size: .92rem; font-weight: 800; white-space: nowrap;
  box-shadow: 0 8px 20px rgba(74, 14, 24, .28);
  transition: transform .16s, box-shadow .16s, filter .16s;
}
.trkpage-go:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(74, 14, 24, .34); }
.trkpage-go:active { transform: translateY(0); }

.trkpage-help { margin: .7rem 0 0; font-size: .78rem; color: #8A7A6B; }
.trkpage-help-link { color: var(--maroon); font-weight: 800; text-underline-offset: 3px; }

/* --------------------------------------------------------- nothing found -- */
.trkpage-empty {
  text-align: center; padding: 2.5rem 1.5rem;
  border-radius: 22px; background: #fff; border: 1px solid var(--glass-brd, #E8D9AE);
  box-shadow: 0 10px 30px rgba(74, 14, 24, .07);
}
.trkpage-empty-ico {
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; margin: 0 auto 1rem; border-radius: 50%;
  background: #FEE2E2; color: #991B1B;
}
.trkpage-empty-ico svg { width: 24px; height: 24px; }
.trkpage-empty-h { margin: 0 0 .5rem; font-size: 1.1rem; font-weight: 900; color: var(--maroon); }
.trkpage-empty-p { margin: 0 auto; max-width: 30rem; font-size: .88rem; line-height: 1.65; color: #7A6A58; }
.trkpage-empty-acts { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: 1.5rem; }
.trkpage-btn {
  display: inline-block; padding: .65rem 1.25rem; border-radius: 13px;
  background: linear-gradient(135deg, var(--maroon-2), var(--maroon));
  color: var(--cream); font-size: .86rem; font-weight: 800;
  transition: transform .16s, box-shadow .16s;
}
.trkpage-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(74, 14, 24, .26); }
.trkpage-btn.is-ghost { background: #fff; color: var(--maroon); border: 1.5px solid var(--gold); }
.trkpage-btn.is-ghost:hover { box-shadow: 0 8px 18px rgba(201, 162, 39, .28); }

/* ------------------------------------------------------- result + actions -- */
/* The card that wraps the shared track-body on the storefront side. */
.trkpage-result {
  padding: 1.5rem; border-radius: 22px;
  background: #fff; border: 1px solid var(--glass-brd, #E8D9AE);
  box-shadow: 0 14px 38px rgba(74, 14, 24, .09);
}

.trkpage-next { margin-top: 1.75rem; }
.trkpage-next-h { margin: 0 0 .85rem; font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #8A7A6B; }
.trkpage-next-grid { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.trkpage-next-card {
  display: grid; grid-template-columns: auto 1fr; gap: .15rem .7rem; align-items: center;
  padding: 1rem 1.1rem; border-radius: 16px;
  background: #fff; border: 1px solid var(--glass-brd, #E8D9AE); color: inherit; text-decoration: none;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.trkpage-next-card:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 12px 26px rgba(74, 14, 24, .10); }
.trkpage-next-card .trk-ic { grid-row: 1 / span 2; width: 20px; height: 20px; color: var(--maroon); }
.trkpage-next-t { font-size: .9rem; font-weight: 800; color: var(--maroon); }
.trkpage-next-d { font-size: .78rem; color: #8A7A6B; line-height: 1.45; }

/* ------------------------------------------------------------- how it works */
.trkpage-why {
  margin-top: 2rem; padding: 1.75rem 1.5rem; border-radius: 22px;
  background: rgba(255, 255, 255, .6); border: 1px dashed var(--glass-brd, #E8D9AE);
}
.trkpage-why-h { margin: 0 0 1.1rem; text-align: center; font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #8A7A6B; }
.trkpage-why-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); list-style: none; margin: 0; padding: 0; }
.trkpage-why-item { display: flex; gap: .7rem; align-items: flex-start; }
.trkpage-why-n {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--maroon-2), var(--maroon)); color: var(--cream);
  font-size: .78rem; font-weight: 900;
}
.trkpage-why-b { font-size: .84rem; line-height: 1.55; color: #7A6A58; }
.trkpage-why-b b { display: block; color: var(--maroon); font-size: .9rem; }

@media (max-width: 560px) {
  .trkpage-hero { padding: 1.6rem 1.1rem 1.5rem; border-radius: 20px; }
  .trkpage-inputrow { flex-direction: column; }
  .trkpage-go { padding: .8rem 1.5rem; }
  .trkpage-result { padding: 1.1rem; }
}

@media (max-width: 640px) {
  .trk-steps { flex-direction: column; gap: 0; }
  .trk-step { display: flex; align-items: flex-start; gap: .7rem; text-align: left; padding-bottom: .85rem; }
  .trk-dot { margin: 0; flex-shrink: 0; }
  .trk-step-label { font-size: .78rem; padding-top: .25rem; }
  .trk-step:not(:last-child)::after { top: 26px; left: 12px; width: 2px; height: 100%; }
}
