/**
 * Account screens.
 *
 * Same rules as shop.css, which this file depends on and inherits its custom properties from:
 * every selector starts with .mecom-, layout reacts to CONTAINER width rather than viewport
 * width, and colours come from the properties on .mecom-shell so a theme can restyle without
 * fighting specificity.
 *
 * Kept out of shop.css on purpose: a product page must not carry the address-book layout, and
 * most visitors never open an account screen.
 */

/* ── the sign-in / register screen ── */

.mecom-auth__cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.mecom-auth--single .mecom-auth__cols,
.mecom-auth--single .mecom-auth__panel { max-width: 460px; margin-inline: auto; }

.mecom-auth__panel {
  border: 1px solid var(--mecom-line);
  border-radius: var(--mecom-radius);
  padding: 24px;
  background: #fff;
}

.mecom-auth__panel--alt { background: linear-gradient(180deg, #fff, var(--mecom-paper)); }

.mecom-auth__t { margin: 0 0 6px; font-size: 20px; }

.mecom-auth__hint {
  margin: 0 0 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--mecom-mut);
}

.mecom-auth__form { margin: 0; }

.mecom-auth__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.mecom-auth__guest {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--mecom-line);
  font-size: 13.5px;
  color: var(--mecom-mut);
  text-align: center;
}

.mecom-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
}

/* .mecom-field là một flex column, nên một .mecom-check nằm trong đó bị kéo giãn hết hàng. */
.mecom-field > .mecom-check { align-self: flex-start; width: auto; }

/* Và ô tick dính luật width:100% dành cho ô nhập của form: đo được 133px, chèn ép nhãn
   xuống còn 109px nên chữ gãy làm ba dòng. Ô tick và nút chọn không phải ô nhập văn bản. */
.mecom-check input[type="checkbox"],
.mecom-check input[type="radio"] { width: auto; flex: none; margin: 0; }

/* The honeypot. Not display:none — some bots skip what a browser would not render, and a
   field nobody can see or tab to costs a keyboard user nothing. */
.mecom-hp {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ── the account area ── */

.mecom-account__cols {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.mecom-account__nav {
  border: 1px solid var(--mecom-line);
  border-radius: var(--mecom-radius);
  background: #fff;
  overflow: hidden;
}

.mecom-account__hello {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0;
  padding: 16px;
  border-bottom: 1px solid var(--mecom-line);
  background: var(--mecom-paper);
  font-size: 13.5px;
  line-height: 1.35;
}

.mecom-account__hello b { display: block; }
.mecom-account__hello small { color: var(--mecom-mut); }

.mecom-account__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--mecom-cta);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  text-transform: uppercase;
}

.mecom-account__nav ul {
  margin: 0;
  padding: 8px;
  list-style: none !important;
}

.mecom-account__nav a,
.mecom-account__out {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--mecom-ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.mecom-account__nav a:hover,
.mecom-account__out:hover { background: var(--mecom-paper); }

.mecom-account__nav a.is-active {
  background: var(--mecom-ink);
  color: #fff;
  font-weight: 700;
}

.mecom-account__out { color: var(--mecom-mut); }
.mecom-account__nav form { margin: 0; }

.mecom-account__nav .dashicons {
  width: 18px;
  height: 18px;
  font-size: 18px;
  flex: none;
}

.mecom-acc-view__t {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 4px;
  font-size: 22px;
}

.mecom-acc-view__sub { margin: 0 0 20px; font-size: 13.5px; color: var(--mecom-mut); }

/* ── overview ── */

.mecom-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 26px;
}

.mecom-stat {
  padding: 16px 18px;
  border: 1px solid var(--mecom-line);
  border-radius: var(--mecom-radius);
  background: #fff;
}

.mecom-stat__n { display: block; font-size: 24px; font-weight: 800; line-height: 1.2; }
.mecom-stat__l { display: block; margin-top: 2px; font-size: 13px; color: var(--mecom-mut); }

.mecom-acc-sec { margin: 0 0 26px; }

.mecom-acc-sec__t {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 16px;
}

.mecom-acc-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 24px;
}

/* ── order list ── */

.mecom-orders { margin: 0; padding: 0; list-style: none !important; }

.mecom-orders__row + .mecom-orders__row { margin-top: 8px; }

.mecom-orders__link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--mecom-line);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: border-color .14s, box-shadow .14s;
}

.mecom-orders__link:hover {
  border-color: #cfd4e2;
  box-shadow: 0 10px 24px -18px rgba(27, 31, 42, .6);
}

