/* ===================================================================
 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; }
