/* Orders (modules/orders): the member's list of orders, and one order's details and items. */

/* --- The list: one white row per order, the whole row a link --- */
.orders {
  display: grid;
  gap: var(--sp-3);
}

.order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "main total chevron"
    "status total chevron";
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  color: inherit;
  text-decoration: none;
  background-color: var(--c-page);
  border: var(--border-1) solid var(--c-line);
  border-radius: var(--radius-2);
  transition: border-color var(--duration-fast) var(--ease);
}

.order-row:hover {
  border-color: var(--c-accent-border);
}

/* From 576px: everything on one line. */
@media (min-width: 576px) {
  .order-row {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    grid-template-areas: "main status total chevron";
  }
}

.order-row__main {
  grid-area: main;
  display: grid;
}

.order-row__title {
  font-weight: 500;
}

.order-row__meta {
  font-size: var(--fs-small);
  color: var(--c-text-muted);
}

.order-row .order-status {
  grid-area: status;
  justify-self: start;
}

.order-row__total {
  grid-area: total;
  font-weight: 500;
}

.order-row .bi-chevron-right {
  grid-area: chevron;
  color: var(--c-text-muted);
}

/* --- The status tag: blue while it is on its way to you, green once delivered, grey if cancelled --- */
.order-status {
  display: inline-block;
  padding: 0 var(--sp-2);
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--c-info-text);
  background-color: var(--c-info-bg);
  border: var(--border-1) solid var(--c-info-border);
  border-radius: var(--radius-pill);
}

.order-status--delivered {
  color: var(--c-success-text);
  background-color: var(--c-success-bg);
  border-color: var(--c-success-border);
}

.order-status--cancelled {
  color: var(--c-text-muted);
  background-color: var(--c-surface);
  border-color: var(--c-line);
}

/* --- One order: its facts, then a table of what was in it --- */
.order-facts {
  display: grid;
  gap: var(--sp-3);
}

.order-facts div {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
}

.order-facts dt {
  color: var(--c-text-muted);
}

.order-items {
  width: 100%;
  border-collapse: collapse;
}

.order-items th,
.order-items td {
  padding: var(--sp-2) 0;
  text-align: left;
  border-bottom: var(--border-1) solid var(--c-line);
}

.order-items th + th,
.order-items td + td,
.order-items th + td {
  padding-left: var(--sp-4);
  text-align: right; /* quantity and price line up on the right */
}

.order-items thead th {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--c-text-muted);
}

.order-items tfoot th,
.order-items tfoot td {
  font-weight: 600;
  border-bottom: 0;
}
