/* LadyLife Manager · AJAX cart controls (1.2.14)
   Scoped to .ll-store (plus the product page's mobile buy bar, which lives at <body> level).
   Palette: #47267f · #341b5e · #be438f · #efe9f7. */

:is(.ll-store, .ll-pdp-buybar) .ll-atc {
  --ll-atc-h: 40px;
  --ll-atc-r: 10px;
  position: relative; display: block; width: 100%; box-sizing: border-box;
  margin: auto 0 0; direction: rtl; font-family: inherit;
}
:is(.ll-store, .ll-pdp-buybar) .ll-atc[hidden],
:is(.ll-store, .ll-pdp-buybar) .ll-atc [hidden] { display: none !important; }

/* ---- Add button ---- */
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: var(--ll-atc-h); min-height: var(--ll-atc-h); box-sizing: border-box;
  margin: 0; padding: 0 10px; border: 1px solid #47267f; border-radius: var(--ll-atc-r);
  background: #47267f; color: #fff; cursor: pointer; text-decoration: none;
  font: inherit; font-size: 12.5px; font-weight: 800; line-height: 1; white-space: nowrap;
  box-shadow: 0 3px 10px rgba(71, 38, 127, .18);
  transition: background-color .16s ease, box-shadow .16s ease, transform .12s ease, opacity .16s ease;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  :is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-add:hover { background: #341b5e; border-color: #341b5e; }
  :is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-link:hover { background: #efe9f7; color: #341b5e; }
  :is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-btn:not(:disabled):hover { background: #efe9f7; }
}
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-add:active { transform: scale(.98); }
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-add:focus-visible { outline: 3px solid #be438f; outline-offset: 2px; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-btn:focus { outline: none; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-btn:focus-visible { outline: 3px solid #be438f; outline-offset: -3px; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-icon { display: inline-flex; flex: 0 0 auto; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-icon svg { width: 17px; height: 17px; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-label { overflow: hidden; text-overflow: ellipsis; }

/* Fallbacks: out of stock / choose options / view product. */
:is(.ll-store, .ll-pdp-buybar) .ll-atc.is-oos .ll-atc-add,
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-add:disabled {
  background: #f1eff5; border-color: #e3dfea; color: #8a8698; box-shadow: none; cursor: not-allowed; transform: none;
}
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-link {
  background: #fff; color: #47267f; border-color: #47267f; box-shadow: none;
}

/* ---- Quantity stepper: [ + | n | − / 🗑 ] (RTL: plus on the right) ---- */
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-stepper {
  display: flex; align-items: stretch; justify-content: space-between; flex-direction: row;
  height: var(--ll-atc-h); box-sizing: border-box; width: 100%;
  border: 1px solid #e3dcef; border-radius: var(--ll-atc-r); background: #fff;
  box-shadow: 0 2px 8px rgba(52, 27, 94, .06); overflow: hidden;
  animation: ll-atc-pop .18s ease-out;
}
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-btn {
  flex: 0 0 auto; width: calc(var(--ll-atc-h) + 2px); min-width: 0; height: 100%;
  display: grid; place-items: center; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; color: #be438f; cursor: pointer;
  box-shadow: none; -webkit-tap-highlight-color: transparent;
  transition: background-color .14s ease, color .14s ease, opacity .14s ease;
}
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-btn:active { background: #e6dcf4; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-btn:disabled { color: #c9c3d6; background: transparent; cursor: not-allowed; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-btn svg { width: 20px; height: 20px; display: block; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-qty {
  flex: 1 1 auto; position: relative; display: grid; place-items: center; min-width: 28px;
  font-size: 16px; font-weight: 800; color: #47267f; font-variant-numeric: tabular-nums;
  user-select: none;
}
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-i-trash { display: none; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc.is-qty-one .ll-atc-i-minus { display: none; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc.is-qty-one .ll-atc-i-trash { display: block; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-i-minus,
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-i-trash { line-height: 0; }

/* ---- Loading ---- */
:is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-spin {
  display: none; width: 16px; height: 16px; box-sizing: border-box; border-radius: 50%;
  border: 2px solid currentColor; border-inline-start-color: transparent;
  animation: ll-atc-spin .7s linear infinite;
}
:is(.ll-store, .ll-pdp-buybar) .ll-atc.is-adding .ll-atc-add { pointer-events: none; opacity: .92; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc.is-adding .ll-atc-add .ll-atc-icon { display: none; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc.is-adding .ll-atc-add .ll-atc-spin { display: inline-block; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc.is-busy .ll-atc-qty .ll-atc-num { visibility: hidden; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc.is-busy .ll-atc-qty .ll-atc-spin { display: block; position: absolute; color: #be438f; }
:is(.ll-store, .ll-pdp-buybar) .ll-atc.is-busy .ll-atc-btn { opacity: .55; }
@keyframes ll-atc-spin { to { transform: rotate(360deg); } }
@keyframes ll-atc-pop { from { transform: scale(.96); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  :is(.ll-store, .ll-pdp-buybar) .ll-atc .ll-atc-stepper { animation: none; }
}

/* ---- Hosts ---- */
/* Block product cards (grid, related, search, categories). */
.ll-store .wc-block-product .ll-atc-block,
.ll-store .ll-atc-block { width: 100%; margin: auto 0 0 !important; display: block; }
.ll-store .wc-block-product .ll-atc-block::before,
.ll-store .wc-block-product .ll-atc-block::after { display: none; }
/* Shop template rails (<a class="ll-h-card">): the control replaces .ll-h-buybtn. */
.ll-store .ll-h-card .ll-atc-host { display: block; width: 100%; margin-top: auto; }
.ll-store .ll-h-card .ll-atc { --ll-atc-h: 38px; margin-top: 10px; }
.ll-store .ll-h-card .ll-atc .ll-atc-add { font-size: 12px; padding: 0 6px; gap: 5px; }
.ll-store .ll-h-card .ll-atc .ll-atc-icon svg { width: 15px; height: 15px; }
.ll-store .ll-h-card .ll-atc .ll-atc-btn { width: 38px; }
/* Black Friday cards stay light; the CTA uses the same control. */
.ll-store .ll-bf-card .ll-bf-card-actions { margin-top: auto; padding-top: 10px; }
/* Classic loops. */
.ll-store ul.products li.product .ll-atc { margin-top: 10px; }

/* ---- Product page buy box ---- */
.ll-store .ll-buybox form.cart[data-ll-atc-form] { display: none !important; }
.ll-store .ll-buybox .ll-atc--pdp { --ll-atc-h: 50px; --ll-atc-r: 12px; margin: 4px 0 0; }
.ll-store .ll-buybox .ll-atc--pdp .ll-atc-add { font-size: 15px; gap: 8px; }
.ll-store .ll-buybox .ll-atc--pdp .ll-atc-icon svg { width: 20px; height: 20px; }
.ll-store .ll-buybox .ll-atc--pdp .ll-atc-btn { width: 56px; }
.ll-store .ll-buybox .ll-atc--pdp .ll-atc-qty { font-size: 18px; }
.ll-store .ll-buybox .single_add_to_cart_button.is-loading { opacity: .7; pointer-events: none; }

/* Mobile buy bar (assets/storefront.js) reuses the control. */
.ll-pdp-buybar .ll-atc--bar { --ll-atc-h: 44px; --ll-atc-r: 12px; flex: 0 0 auto; width: 148px; margin: 0; }
.ll-pdp-buybar .ll-atc--bar .ll-atc-add { font-size: 13px; padding: 0 10px; }
.ll-pdp-buybar .ll-atc--bar .ll-atc-btn { width: 44px; }

/* ---- Toast «به سبد خرید اضافه شد» ---- */
.ll-store.ll-atc-layer {
  position: fixed; z-index: 99995; left: 0; right: 0; bottom: 24px;
  display: flex; justify-content: center; pointer-events: none; padding: 0 12px;
}
.ll-store.ll-atc-layer .ll-atc-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  max-width: 440px; width: max-content; box-sizing: border-box;
  padding: 10px 12px 10px 8px; border-radius: 14px;
  background: #341b5e; color: #fff; font-size: 13.5px; font-weight: 700; line-height: 1.6;
  box-shadow: 0 12px 30px rgba(52, 27, 94, .32);
  transform: translateY(14px); opacity: 0; transition: transform .2s ease, opacity .2s ease;
}
.ll-store.ll-atc-layer .ll-atc-toast.is-on { transform: none; opacity: 1; }
.ll-store.ll-atc-layer .ll-atc-toast.is-err { background: #7a1f45; }
.ll-store.ll-atc-layer .ll-atc-toast-icon {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: #be438f; color: #fff; font-size: 13px; font-weight: 900;
}
.ll-store.ll-atc-layer .ll-atc-toast.is-err .ll-atc-toast-icon { background: #fff; color: #7a1f45; }
.ll-store.ll-atc-layer .ll-atc-toast-text { flex: 1 1 auto; min-width: 0; }
.ll-store.ll-atc-layer .ll-atc-toast-link {
  flex: 0 0 auto; padding: 6px 12px; border-radius: 10px; background: #efe9f7; color: #47267f;
  font-size: 12.5px; font-weight: 800; text-decoration: none; white-space: nowrap;
}
.ll-store.ll-atc-layer .ll-atc-toast-link:hover { background: #fff; }
.ll-store.ll-atc-layer .ll-atc-toast-close {
  flex: 0 0 auto; width: 28px; height: 28px; margin: 0; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: rgba(255, 255, 255, .75); font-size: 20px; line-height: 1; cursor: pointer;
}
@media (max-width: 781px) {
  /* Above the floating tab pill (and above the product page buy bar when present). */
  body.ll-ms .ll-store.ll-atc-layer { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
  body.ll-ms .ll-store.ll-atc-layer.has-buybar { bottom: calc(152px + env(safe-area-inset-bottom, 0px)); }
  body.ll-ms .ll-store.ll-atc-layer .ll-atc-toast { width: 100%; max-width: none; }
}

/* ---- Cart page: clear checkout CTA, sticky above the tab pill on phones ---- */
.ll-store .wc-block-cart .wc-block-cart__submit-button {
  min-height: 52px; border-radius: 12px; background: #47267f; color: #fff; border: 0;
  font-weight: 800; font-size: 15px; box-shadow: 0 6px 16px rgba(71, 38, 127, .22);
}
.ll-store .wc-block-cart .wc-block-cart__submit-button:hover { background: #341b5e; color: #fff; }
.ll-store .wc-block-cart .wc-block-components-quantity-selector { border-radius: 10px; border-color: #e3dcef; }
.ll-store .wc-block-cart .wc-block-components-quantity-selector__button { color: #be438f; }
@media (max-width: 781px) {
  body.ll-ms .ll-store .wc-block-cart .wc-block-cart__submit-container--sticky {
    left: 12px !important; right: 12px !important;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px)) !important;
    border-radius: 16px; padding: 8px !important; background: #fff;
    box-shadow: 0 8px 28px rgba(52, 27, 94, .16), 0 2px 6px rgba(52, 27, 94, .07);
  }
  body.ll-ms .ll-store .wc-block-cart .wc-block-cart__submit-container--sticky::before { display: none; }
}

/* --------------------------------------------------------------------------
   Cart page table (classic [woocommerce_cart]) — desktop balance.
   The Store Header CSS sets `tr:has(> td.actions) { display: block }` on all
   viewports, which breaks table column widths: the name column collapses and
   the subtotal/price columns eat the leftover space. Restore a real table on
   desktop and give the product name the remaining width (2–3 lines).
   -------------------------------------------------------------------------- */
@media (min-width: 782px) {
  body.woocommerce-cart .ll-store table.shop_table.cart {
    table-layout: fixed !important;
    width: 100% !important;
    display: table !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart thead {
    display: table-header-group !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart tbody {
    display: table-row-group !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart tr.woocommerce-cart-form__cart-item {
    display: table-row !important;
    grid-template-columns: none !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart tr.woocommerce-cart-form__cart-item td {
    display: table-cell !important;
    width: auto !important;
    padding: 16px 10px !important;
    border-bottom: 1px solid #f0ecf6 !important;
    vertical-align: middle !important;
    min-width: 0 !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart tr.woocommerce-cart-form__cart-item td::before {
    display: none !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart .product-remove,
  body.woocommerce-cart .ll-store table.shop_table.cart td.product-remove {
    width: 44px !important;
    text-align: center !important;
    padding-inline: 4px !important;
    position: static !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart .product-thumbnail,
  body.woocommerce-cart .ll-store table.shop_table.cart td.product-thumbnail {
    width: 82px !important;
    padding-inline: 6px !important;
    grid-column: auto !important;
    grid-row: auto !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart td.product-thumbnail img {
    width: 64px !important;
    height: 64px !important;
    max-width: 64px !important;
    object-fit: contain !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart .product-name,
  body.woocommerce-cart .ll-store table.shop_table.cart td.product-name {
    width: auto !important;
    min-width: 0 !important;
    text-align: start !important;
    padding-left: 10px !important;
    grid-column: auto !important;
    grid-row: auto !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart td.product-name a {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 3 !important;
    overflow: hidden !important;
    line-height: 1.7 !important;
    font-weight: 700 !important;
    color: #341b5e !important;
    text-decoration: none !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    max-width: 100% !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart .product-price,
  body.woocommerce-cart .ll-store table.shop_table.cart .product-quantity,
  body.woocommerce-cart .ll-store table.shop_table.cart td.product-price,
  body.woocommerce-cart .ll-store table.shop_table.cart td.product-quantity {
    width: 7.25rem !important;
    white-space: nowrap !important;
    text-align: center !important;
    grid-column: auto !important;
    grid-row: auto !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart .product-subtotal,
  body.woocommerce-cart .ll-store table.shop_table.cart td.product-subtotal {
    width: 8.25rem !important;
    white-space: nowrap !important;
    text-align: center !important;
    grid-column: auto !important;
    grid-row: auto !important;
    justify-self: auto !important;
  }
  /* Keep the actions row as a table row so it does not collapse other columns. */
  body.woocommerce-cart .ll-store table.shop_table.cart tr:has(> td.actions) {
    display: table-row !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart td.actions {
    /* Keep table-cell so colspan spans the full row; flex on a td shrinks it. */
    display: table-cell !important;
    text-align: start !important;
    width: auto !important;
    padding: 18px 10px 4px !important;
    border-bottom: 0 !important;
    vertical-align: middle !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart td.actions > * {
    display: inline-flex !important;
    vertical-align: middle !important;
    margin: 0 0 8px 10px !important;
  }
  body.woocommerce-cart .ll-store .ll-cart-coupon-trigger {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: min-content !important;
    max-width: none !important;
    min-height: 40px !important;
    padding: 8px 14px !important;
    border-radius: 999px !important;
    border: 1px solid #e3dcef !important;
    background: #f7f4fb !important;
    color: #341b5e !important;
    font: inherit !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
    cursor: pointer !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart td.actions .coupon {
    flex: 1 1 280px !important;
    float: none !important;
    width: auto !important;
    max-width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px 10px !important;
    padding: 0 !important;
    border-top: 0 !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart td.actions.is-coupon-collapsed .coupon {
    display: none !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart td.actions .coupon input.input-text {
    min-width: 12rem !important;
    flex: 1 1 14rem !important;
    max-width: 24rem !important;
    height: 44px !important;
  }
  body.woocommerce-cart .ll-store table.shop_table.cart td.actions .coupon button.button,
  body.woocommerce-cart .ll-store table.shop_table.cart td.actions button[name="update_cart"] {
    height: 44px !important;
    width: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 16px !important;
    white-space: nowrap !important;
  }
}

/* Mobile: keep the existing card/grid layout; just cap a runaway name. */
@media (max-width: 781px) {
  body.woocommerce-cart .ll-store table.shop_table.cart tr.woocommerce-cart-form__cart-item td.product-name a {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 3 !important;
    overflow: hidden !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
  }
}
