/* jdtheme26 - checkout / account flow helpers (operator-approved proposals 2026-10-06), loaded on cart, checkout and account pages only:
   1 phone checkout (collapsed summary + fixed pay bar), 2 error summary + field messages, 3 loading / busy states, 5 empty-state card.
   (trash icon, side-cart rows and the free-shipping bar are in jd-mini-cart.css, order timeline = jd-timeline.css.)
   Tokens only; every motion is wrapped for prefers-reduced-motion. Comments in English only, no !important except the reduced-motion kill-switch. */

/* ======================= 1 phone checkout: collapsed summary + fixed pay bar ======================= */
.jd-sum > summary { display: none; list-style: none; cursor: pointer; }
.jd-sum > summary::-webkit-details-marker { display: none; }
.jd-paybar { display: none; }
@media (max-width: 1024px) {
  body.woocommerce-checkout .checkout-order-review > #order_review_heading { display: none; }   /* the summary row names the block */
  .jd-sum > summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    color: var(--jd-ink-900);
    font-weight: 700;
    letter-spacing: .08em;
  }
  .jd-sum__total { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
  .jd-sum__chev { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .25s ease; }
  .jd-sum[open] .jd-sum__chev { transform: rotate(-135deg); }
  .jd-sum > summary:focus-visible { outline: 2px solid var(--jd-accent); outline-offset: 2px; border-radius: 8px; }
  .jd-paybar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 390;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px calc(10px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--jd-card-border);
    box-shadow: 0 -8px 24px rgba(60, 30, 40, .06);
  }
  .jd-paybar__sum { display: grid; line-height: 1.3; }
  .jd-paybar__sum small { color: var(--jd-ink-500); font-size: 12px; letter-spacing: .04em; }
  .jd-paybar__sum strong { color: var(--jd-ink-900); font-size: 16px; font-variant-numeric: tabular-nums; }
  .jd-paybar .jd-btn { flex: 1; }
  body.woocommerce-checkout .wd-toolbar { display: none; }                     /* the pay bar takes the bottom edge */
  body.woocommerce-checkout .main-page-wrapper > .wd-content-layout { padding-bottom: 100px; }
}

/* ======================= 2 error summary + per-field messages ======================= */
.jd-error-summary {
  margin: 0 0 var(--jd-space-m);
  padding: var(--jd-space-s) var(--jd-space-m);
  border: 1px solid #f4d9d9;
  border-radius: var(--jd-card-radius);
  background: #fdf3f3;
  color: #a8453f;
}
.jd-error-summary[hidden] { display: none; }
.jd-error-summary b { display: block; margin-bottom: 6px; }
.jd-error-summary ul { margin: 0; padding-inline-start: 1.2em; }
.jd-error-summary a { display: inline-flex; align-items: center; min-height: 32px; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.jd-field-msg {
  display: block;
  max-height: 0;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  color: var(--jd-error);
  font-size: 13px;
  line-height: 1.5;
  transition: max-height .2s ease, opacity .2s ease, margin .2s ease;
}
.form-row.jd-invalid .jd-field-msg { max-height: 3.2em; margin-top: 6px; opacity: 1; }
.form-row.jd-invalid :is(.input-text, input[type="text"], input[type="tel"], input[type="email"], select, textarea) { border-color: var(--jd-error); }
.form-row.jd-valid :is(.input-text, input[type="text"], input[type="tel"], input[type="email"]) { border-color: var(--jd-leaf-700); }
.jd-toast {
  position: fixed;
  inset: auto 15px 90px 15px;
  z-index: 500;
  max-width: 420px;
  margin-inline: auto;
  padding: 12px 16px;
  border: 1px solid var(--jd-cream-200);
  border-radius: 14px;
  background: var(--jd-cream-50);
  color: var(--jd-ink-900);
  box-shadow: var(--jd-card-shadow);
}

/* ======================= 3 loading / added / success states ======================= */
.jd-busy-area { position: relative; transition: opacity .2s ease; }
.jd-busy-area[aria-busy="true"] { opacity: .55; pointer-events: none; }
.jd-busy-area[aria-busy="true"]::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--jd-butter-400), transparent) -40% 0 / 40% 100% no-repeat;
  animation: jd-bar .9s linear infinite;
}
@keyframes jd-bar { to { background-position: 140% 0; } }
.jd-tick { animation: jd-tick .25s ease; }
@keyframes jd-tick { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }

/* ======================= 5 empty states (order timeline = jd-timeline.css) ======================= */
.jd-empty-card { display: grid; justify-items: center; gap: 10px; margin: 0 auto; max-width: 560px; padding: 32px 20px; border: 1px dashed var(--jd-cream-200); border-radius: var(--jd-card-radius); background: var(--jd-cream-50); text-align: center; }
.jd-empty-card[hidden] { display: none; }
.jd-empty-card > * { margin: 0; }
.jd-empty-card .wd-empty-block-title, .jd-empty-card h2 { color: var(--jd-ink-900); font-size: 18px; }

@media (prefers-reduced-motion: reduce) {
  .jd-busy-area::before, .jd-tick { animation: none !important; }   /* !important: reduced-motion kill-switch */
  .jd-field-msg, .jd-sum__chev { transition: none; }
}
