/* ==========================================================================
   QRBELL Store — Orders, order detail and tracking (spec §26, §27, §28)
   --------------------------------------------------------------------------
   Shared by pages/orders.html, order-detail.html and tracking.html — three
   views of the same record. All selectors namespaced `.od-*`.
   ========================================================================== */

/* ==========================================================================
   PAGE HEAD
   ========================================================================== */

.od-head { padding-block: var(--space-4); }
.od-head__nav { min-height: 24px; }

.od-head__title {
  margin: var(--space-3) 0 0;
  font-size: 1.375rem;
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}

@media (min-width: 768px) { .od-head__title { font-size: 1.75rem; } }

.od-head__sub { margin: var(--space-1) 0 0; color: var(--color-text-muted); font-size: var(--text-sm); }


/* ==========================================================================
   ORDER CARD — spec §26
   ========================================================================== */

.od-list { display: flex; flex-direction: column; gap: var(--space-4); padding-bottom: var(--space-10); }

.od-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.od-card:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-sm); }

/* Meta strip: id, date, totals, status */
.od-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
}

.od-card__facts { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-5); }

/* Each fact stacks its own label over its value inside the wrapping row */
.od-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.od-fact__label {
  display: block;
  color: var(--color-text-faint);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
}
.od-fact__value { display: block; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.od-fact__value--id { font-family: var(--font-mono); letter-spacing: 0.01em; }

.od-card__items { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }

.od-item { display: flex; gap: var(--space-3); align-items: flex-start; }

.od-item__media {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  background: var(--qb-grey-100);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  overflow: hidden;
}
.od-item__media img { width: 100%; height: 100%; object-fit: cover; }

.od-item__body { flex: 1 1 auto; min-width: 0; }
.od-item__name { font-size: var(--text-base); font-weight: var(--weight-semibold); line-height: 1.3; }
.od-item__name a { color: var(--color-text); }
.od-item__name a:hover { color: var(--color-accent); text-decoration: none; }
.od-item__meta { color: var(--color-text-muted); font-size: var(--text-xs); }
.od-item__price { flex: 0 0 auto; font-size: var(--text-sm); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }

.od-card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
}

@media (max-width: 480px) {
  .od-card__foot { display: grid; grid-template-columns: 1fr 1fr; }
  .od-card__foot > .qb-btn { width: 100%; }
}

/* A one-line progress hint on cards that are still moving */
.od-progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent-subtle);
  border-top: 1px solid var(--qb-blue-100);
  color: var(--qb-blue-700);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}
.od-progress--delivered { background: var(--color-success-soft); border-top-color: #BDE9D4; color: var(--color-success-strong); }
.od-progress--cancelled { background: var(--color-danger-soft);  border-top-color: #F5C6C6; color: var(--color-danger-strong); }


/* ==========================================================================
   DETAIL / TRACKING LAYOUT
   ========================================================================== */

.od-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
  padding-bottom: var(--space-10);
  align-items: start;
}

@media (min-width: 992px) {
  .od-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-8); }
}

.od-panel {
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.od-panel + .od-panel { margin-top: var(--space-4); }

.od-panel__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
}

.od-facts-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.od-def { font-size: var(--text-sm); line-height: 1.6; }
.od-def strong { display: block; font-weight: var(--weight-semibold); }


/* ==========================================================================
   TRACKING — spec §28. Strong, unambiguous status indicators.
   ========================================================================== */

.od-status {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--qb-navy-900);
  color: var(--color-text-invert);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-5);
}

@media (min-width: 768px) {
  .od-status { flex-direction: row; align-items: center; justify-content: space-between; }
}

.od-status__stage {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.od-status__icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  background: rgba(244, 180, 0, 0.14);
  color: var(--color-primary);
  border-radius: var(--radius-circle);
  font-size: 1.3rem;
}
.od-status--delivered .od-status__icon { background: rgba(43, 182, 115, 0.18); color: var(--color-success); }
.od-status--cancelled .od-status__icon { background: rgba(226, 59, 59, 0.18); color: var(--color-danger); }

.od-status__label {
  color: var(--color-text-invert-muted);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
}
.od-status__value { font-size: var(--text-lg); font-weight: var(--weight-bold); line-height: 1.2; }
.od-status__meta  { color: var(--color-text-invert-muted); font-size: var(--text-xs); }

.od-status__bar { flex: 1 1 auto; max-width: 260px; }
.od-status__track {
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.od-status__fill { height: 100%; background: var(--color-primary); border-radius: var(--radius-pill); transition: width var(--duration-slow) var(--ease-out); }
.od-status--delivered .od-status__fill { background: var(--color-success); }

.od-status__pct { margin-top: var(--space-2); color: var(--color-text-invert-muted); font-size: var(--text-2xs); text-align: right; }


/* ==========================================================================
   SHIPMENT
   ========================================================================== */

.od-awb {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-surface-alt);
  border-radius: var(--radius-xs);
}
.od-awb__code { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: var(--weight-bold); }
.od-awb__label { color: var(--color-text-faint); font-size: var(--text-2xs); }


/* ==========================================================================
   QR INFORMATION — spec §27
   ========================================================================== */

.od-qr {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
}
.od-qr__id { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: var(--weight-bold); }
.od-qr__hint { color: var(--color-text-muted); font-size: var(--text-2xs); }

/* Design preview — §27 asks for the design that was ordered */
.od-design {
  flex: 0 0 auto;
  width: 48px; height: 48px;
  background: var(--qb-grey-100);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  overflow: hidden;
}
.od-design img { width: 100%; height: 100%; object-fit: cover; }


/* ==========================================================================
   SUPPORT BLOCK — reachable from order and QR screens, spec §79
   ========================================================================== */

.od-support {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-primary-subtle);
  border: 1px solid var(--qb-gold-200);
  border-radius: var(--radius-sm);
}
.od-support i { flex: 0 0 auto; color: var(--qb-gold-700); font-size: 1.2rem; }
.od-support__title { font-size: var(--text-sm); font-weight: var(--weight-bold); }
.od-support__text  { margin: 0 0 var(--space-2); font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.5; }


/* ==========================================================================
   PRINT — an order page is a realistic print target (base.css §53)
   ========================================================================== */

@media print {
  .od-card__foot,
  .od-support,
  .qb-tabs { display: none !important; }

  .od-panel { border: 0; padding: 0; }
  .od-layout { display: block; }
}
