/* ATG Clinical Supplies — cart UI (icon badge, slide-in drawer, toast, checkout modal).
 * Loaded from every /clinical-supplies/* page. Uses the CSS variables defined
 * in each page's inline :root token block, so colors stay in sync with
 * docs/DESIGN_TOKENS.md without duplicating hex values here. */

/* ========================================================================
 * Cart icon button (header)
 * ====================================================================== */
.cart-icon-btn {
  position: relative;
  background: #fff;
  border: 1px solid #c9bcad;
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4b433c;
  transition: transform .16s ease-out, border-color .16s ease-out, box-shadow .16s ease-out;
  font-family: inherit;
  padding: 0;
  flex-shrink: 0;
}
.cart-icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  box-shadow: 0 10px 25px rgba(0,0,0,.08);
}
.cart-icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.cart-icon-btn svg { width: 20px; height: 20px; }
.cart-icon-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 .35rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.22);
}
.cart-icon-btn[data-empty="true"] .cart-icon-badge { display: none; }

/* ========================================================================
 * Drawer (slide-in from right)
 * ====================================================================== */
.cart-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease-out;
  z-index: 9998;
}
.cart-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 92%;
  height: 100vh;
  background: #fff;
  box-shadow: -24px 0 60px rgba(24,16,8,.16);
  transform: translateX(100%);
  transition: transform .22s ease-out;
  display: flex;
  flex-direction: column;
  z-index: 9999;
}
.cart-drawer.open { transform: translateX(0); }

.cart-drawer-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #fff;
}
.cart-drawer-title {
  font-family: "Playfair Display", serif;
  font-size: 1.2rem;
  color: var(--text-main);
  letter-spacing: .04em;
  margin: 0;
}
.cart-drawer-close {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  color: #999;
  border-radius: 50%;
  font-family: inherit;
}
.cart-drawer-close:hover { color: var(--text-main); background: var(--pill-bg); }
.cart-drawer-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: .4rem 1.5rem 1rem;
}

.cart-empty {
  text-align: center;
  padding: 2.8rem 1rem 2rem;
  color: var(--text-muted);
  font-size: .9rem;
}
.cart-empty-title {
  font-family: "Playfair Display", serif;
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: .5rem;
}
.cart-empty p { margin-bottom: 1.2rem; }
.cart-empty a {
  color: var(--accent-dark);
  border-bottom: 1px solid var(--accent);
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: .78rem;
}

.cart-line {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: .85rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-soft);
  align-items: start;
}
.cart-line:last-child { border-bottom: none; }
.cart-line-img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Playfair Display", serif;
  font-size: .72rem;
  text-align: center;
  line-height: 1.1;
  padding: .3rem;
  overflow: hidden;
  border: 1px solid var(--border-strong);
}
.cart-line-img[data-cat="exosomes"] {
  background: linear-gradient(135deg, #c49652, #a67930);
  color: #fff;
  border-color: transparent;
}
.cart-line-img[data-cat="devices"] {
  background: linear-gradient(135deg, #20110c, #3b0e10);
  color: #fcede1;
  border-color: transparent;
}
.cart-line-img[data-cat="skincare"] {
  background: linear-gradient(135deg, #fdf8f3, #f4ece0);
  color: var(--text-main);
}
.cart-line-img[data-cat="bundle"] {
  background: var(--card-bg);
  color: var(--accent-dark);
}
.cart-line-name {
  font-family: "Playfair Display", serif;
  font-size: .94rem;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: .25rem;
}
.cart-line-price {
  font-size: .78rem;
  color: var(--text-muted);
}
.cart-line-controls {
  margin-top: .45rem;
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .82rem;
  flex-wrap: wrap;
}
.cart-qty-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-main);
  padding: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cart-qty-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.cart-qty-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cart-qty-btn:disabled { opacity: .4; cursor: not-allowed; }
.cart-qty-value {
  min-width: 32px;
  text-align: center;
  font-weight: 600;
  color: var(--text-main);
}
.cart-line-remove {
  background: none;
  border: none;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: .7rem;
  padding: 0;
  font-family: inherit;
  font-weight: 500;
}
.cart-line-remove:hover { color: #c0392b; }
.cart-line-remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cart-line-total {
  font-family: "Playfair Display", serif;
  font-size: .95rem;
  color: var(--text-main);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.cart-drawer-footer {
  padding: 1.1rem 1.5rem 1.3rem;
  border-top: 1px solid var(--border-soft);
  background: var(--card-bg);
}
.cart-subtotal-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: .3rem;
  font-size: .9rem;
  align-items: baseline;
}
.cart-subtotal-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .78rem;
}
.cart-subtotal-value {
  font-family: "Playfair Display", serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-dark);
}
.cart-subtotal-note {
  font-size: .72rem;
  color: var(--text-muted);
  margin-bottom: .9rem;
  line-height: 1.5;
}
.cart-checkout-btn { width: 100%; }

/* ========================================================================
 * Toast
 * ====================================================================== */
.cart-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text-main);
  color: #fef6ee;
  padding: .8rem 1.2rem;
  border-radius: 999px;
  font-size: .86rem;
  box-shadow: 0 18px 40px rgba(24,16,8,.24);
  z-index: 10000;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .18s ease-out, transform .18s ease-out;
  pointer-events: none;
  max-width: 360px;
}
.cart-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.cart-toast-icon {
  color: var(--accent);
  margin-right: .55rem;
  font-weight: 700;
}

/* ========================================================================
 * Multi-line checkout summary modal
 * ====================================================================== */
.cart-checkout-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0,0,0,.6);
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}
.cart-checkout-modal.open { display: flex; }

.cart-checkout-content {
  background: #fff;
  padding: 2rem 2.2rem 2.2rem;
  border-radius: 20px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
}
.cart-checkout-close {
  position: absolute;
  top: .8rem;
  right: 1.2rem;
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  color: #999;
  font-family: inherit;
  padding: .25rem .5rem;
}
.cart-checkout-close:hover { color: #000; }
.cart-checkout-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.cart-checkout-title {
  font-family: "Playfair Display", serif;
  font-size: 1.4rem;
  margin-bottom: .4rem;
  color: var(--text-main);
}
.cart-checkout-intro {
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 1.2rem;
  line-height: 1.55;
}

.cart-checkout-line {
  padding: 1rem 0;
  border-top: 1px solid var(--border-soft);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
}
.cart-checkout-line:last-of-type {
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 1.2rem;
}
.cart-checkout-line-label {
  font-family: "Playfair Display", serif;
  font-size: .98rem;
  color: var(--text-main);
  line-height: 1.3;
}
.cart-checkout-line-meta {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .2rem;
}
.cart-checkout-pay {
  white-space: nowrap;
  font-size: .76rem;
  padding: .5rem 1rem;
}

.cart-bundle-request-link {
  display: block;
  text-align: center;
  margin-top: 1.3rem;
  color: var(--accent-dark);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 600;
}
.cart-bundle-request-link:hover { color: var(--text-main); }

/* ========================================================================
 * Mobile
 * ====================================================================== */
@media (max-width: 720px) {
  .cart-drawer {
    width: 100%;
    max-width: 100%;
  }
  .cart-toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
    text-align: center;
  }
  .cart-checkout-content {
    padding: 1.6rem 1.5rem 1.8rem;
  }
}
