/**
 * Juye Payments - customer-facing styles.
 * Falls back gracefully if the Juye theme is not active.
 */

/*
 * These live on :root, not on .juye-receipt where they started. A custom
 * property only reaches descendants of the element that declares it, so
 * every rule in this file outside a receipt -- the WhatsApp buttons, the
 * tracking panel, the lookup form -- was resolving them to nothing and
 * silently dropping the background or border that depended on them. The
 * symptom is invisible: the rule applies, the colour just never arrives.
 */
:root {
  --jp-green: var(--juye-tea, #397653);
  --jp-green-dark: var(--juye-forest, #153D2E);
  --jp-sage: var(--juye-cardamom, #A9C88B);
  --jp-cream: var(--juye-milk, #FFFDF8);
  --jp-sand: var(--juye-cream, #FFF5E6);
  --jp-border: var(--juye-line, #E8DFCC);
  --jp-ink: var(--juye-ink, #24251F);
  --jp-ink-soft: var(--juye-ink-soft, #6B6F63);
  --jp-clay: var(--juye-terra, #C95F3D);
  --jp-honey: var(--juye-saffron, #F3B83F);
}

.juye-receipt {
  background: #fff;
  border: 1px solid var(--jp-border);
  border-radius: 14px;
  padding: 28px;
  margin: 32px 0;
}

.juye-receipt__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.juye-receipt__title {
  margin: 0;
  font-size: 1.4rem;
  color: var(--jp-green-dark);
}

.juye-receipt__intro {
  color: var(--jp-ink-soft);
  font-size: 15px;
  margin: 0 0 22px;
  max-width: 62ch;
}

/* ---- Status badges ---- */
.juye-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.juye-badge--awaiting  { background: var(--jp-sand); color: var(--jp-ink-soft); }
.juye-badge--submitted { background: #FBF0D8; color: #8A6A1E; }
.juye-badge--verified  { background: #DCEADF; color: #1F5134; }
.juye-badge--rejected  { background: #F6E0D8; color: #8A3D22; }

/* ---- Advance / balance split ---- */
.juye-receipt__split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--jp-border);
  border: 1px solid var(--jp-border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 22px;
}

.juye-receipt__split > div {
  background: var(--jp-cream);
  padding: 18px;
  text-align: center;
}

.juye-receipt__split span {
  display: block;
  font-size: 12.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--jp-ink-soft);
  margin-bottom: 6px;
}

.juye-receipt__split strong {
  font-size: 1.35rem;
  color: var(--jp-green-dark);
  font-weight: 600;
}

.juye-receipt__split > div:first-child {
  background: #fff;
  box-shadow: inset 3px 0 0 var(--jp-green);
}

/* ---- Account list ---- */
.juye-pay__amount {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--jp-green);
  color: #fff;
  border-radius: 10px;
  margin-bottom: 18px;
}

.juye-pay__amount-label {
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .85;
}

.juye-pay__amount-value { font-size: 1.4rem; font-weight: 600; }

.juye-pay__accounts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.juye-pay__account {
  border: 1px solid var(--jp-border);
  border-radius: 10px;
  padding: 16px 18px;
  background: var(--jp-cream);
}

.juye-pay__account-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--jp-border);
}

.juye-pay__bank {
  font-weight: 600;
  color: var(--jp-green-dark);
  font-size: 15px;
}

.juye-pay__type {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--jp-ink-soft);
  background: #fff;
  border: 1px solid var(--jp-border);
  border-radius: 999px;
  padding: 3px 9px;
}

.juye-pay__rows { margin: 0; }

.juye-pay__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
}

.juye-pay__row dt {
  font-size: 13px;
  color: var(--jp-ink-soft);
  margin: 0;
  flex-shrink: 0;
}

.juye-pay__row dd {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--jp-ink);
  text-align: right;
  word-break: break-all;
}

.juye-pay__row code {
  background: #fff;
  border: 1px solid var(--jp-border);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 13.5px;
  letter-spacing: .02em;
}

.juye-pay__empty {
  background: var(--jp-sand);
  border-radius: 10px;
  padding: 16px;
  color: var(--jp-ink-soft);
  margin: 0;
}

/* ---- Upload form ---- */
.juye-receipt__form {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--jp-border);
}

.juye-receipt__field { margin-bottom: 18px; }

.juye-receipt__field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--jp-ink);
  margin-bottom: 7px;
}

.juye-receipt__req { color: var(--jp-clay); }

.juye-receipt__field input[type="text"],
.juye-receipt__field input[type="file"] {
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--jp-border);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  font-size: 15px;
  color: var(--jp-ink);
}

.juye-receipt__field input[type="file"] {
  padding: 10px;
  cursor: pointer;
}

.juye-receipt__field input:focus {
  outline: none;
  border-color: var(--jp-sage);
  box-shadow: 0 0 0 3px rgba(143, 166, 142, .22);
}

.juye-receipt__field small {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--jp-ink-soft);
}

