/* My account and order tracking (WS-02). Uses the cards, form fields and
   money lines of cart.css. Phone layout at ≤720px. */

/* ---------- Layout: menu | page ---------- */

.account {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.account__content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.account__content > .flow-title {
  margin: 0;
}

.account-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

@media (min-width: 721px) {
  .account-nav {
    position: sticky;
    top: 16px;
  }
}

.account-nav__who {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.account-nav__badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--accent);
  font-weight: 700;
}

.account-nav__name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.account-nav__name span {
  overflow: hidden;
  font-size: 13px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-nav ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.account-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--ink);
}

.account-nav a:hover {
  background: var(--soft);
  text-decoration: none;
}

.account-nav a[aria-current="page"] {
  background: var(--tint);
  color: var(--accent);
  font-weight: 600;
}

.account-nav .ic {
  color: var(--muted);
}

.account-nav a[aria-current="page"] .ic {
  color: var(--accent);
}

/* ---------- Blocks ---------- */

.acc-block__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.acc-block__head a {
  font-size: 14px;
  font-weight: 600;
}

.acc-empty {
  margin: 0;
  color: var(--muted);
}

.acc-guest {
  margin: 20px 0 0;
  text-align: center;
  color: var(--muted);
}

.acc-guest a {
  font-weight: 600;
}

/* Order status chip */
.acc-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.acc-status--completed {
  background: var(--soft);
  color: var(--ink);
}

.acc-status--cancelled,
.acc-status--failed,
.acc-status--refunded {
  background: var(--sale-bg);
  color: var(--sale);
}

/* ---------- Order lists ---------- */

.acc-orders {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.acc-orders--page {
  gap: 12px;
}

.acc-orders--page .acc-order {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.acc-order {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 0;
}

.acc-orders:not(.acc-orders--page) .acc-order + .acc-order {
  border-top: 1px solid var(--line);
}

/* Up to three small covers, overlapping */
.acc-order__covers {
  display: flex;
  width: 76px;
}

.acc-order__covers .book-cover {
  flex: none;
  width: 36px;
}

.acc-order__covers .book-cover + .book-cover {
  margin-left: -16px;
}

.acc-order__covers .book-cover__title {
  display: none;
}

.acc-order__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.acc-order__no {
  font-weight: 600;
  color: var(--ink);
}

.acc-order__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  font-size: 14px;
  color: var(--muted);
}

.acc-order__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.acc-order__actions .btn {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
}

.acc-order-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: -8px 0 0;
  color: var(--muted);
}

.acc-pages {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.acc-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.acc-notes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.acc-notes small {
  color: var(--muted);
}

.acc-notes p {
  margin: 2px 0 0;
}

/* Dashboard: addresses · profile · tracking */
.acc-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.acc-links a {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  height: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.acc-links a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.acc-links .ic {
  color: var(--accent);
}

.acc-links span {
  display: flex;
  flex-direction: column;
}

.acc-links strong {
  font-size: 16px;
  color: var(--ink);
}

.acc-addresses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 16px;
}

/* ---------- Forms ---------- */

.acc-form__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin: 0;
}

.acc-form__foot a {
  font-weight: 600;
}

.acc-form__set {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 16px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.acc-form__set legend {
  padding: 0;
  font-size: 16px;
  font-weight: 700;
}

.acc-form__set legend + .flow-note {
  margin: 0;
}

.acc-form--narrow {
  max-width: 520px;
}

.acc-login {
  display: grid;
  gap: 20px;
  align-items: start;
}

.acc-login--two {
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
}

.acc-login .flow-note {
  margin: -6px 0 0;
}

/* ---------- Where the order is ---------- */

.progress,
.progress-stop {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.progress-stop {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: var(--soft);
}

.progress-stop p {
  margin: 0;
  font-weight: 600;
}

.progress__steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.progress__step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  color: var(--muted);
}

/* line to the next step, behind the marks */
.progress__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 13px;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  height: 2px;
  border-radius: 1px;
  background: var(--line);
}

.progress__step.is-done:not(:last-child):has(+ .is-done)::after {
  background: var(--accent);
}

.progress__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}

.progress__step.is-done .progress__mark {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.progress__mark .ic {
  stroke-width: 2.6;
}

.progress__step.is-done .progress__label {
  color: var(--ink);
  font-weight: 600;
}

.progress__date {
  font-size: 13px;
}

.progress__courier {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}

.progress__courier p {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.progress__courier a {
  font-weight: 600;
}

.progress__events summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.progress__events ol {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--line);
  list-style: none;
}

.progress__events li {
  display: flex;
  flex-direction: column;
}

.progress__events small {
  color: var(--muted);
}

/* ---------- Track an order ---------- */

.track-form {
  max-width: 640px;
}

.track-form .woocommerce-error {
  margin: 0;
}

.track-result {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 820px;
  margin-top: 24px;
}

/* ---------- Phones ---------- */

@media (max-width: 900px) {
  .account {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The menu becomes a row of chips over the page */
  .account-nav {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .account-nav__who {
    display: none;
  }

  .account-nav ul {
    flex-direction: row;
    gap: 8px;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter) 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .account-nav ul::-webkit-scrollbar {
    display: none;
  }

  .account-nav li {
    flex: none;
  }

  .account-nav a {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 14px;
    white-space: nowrap;
  }

  .account-nav a .ic {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 720px) {
  .acc-order {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "covers info"
      "covers status"
      "actions actions";
    align-items: start;
  }

  .acc-order__covers {
    grid-area: covers;
  }

  .acc-order__info {
    grid-area: info;
  }

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

  .acc-order__actions {
    grid-area: actions;
  }

  .progress,
  .progress-stop {
    padding: 16px;
  }

  .progress__label {
    font-size: 14px;
  }
}
