/* ===================================================================
 site-cart.css -- styles for the modernized (stay-on-page) cart.

 Loaded alongside site-cart.js. Companion to site-dialog-popups.css
 (which styles the generic #dialog-container). This file owns:

  1. The slide-in "Added to cart" toast (replaces the old
    #shopping-cart-popup "Item Added to Cart" modal).
  2. The Wall-Adapter option picker rendered inside a <dialog>.
  3. The Add-to-Cart button "is-added" success state (moved here
    from wherever it lived so the whole cart UI is in one place;
    the class is still toggled by site-cart.js).

 Colour tokens match site-dialog-popups.css: primary #4792bc,
 primary-hover #3a7a9f, text #555, heading #4792bc.
=================================================================== */

:root {
  --cart-primary: #4792bc;
  --cart-primary-hover: #3a7a9f;
  --cart-text: #555;
  --cart-radius: 16px;
  --cart-shadow: 0 10px 40px rgba(0, 0, 0, 0.22);
}

/* ===================================================================
 1. SLIDE-IN "ADDED TO CART" TOAST
 Desktop: slides in from the top-right.
 Mobile (<=767): slides up from the bottom, clearing the
 Redesign-2026 bottom nav bar.
 Auto-dismisses (JS controls timing); hovering pauses dismissal.
=================================================================== */
.cart-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1200; /* above menu (header), below hard modals if any */

  display: flex;
  align-items: center;
  gap: 14px;

  width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;

  background: #fff;
  border-radius: var(--cart-radius);
  box-shadow: var(--cart-shadow);
  border-left: 5px solid var(--cart-primary);

  cursor: pointer; /* whole toast navigates to cart on click */

  /* start off-screen to the right; JS adds .is-visible to slide in */
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.38s ease;
  will-change: transform, opacity;
}

.cart-toast.is-visible {
  transform: translateX(0);
  opacity: 1;
}

.cart-toast__thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
  background: #f4f6f7;
  padding: 4px;
  box-sizing: border-box;
}

.cart-toast__body {
  flex: 1 1 auto;
  min-width: 0; /* allow text truncation */
}

.cart-toast__status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--cart-primary);
  margin: 0 0 2px;
}

.cart-toast__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cart-primary);
  color: #fff;
  font-size: 11px;
  line-height: 1;
}

.cart-toast__name {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin: 0;
  /* clamp to one line */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-toast__count {
  font-size: 13px;
  color: var(--cart-text);
  margin: 2px 0 0;
}

.cart-toast__close {
  flex: 0 0 auto;
  align-self: flex-start;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #aaa;
  cursor: pointer;
  padding: 2px;
}
.cart-toast__close:hover { color: #666; }

/* Mobile: dock to the bottom, above the app-style bottom nav.
 --menu-bottomnav-h is a fallback estimate; if the menu exposes its
 own custom property we honour it. */
@media (max-width: 767px) {
  .cart-toast {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--menu-bottomnav-h, 68px) + 12px);
    width: auto;

    transform: translateY(calc(100% + 24px));
  }
  .cart-toast.is-visible {
    transform: translateY(0);
  }
}

/* Respect reduced-motion: fade only, no slide. */
@media (prefers-reduced-motion: reduce) {
  .cart-toast {
    transition: opacity 0.25s ease;
    transform: none;
  }
  .cart-toast.is-visible { transform: none; }
}

/* ===================================================================
 2. WALL-ADAPTER OPTION PICKER (inside #dialog-container)
 Rendered by site-cart.js into the generic dialog's #dialog-message.
 Card list rather than the legacy <table> layout.
=================================================================== */
.cart-options__intro {
  font-size: 16px;
  color: var(--cart-text);
  line-height: 24px;
  margin: 0 0 18px;
  text-align: center;
}
.cart-options__intro .sc_prod_link {
  color: var(--cart-primary);
  font-weight: 700;
}

.cart-options__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.cart-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid #d9ddd0;
  border-radius: 12px;
  background: #fbfbf7;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.cart-option:hover {
  border-color: var(--cart-primary);
  box-shadow: 0 2px 10px rgba(71, 146, 188, 0.15);
}

.cart-option__thumb {
  flex: 0 0 auto;
  width: 86px;
  height: 57px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  cursor: zoom-in;
}

.cart-option__info { flex: 1 1 auto; min-width: 0; }