/* ---- Result messages ---- */
.juye-receipt__done,
.juye-receipt__pending,
.juye-receipt__rejected {
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 14.5px;
  margin: 20px 0 0;
}

.juye-receipt__done     { background: #DCEADF; color: #1F5134; }
.juye-receipt__pending  { background: #FBF0D8; color: #8A6A1E; }
.juye-receipt__rejected { background: #F6E0D8; color: #8A3D22; }

/* ---- Checkout: COD advance split line ---- */
.juye-cod-split {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.juye-cod-split > span {
  flex: 1 1 140px;
  background: #fff;
  border: 1px solid var(--juye-line, #E8DFCC);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--juye-ink-soft, #6B6F63);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.juye-cod-split strong {
  font-size: 1.05rem;
  color: var(--juye-forest, #153D2E);
}

.juye-cod-split__now {
  box-shadow: inset 3px 0 0 var(--juye-forest, #153D2E);
}

/* ---- Copy buttons ---- */
.juye-copy {
  border: 1px solid var(--jp-border);
  background: #fff;
  color: var(--jp-ink-soft);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  margin-left: 6px;
  min-height: 28px;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.juye-copy:hover { background: var(--jp-sand); color: var(--jp-ink); }
.juye-copy:focus-visible { outline: 2px solid var(--jp-sage); outline-offset: 2px; }
.juye-copy.is-copied { background: #DCEADF; border-color: #A9C7B4; color: #1F5134; }
.juye-copy.is-error  { background: #F6E0D8; border-color: #DCB5A4; color: #8A3D22; }

/* ---- WhatsApp ---- */
.juye-wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #1FA855;
  color: #fff;
  border-radius: 999px;
  padding: 13px 26px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.2;
  transition: background .2s ease, transform .2s ease;
}

.juye-wa-btn:hover { background: #17863F; color: #fff; transform: translateY(-1px); }
.juye-wa-btn:focus-visible { outline: 2px solid var(--jp-green-dark); outline-offset: 3px; }
.juye-wa-icon { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }

.juye-wa-btn--ghost {
  background: transparent;
  color: var(--jp-green-dark);
  box-shadow: inset 0 0 0 1px var(--jp-border);
  margin-top: 14px;
}
.juye-wa-btn--ghost:hover { background: var(--jp-sand); color: var(--jp-green-dark); }
.juye-wa-btn--ghost .juye-wa-icon { fill: #1FA855; }

/* Ordering by WhatsApp is a real route to checkout here, not a footnote, so
   the button matches Add to cart in weight. It sits full width underneath so
   the two never compete for the same spot on a phone. */
.juye-wa-btn--order {
  display: flex;
  width: 100%;
  justify-content: center;
  margin-top: 14px;
  padding: 15px 26px;
  font-weight: 600;
}

/* A variable product has no price until a variation is chosen. The button
   stays visible so the option is discoverable, but it is plainly not ready. */
.juye-wa-btn--order.is-waiting {
  background: var(--jp-sand);
  color: var(--jp-ink-soft, #6B5E54);
  cursor: not-allowed;
  pointer-events: none;
}

.juye-wa-btn--order.is-waiting .juye-wa-icon { fill: currentColor; opacity: .5; }

.juye-wa-float {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1FA855;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(31, 52, 41, .28);
  transition: transform .2s ease, background .2s ease;
}

.juye-wa-float:hover { background: #17863F; color: #fff; transform: scale(1.05); }
.juye-wa-float:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.juye-wa-float .juye-wa-icon { width: 30px; height: 30px; }

.juye-receipt__wa {
  margin-top: 26px;
  padding: 20px;
  background: var(--jp-cream);
  border: 1px solid var(--jp-border);
  border-radius: 10px;
}

.juye-receipt__wa h3 { margin: 0 0 8px; font-size: 1.05rem; color: var(--jp-green-dark); }
.juye-receipt__wa p  { margin: 0 0 14px; font-size: 14px; color: var(--jp-ink-soft); }

.juye-receipt__form h3 { margin: 0 0 16px; font-size: 1.05rem; color: var(--jp-green-dark); }

.juye-receipt__legal {
  margin: 20px 0 0;
  font-size: 13px;
  color: var(--jp-ink-soft);
  border-top: 1px solid var(--jp-border);
  padding-top: 16px;
}

.juye-pay__logo { border-radius: 5px; object-fit: contain; flex-shrink: 0; }

.juye-pay__note {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--jp-ink-soft);
  border-top: 1px dashed var(--jp-border);
  padding-top: 10px;
}

.juye-cod-note {
  display: block;
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--jp-ink-soft);
}

@media (prefers-reduced-motion: reduce) {
  .juye-wa-btn,
  .juye-wa-float,
  .juye-copy { transition: none; }
  .juye-wa-btn:hover,
  .juye-wa-float:hover { transform: none; }
}

@media (max-width: 600px) {
  .juye-receipt { padding: 20px; }
  .juye-receipt__split { grid-template-columns: 1fr; }
  .juye-pay__accounts { grid-template-columns: 1fr; }
  .juye-wa-float { right: 14px; bottom: 14px; }
  .juye-pay__row { flex-wrap: wrap; }
}

/* ---- Courier tracking ---- */
.juye-track-panel {
  margin: 22px 0;
  padding: 18px 20px;
  border: 1px solid var(--jp-border);
  border-radius: 14px;
  background: var(--jp-sand);
}

.juye-track-panel h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.juye-track-panel p { margin: 0 0 10px; }
.juye-track-panel p:last-child { margin-bottom: 0; }
.juye-track-note { color: var(--jp-ink-soft, #6B5E54); font-size: .95em; }

.juye-track-btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--jp-green-dark);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

.juye-track-btn:hover { background: #17863F; color: #fff; }

/* The lookup page */
.juye-track { max-width: 560px; }
.juye-track__field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.juye-track__field label { font-weight: 600; }

.juye-track__field input {
  padding: 13px 16px;
  border: 1.5px solid var(--jp-border);
  border-radius: 10px;
  font-size: 16px; /* under 16px iOS zooms the page on focus */
}

.juye-track__field input:focus {
  outline: none;
  border-color: var(--jp-green-dark);
  box-shadow: 0 0 0 3px rgba(31, 168, 85, .15);
}

.juye-track__error {
  padding: 12px 16px;
  border-radius: 10px;
  background: #F6E0D8;
  border: 1px solid #DCB5A4;
  color: #8A3D22;
}

.juye-track__hint { font-size: .92em; color: var(--jp-ink-soft, #6B5E54); }
.juye-track__meta { font-size: .92em; color: var(--jp-ink-soft, #6B5E54); margin-bottom: 4px; }
.juye-track__status { font-size: 1.15rem; font-weight: 600; margin-top: 0; }

.juye-track__items { width: 100%; border-collapse: collapse; margin: 18px 0; }
.juye-track__items td { padding: 9px 0; border-bottom: 1px solid var(--jp-border); }
.juye-track__items td:last-child { text-align: right; white-space: nowrap; }
.juye-track__total td { font-weight: 700; border-bottom: none; }
.juye-track__due { font-weight: 600; }
