/* Joymax Add-ons — installation tick box, cart note, after-payment box.
   Uses the Joymax theme colours when present (--gold, --paper, ...), with plain fallbacks for any theme. */

:root { --jxa-amber: #FFA53D; --jxa-amber-bg: rgba(255, 165, 61, .10); --jxa-amber-line: rgba(255, 165, 61, .45); }
html[data-theme="light"], html[data-jm-theme="light"] { --jxa-amber: #A04E00; --jxa-amber-bg: rgba(255, 140, 0, .09); --jxa-amber-line: rgba(160, 78, 0, .40); }

.jxa-ni { color: var(--jxa-amber); font-weight: 700; }
.jxa-ar { font-family: var(--ar, inherit); }

/* ---------- Product page: one simple box, EN line + AR line ---------- */
.jxa-install { flex: 0 0 100%; width: 100%; margin-top: 14px; }
form.cart:has(> .jxa-install),
.woocommerce-variation-add-to-cart:has(> .jxa-install) { flex-wrap: wrap; }
.jxa-install .jxa-row {
  display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 12px 14px; min-height: 44px;
  border: 1px solid var(--edge, rgba(127, 127, 127, .35)); border-radius: 10px; background: var(--field-bg, transparent);
  color: var(--paper, inherit); cursor: pointer; font-weight: 400; line-height: 1.5; -webkit-tap-highlight-color: transparent;
  transition: border-color .15s;
}
.jxa-install .jxa-row:has(.jxa-cb:checked) { border-color: var(--gold, #EFC31A); }
.jxa-install .jxa-cb { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--gold, #EFC31A); cursor: pointer; }
.jxa-install .jxa-cb:focus-visible { outline: 2px solid var(--gold, #EFC31A); outline-offset: 2px; }
.jxa-install .jxa-txt { flex: 1; min-width: 0; display: grid; gap: 10px; }
.jxa-install .jxa-en { display: block; text-align: left; }
.jxa-install .jxa-ar { display: block; text-align: right; border-top: 1px dashed var(--edge, rgba(127, 127, 127, .35)); padding-top: 10px; }
.jxa-install .jxa-title { display: block; font-weight: 700; font-size: 15px; }
.jxa-install .jxa-price { color: var(--gold-text, #B8860B); white-space: nowrap; }
.jxa-install .jxa-sub { display: block; margin-top: 3px; font-size: 13px; color: var(--ash, inherit); }
.jxa-install .jxa-ar .jxa-sub { font-size: 14px; }

/* ---------- Cart, mini-cart, checkout (only our line: .jxa-install-line) ---------- */
.jxa-thumb { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 8px; color: var(--gold-text, #B8860B);
  background: rgba(239, 195, 26, .08); border: 1px solid rgba(239, 195, 26, .45); vertical-align: middle; }
.jxa-thumb .jxa-icon { width: 26px; height: 26px; }
/* Cart page: the icon box is a block (no text-baseline gap) at the top of its cell, level with the title.
   The theme centres the picture in the row; our row is taller (For + Note), which left the icon floating mid-row. */
html body tr.jxa-install-line td.product-thumbnail { align-self: start !important; vertical-align: top; }
html body tr.jxa-install-line td.product-thumbnail .jxa-thumb { display: grid; }
html body tr.jxa-install-line td.product-name { align-self: start !important; }
/* Cart page (Joymax theme draws each line as a card): a product and the install line right under it show as ONE card.
   Product keeps the top corners, install the bottom ones; install indented 22px under a thin inset divider.
   The -12px closes the theme's 12px gap between cards for our row only. Not directly under its product = own card. */
html body.joymax-theme.jx-cart #content table.shop_table.cart tr.cart_item.jxa-has-install:has(+ tr.jxa-install-line) {
  border-bottom: 0 !important; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
html body.joymax-theme.jx-cart #content table.shop_table.cart tr.cart_item.jxa-has-install + tr.cart_item.jxa-install-line {
  margin-top: -12px; border-top: 0 !important; border-top-left-radius: 0; border-top-right-radius: 0; padding-left: 38px;
  background-image: linear-gradient(var(--edge), var(--edge)); background-repeat: no-repeat;
  background-position: 38px 0; background-size: calc(100% - 54px) 1px; }
/* The product's Remove (theme draws the word with ::after) says the install goes too. Screen readers: aria-label (PHP). */
html body.joymax-theme.jx-cart #content table.shop_table.cart tr.cart_item.jxa-has-install td.product-remove a.remove::after {
  content: "Remove (removes the installation too)"; }
@media (max-width: 900px) {
  html body.joymax-theme.jx-cart #content table.shop_table.cart tr.cart_item.jxa-has-install + tr.cart_item.jxa-install-line {
    padding-left: 34px; background-position: 34px 0; background-size: calc(100% - 46px) 1px; }
  html body.joymax-theme.jx-cart #content table.shop_table.cart tr.cart_item.jxa-has-install td.product-remove a.remove::after {
    white-space: normal; line-height: 1.3; text-align: start; }
}

/* Mini-cart (Astra): product pictures sit in the left gutter (absolute, 4em square). The icon takes the same spot,
   level with the title (top of the item) instead of mid-item, because our item is taller. */
/* Mini-cart pair: no full-width separator under the product; the install's content is indented 22px under a thin inset
   divider (Astra: 5em text gutter, 4em picture at left 0). The item stays full width, so the line after the pair is too. */
.woocommerce-js ul.product_list_widget li.jxa-has-install:has(+ li.jxa-install-line) { border-bottom: 0; padding-bottom: 12px; }
.woocommerce-js ul.product_list_widget li.jxa-has-install + li.jxa-install-line {
  padding-top: 12px; padding-left: calc(5em + 22px);
  background-image: linear-gradient(var(--edge, rgba(127, 127, 127, .35)), var(--edge, rgba(127, 127, 127, .35)));
  background-repeat: no-repeat; background-position: 22px 0; background-size: calc(100% - 22px) 1px; }
.woocommerce-js ul.product_list_widget li.jxa-has-install + li.jxa-install-line > .jxa-thumb { left: 22px; }
.woocommerce-js ul.product_list_widget li.jxa-install-line > .jxa-thumb { position: absolute; left: 0; top: auto; display: grid; width: 4em; height: 4em; }

/* Labels (WooCommerce prints them as dt/dd floated side by side). "For": label + product on one line.
   "Note": label on its own line, the box under it with a 6px gap. Normal block flow, no negative margins. */
html body .jxa-install-line dl.variation dt[class^="variation-Note"],
html body .jxa-install-line dl.variation dd[class^="variation-Note"] {
  float: none; clear: both; display: block; width: auto; margin: 0; padding: 0; }
html body .jxa-install-line dl.variation dd[class^="variation-Note"] { margin-top: 6px; }

.jxa-note { display: block; margin: 0; padding: 5px 8px; border: 1px solid var(--jxa-amber-line); border-radius: 6px;
  background: var(--jxa-amber-bg); font-size: 12px; line-height: 1.45; }
/* Inside the box: English left-to-right on the left, Arabic right-to-left on the right. Never centred. */
html body .jxa-note .jxa-en { display: block; direction: ltr; text-align: left; }
html body .jxa-note .jxa-ar { display: block; direction: rtl; text-align: right; font-size: 13px; }

/* ---------- After payment ---------- */
.jxa-box { display: grid; grid-template-columns: auto 1fr; gap: 16px; margin: 0 0 28px; padding: 20px;
  border: 1px solid var(--jxa-amber-line); border-radius: 12px; color: var(--paper, inherit);
  background: linear-gradient(180deg, var(--jxa-amber-bg), transparent 80%), var(--plate, transparent); }
.jxa-box-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; background: var(--gold, #EFC31A); color: var(--on-gold, #0A0A0B); }
.jxa-box-body { min-width: 0; }
.jxa-box .jxa-box-title { margin: 0; font-size: 20px; line-height: 1.3; }
.jxa-box .jxa-box-title span { display: block; }
.jxa-box .jxa-box-title .jxa-ar { font-size: 19px; text-align: right; margin-top: 2px; }
.jxa-box p { margin: 8px 0 0; color: var(--ash, inherit); }
.jxa-box p.jxa-ar { text-align: right; font-size: 15px; margin-top: 4px; }
/* (0.1.7) Installation contact: gold border, dark card; DM contact names. */
.jxa-box { border: 2px solid var(--gold, #EFC31A); background: var(--plate, #141414); }
.jxa-box .jxa-contact { white-space: nowrap; }
.jxa-box a.jxa-contact-link { color: var(--gold, #EFC31A) !important; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
/* (0.1.8) Fixed Joymax look for the box (dark card in both site themes): card #141417, text #F2F2F2, grey #A8A8B0. */
html body .jxa-box { background: #141417; color: #F2F2F2; }
html body .jxa-box .jxa-box-title, html body .jxa-box p { color: #F2F2F2; }
html body .jxa-box .jxa-ni { color: #EFC31A; }
html body .jxa-box .jxa-verify, html body .jxa-box .jxa-verify span { color: #A8A8B0; }
.jxa-box .jxa-ar, .jxa-box p.jxa-ar, .jxa-box .jxa-verify .jxa-ar { font-family: Tajawal, var(--ar, inherit), sans-serif; direction: rtl; text-align: right; }
.jxa-box p.jxa-steps { line-height: 1.75; }
.jxa-box p.jxa-ar.jxa-steps { margin-top: 12px; font-size: 16px; }
.jxa-box .jxa-contacts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.jxa-box .jxa-btn-msg { white-space: normal; text-align: center; }
.jxa-box .jxa-ordno { color: #F2F2F2; }
.jxa-box .jxa-copy { background: #2A2A31; color: #F2F2F2; }
.jxa-box .jxa-btn-join { gap: 10px; border-color: #EFC31A; }
.jxa-box a.jxa-btn.jxa-btn-ghost, .jxa-box a.jxa-btn.jxa-btn-ghost:is(:hover, :focus-visible, :visited) { color: #EFC31A !important; border-color: #EFC31A; }
.jxa-box .jxa-btn-join .jxa-btn-ico { width: 20px; height: 20px; flex: none; }
@media (max-width: 600px) {
  .jxa-box .jxa-contacts > *, .jxa-box .jxa-ordno { width: 100%; justify-content: space-between; }
  .jxa-box .jxa-ordno { font-size: 16px; }
}
.jxa-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.jxa-ordno { display: inline-flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border: 1px dashed rgba(239, 195, 26, .45);
  border-radius: 8px; font-weight: 700; font-size: 18px; font-family: var(--head, inherit); }
.jxa-copy { font: 600 12px var(--body, inherit); padding: 5px 10px; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--edge, #e5e5e5); color: var(--paper, inherit); }
.jxa-box .jxa-btn { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0 .35em; min-height: 48px; padding: 12px 18px; border-radius: 8px; text-decoration: none;
  font-weight: 700; background: var(--gold, #EFC31A); color: var(--on-gold, #0A0A0B); }
/* (0.1.5) Text colour wins over link colours from other stylesheets: the old storefront layout plugin paints every
   link in #content gold (".joymax-design #content a:not(.button)"), which made the gold button's text invisible.
   An ID-based rule can only be beaten with !important; it is kept to these buttons' own colour. */
.jxa-box a.jxa-btn, .jxa-box a.jxa-btn:is(:hover, :focus-visible, :visited) { color: var(--on-gold, #0A0A0B) !important; }
.jxa-box a.jxa-btn.jxa-btn-ghost, .jxa-box a.jxa-btn.jxa-btn-ghost:is(:hover, :focus-visible, :visited) { color: var(--paper, inherit) !important; }
.jxa-box .jxa-btn:hover, .jxa-box .jxa-btn:focus-visible { filter: brightness(1.06); }
.jxa-box .jxa-btn-ghost { background: transparent; border: 1px solid var(--edge, rgba(127, 127, 127, .35)); }
/* (0.1.5) Ticket button = the Installation page button: Discord mark + "EN / AR", centred, 52 px, 16 px bold. */
.jxa-box .jxa-btn-discord { gap: 10px; min-height: 52px; padding: 0 24px; font: 700 16px/1.2 var(--body, inherit); white-space: nowrap; }
.jxa-box .jxa-btn-discord .jxa-btn-ico { width: 20px; height: 20px; flex: none; }
.jxa-box .jxa-btn-discord .jxa-btn-sl { opacity: .55; }
.jxa-box .jxa-btn-discord .jxa-btn-ar { font: 700 16px/1.2 var(--ar, inherit); }
.jxa-box .jxa-btn:active { transform: scale(.97); }
.jxa-box .jxa-verify { margin-top: 10px; font-size: 13px; color: var(--dim, inherit); }
.jxa-box .jxa-verify span { display: block; }
.jxa-box .jxa-verify .jxa-ar { text-align: right; font-size: 14px; }

@media (max-width: 600px) {
  .jxa-box { grid-template-columns: 1fr; padding: 16px; }
  .jxa-box .jxa-btn { width: 100%; justify-content: center; }
  /* (0.1.6) Icon and words stay in one row; the words themselves may wrap (0.1.5 put the icon on its own line). */
  .jxa-box .jxa-btn-discord { flex-wrap: nowrap; gap: 8px; padding: 8px 16px; white-space: normal; text-align: center; }
}
@media (prefers-reduced-motion: reduce) { .jxa-install .jxa-row { transition: none; } .jxa-box .jxa-btn:active { transform: none; } }