.cart-option__code {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: #7a7f6c;
  margin: 0 0 2px;
}
.cart-option__name {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin: 0 0 2px;
}
.cart-option__desc {
  font-size: 12px;
  color: #888;
  margin: 0;
  line-height: 17px;
}

.cart-option__select {
  flex: 0 0 auto;
  background-color: var(--cart-primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.cart-option__select:hover {
  background-color: var(--cart-primary-hover);
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .cart-option { flex-wrap: wrap; }
  .cart-option__thumb { width: 64px; height: 43px; }
  .cart-option__select { width: 100%; margin-top: 6px; }
}

/* ===================================================================
 2b. MOBILE CART SHEET filled/empty state toggle.
 Header.aspx Case 2 now emits BOTH states inside #menu-sheet-cart so
 site-cart.js can flip them after an in-page add without a reload.
 .menu-sheet--hasitems (set server-side, toggled client-side) selects
 which is visible.
=================================================================== */
#menu-sheet-cart .menu-cart-filled { display: none; }
#menu-sheet-cart .menu-cart-empty-state { display: block; }
#menu-sheet-cart.menu-sheet--hasitems .menu-cart-filled { display: block; }
#menu-sheet-cart.menu-sheet--hasitems .menu-cart-empty-state { display: none; }

/* ===================================================================
 3. ADD-TO-CART BUTTON SUCCESS STATE (.is-added)
 Toggled by site-cart.js on click for immediate button-level
 acknowledgement (independent of the toast, which confirms the
 server commit). Works on the home-page .model__add-to-cart /
 .product__atc-label buttons.
=================================================================== */
.model__add-to-cart.is-added,
.product__atc-label.is-added {
  background-color: var(--cart-primary) !important;
  color: #fff !important;
  box-shadow: 0 0 0 4px rgba(71, 146, 188, 0.25);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

/* ===================================================================
 4. PRODUCT CART FIELDS (home page)
 The home-page add-to-cart blocks were converted from
 <table.product__cart-table><tr><td> to <div.product__cart-fields>
 during the 2026 modernization. The external stylesheet still targets
 the old table for spacing; this rule reproduces the row layout (qty
 input beside the ADD TO CART button) so the conversion is visually
 self-contained. Layout only -- colours/typography stay in the theme.
=================================================================== */
.product__cart-fields {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.product__cart-fields .product__qty { flex: 0 0 auto; }
.product__cart-fields .product__qty form { margin: 0; }
.product__cart-fields .add-to-cart,
.product__cart-fields .lite_add-to-cart { flex: 0 1 auto; }

/* ===================================================================
 5. HEADER MINI-CART: EDITABLE ROWS (site-cart.js section 3b)
 The cart dropdown (desktop) and cart sheet (mobile) rows carry a
 quantity stepper and a remove control. Visual language borrowed
 from the site itself:
  * the buy-panel pill stepper ( - 1 + ) -- one capsule drawn from
   the three existing controls, no wrapper markup;
  * the cart page's trash can, lid tilting on hover -- drawn in CSS
   (::before = lid + handle, ::after = can with three slots), so the
   markup stays a plain <button> and Header.aspx needs no change.
 .menu-cart-subtotal is created by site-cart.js on first paint.
=================================================================== */
.menu-cart-row{display:flex;align-items:center;gap:14px;padding:8px 0}
.menu-cart-row + .menu-cart-row{border-top:1px solid #eef1f4}
.menu-cart-thumblink{flex:0 0 auto;line-height:0}
.menu-cart-thumb{display:block;border-radius:6px}
.menu-cart-info{display:flex;flex-direction:column;gap:8px;flex:1 1 auto;min-width:0}
.menu-cart-name{display:block;font-weight:600;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.menu-cart-ctl{display:flex;align-items:center;gap:0}   /* gap:0 -- the capsule pieces must touch */

/* ---- pill stepper: dec | qty | inc as one capsule ------------------ */
.menu-cart-step,
.menu-cart-qtyinput{box-sizing:border-box;height:30px;margin:0;border:1px solid #6b7280;background:#fff;color:#222;font-family:inherit;font-size:15px;line-height:1}
.menu-cart-step{width:30px;padding:0;cursor:pointer;font-size:18px;color:#444;transition:background .15s,color .15s}
.menu-cart-step[data-cart-step="dec"]{border-radius:999px 0 0 999px;border-right:0;padding-left:4px}
.menu-cart-step[data-cart-step="inc"]{border-radius:0 999px 999px 0;border-left:0;padding-right:4px}
.menu-cart-step:hover{background:#eef5fa;color:var(--cart-primary)}
.menu-cart-step:active{background:#dceaf5}
.menu-cart-step:disabled{color:#c4c9d0;background:#fff;cursor:default}
.menu-cart-qtyinput{width:40px;padding:0;border-left:0;border-right:0;text-align:center;font-weight:600;-moz-appearance:textfield}
.menu-cart-qtyinput::-webkit-outer-spin-button,
.menu-cart-qtyinput::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.menu-cart-qtyinput:focus{outline:none;background:#f6fafd}
.menu-cart-ctl:focus-within .menu-cart-step,
.menu-cart-ctl:focus-within .menu-cart-qtyinput{border-color:var(--cart-primary)}

/* used unit: fixed quantity, same capsule silhouette */
.menu-cart-qtyfixed{box-sizing:border-box;margin-right:10px;height:30px;line-height:28px;padding:0 14px;border:1px solid #d6dbe1;border-radius:999px;color:#666;font-size:13px;white-space:nowrap}

/* ---- trash can (CSS-drawn), lid tilts on hover -------------------- */
.menu-cart-remove{--tc:#4a6fa5;position:relative;width:30px;height:30px;margin-left:auto;flex:0 0 auto;padding:0;border:0;border-radius:50%;background:transparent;color:transparent;font-size:0;cursor:pointer;transition:background .15s}
.menu-cart-remove::before,
.menu-cart-remove::after{content:"";position:absolute;left:50%;box-sizing:border-box}
/* lid bar + handle */
.menu-cart-remove::before{top:7px;width:14px;height:4px;margin-left:-7px;border-radius:1px;
  background:linear-gradient(var(--tc),var(--tc)) 0 2px/14px 2px no-repeat,
             linear-gradient(var(--tc),var(--tc)) 5px 0/4px 2px no-repeat;
  transform-origin:1px 3px;transition:transform .25s ease,background .15s}
/* can body with three slots */
.menu-cart-remove::after{top:12px;width:11px;height:12px;margin-left:-5.5px;border-radius:0 0 2px 2px;
  background:linear-gradient(#fff,#fff) 3px 2px/1px 7px no-repeat,
             linear-gradient(#fff,#fff) 5px 2px/1px 7px no-repeat,
             linear-gradient(#fff,#fff) 7px 2px/1px 7px no-repeat,
             var(--tc);transition:background .15s}
.menu-cart-remove:hover,
.menu-cart-remove:focus-visible{--tc:#c00;background:#fdecec;outline:none}
.menu-cart-remove:hover::before,
.menu-cart-remove:focus-visible::before{transform:rotate(-24deg)}
.menu-cart-remove:disabled{opacity:.4;cursor:default}
/* the same icon as an <a> on the cart page (orders_details_API.aspx) */
a.sc-remove{display:block;margin:0 auto;line-height:0;text-decoration:none}   /* block, not inline: no baseline drop in the <td> */

/* ---- subtotal (created by site-cart.js on first paint) ------------ */
.menu-cart-subtotal{display:flex;justify-content:space-between;align-items:baseline;margin:10px 0 2px;padding-top:8px;border-top:1px solid #eef1f4;font-size:14px;color:#555}
.menu-cart-subtotal b{font-size:16px;color:#222}
.menu-cart-subtotal[hidden]{display:none}

/* ---- states ------------------------------------------------------- */
.menu-cart-row.is-busy{opacity:.55;pointer-events:none}          /* remove in flight */
.menu-cart-row.is-syncing .menu-cart-qtyinput{color:#8a8f98}     /* quantity in flight; steppers stay live */
.menu-cart-row.is-syncing .menu-cart-remove{opacity:.4}
.menu-cart-row.is-removing{opacity:.2;transform:translateX(10px);transition:opacity .2s ease,transform .2s ease}
.menu-cart-row.is-updated .menu-cart-qtyinput{animation:menu-cart-pop .35s ease-out}
@keyframes menu-cart-pop{
  0%{background:#dceaf5;transform:scale(1)}
  40%{transform:scale(1.14)}
  100%{background:#fff;transform:scale(1)}
}
@media (prefers-reduced-motion:reduce){
  .menu-cart-remove::before,.menu-cart-row.is-removing{transition:none}
  .menu-cart-row.is-updated .menu-cart-qtyinput{animation:none}
}