.mecom-orders__num { font-weight: 700; font-variant-numeric: tabular-nums; }
.mecom-orders__date { font-size: 13px; color: var(--mecom-mut); }
.mecom-orders__total { font-weight: 700; font-variant-numeric: tabular-nums; }

.mecom-pager {
  display: flex;
  gap: 6px;
  margin: 18px 0 0;
  flex-wrap: wrap;
}

.mecom-pager a {
  min-width: 34px;
  padding: 6px 10px;
  border: 1px solid var(--mecom-line);
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  font-size: 13.5px;
}

.mecom-pager a.is-active { background: var(--mecom-ink); border-color: transparent; color: #fff; font-weight: 700; }

.mecom-acc-notes { margin: 0; padding: 0; list-style: none !important; font-size: 13.5px; }
.mecom-acc-notes li { padding: 8px 0; border-bottom: 1px dashed var(--mecom-line); line-height: 1.55; }
.mecom-acc-notes li:last-child { border-bottom: 0; }
.mecom-acc-notes time { display: block; font-size: 12px; color: var(--mecom-mut); }

.mecom-acc-track { margin: 10px 0 0; font-size: 13.5px; }
.mecom-acc-since { margin: 18px 0 0; font-size: 13px; color: var(--mecom-mut); }

.mecom-acc-claim {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--mecom-line);
}

/* ── address book ── */

.mecom-addrs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none !important;
}

.mecom-addrs__item {
  position: relative;
  padding: 16px;
  border: 1px solid var(--mecom-line);
  border-radius: 12px;
  background: #fff;
}

.mecom-addrs__item.is-default { border-color: var(--mecom-ok); }

.mecom-addrs__acts {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 0 0;
}

.mecom-addrs__acts form { margin: 0; }

.mecom-btn--danger { color: var(--mecom-sale); }

/* What a customer can still do with one order: buy it again, or call it off. Two forms on one
   row, so the primary action leads and the destructive one reads as a link beside it. */
.mecom-acc-order__acts {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 16px 0 22px;
}

.mecom-acc-order__acts form { margin: 0; }

/* ── forms shared by the account views ── */

.mecom-acc-form { margin: 0; }

.mecom-acc-form__acts {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0 0;
}

.mecom-acc-pass {
  margin: 22px 0 0;
  padding: 18px;
  border: 1px solid var(--mecom-line);
  border-radius: 12px;
  background: var(--mecom-paper);
}

.mecom-acc-pass legend { padding: 0 8px; font-weight: 700; font-size: 14px; }

/* Toggled panels: [hidden] is a user-agent rule and loses to any display rule of ours, so
   the pair is required or the panel simply never disappears. */
.mecom-auth [hidden],
.mecom-account [hidden] { display: none; }

/* ── narrow containers ── */

@container (max-width: 760px) {
  .mecom-auth__cols,
  .mecom-account__cols,
  .mecom-acc-two,
  .mecom-addrs { grid-template-columns: minmax(0, 1fr); }

  .mecom-account__nav ul {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .mecom-account__nav li { flex: none; }
  .mecom-account__nav a { white-space: nowrap; }

  .mecom-orders__link {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 6px;
  }
}

@container (max-width: 420px) {
  .mecom-stats { grid-template-columns: minmax(0, 1fr); }
}

/* ── saved products ──────────────────────────────────────────────────────────
   The grid is the shop's own .mecom-grid-products drawing the shop's own cards,
   so there is nothing to style here but the frame around them: the count line,
   the reloading state while a removal is in flight, and the header link.        */

.mecom-wishlist { position: relative; }
.mecom-wishlist__count { margin: 0 0 16px; font-size: 13.5px; color: var(--mecom-mut); }
.mecom-wishlist__count strong { color: var(--mecom-ink); }

/* The cards in here are narrower than a shop listing's, and the grid is already
   container-queried — this only lowers the ceiling on a wide account column. */
.mecom-wishlist .mecom-grid-products { margin-bottom: 0; }

/* A header counter. Bare (icon-less) by default so a theme can put it anywhere;
   `is-empty` lets the theme hide the number at zero without a second element. */
.mecom-wishlink {
  display: inline-flex; align-items: center; gap: 8px;
  color: inherit; text-decoration: none;
}
.mecom-wishlink__n {
  min-width: 20px; padding: 1px 6px;
  border-radius: 999px;
  background: var(--mecom-sale, #E23164); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 1.6;
  text-align: center; font-variant-numeric: tabular-nums;
}
.mecom-wishlink__n.is-empty { background: var(--mecom-line, #e6e8ef); color: var(--mecom-mut, #6b7280); }
