/*
 * Divi 5 Mini Cart module: base layout only (positioning, visibility states, neutral defaults).
 * Colors, fonts, spacing and borders are set per module through Divi's design settings, which load after this file.
 */

/* Module: cart icon and count only */
.dmc5 {
  position: relative;
  display: inline-block;
  line-height: 1.4;
}

/* Trigger */
.dmc5-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.dmc5-trigger__icon {
  font-family: ETmodules;
  font-size: 21px;
  line-height: 1;
  speak: none;
}
/* Uploaded icon image: as tall as the icon font size, so the same size settings apply */
.dmc5-trigger__icon--image img {
  display: block;
  width: auto;
  height: 1em;
  max-width: none;
}
/*
 * Count badge: the number plus --dmc5-count-pad (Inner Spacing) on every side, centered with flex. Height and
 * min-width are the same, so one digit is a circle and longer numbers stretch into a pill. Sized from the number's
 * font size (1em, line-height 1), so Number Size and Inner Spacing never conflict. Corners: Divi's border radius
 * only; width/style/color aren't offered, hence border: 0.
 */
.dmc5-trigger__count {
  --dmc5-count-pad: 3px;
  position: absolute;
  top: -8px;
  right: -12px;
  translate: var(--dmc5-count-x, 0) var(--dmc5-count-y, 0); /* Horizontal / Vertical Offset */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: calc(1em + 2 * var(--dmc5-count-pad));
  min-width: calc(1em + 2 * var(--dmc5-count-pad));
  padding: 0 var(--dmc5-count-pad);
  border: 0;
  border-radius: 999px;
  background: #333;
  color: #fff;
  font-size: 11px;
  font-weight: 400; /* Design → Count → Number Weight (default) */
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}
/* Content → Elements → Show Count When Empty off */
.dmc5--hide-empty-count.is-empty .dmc5-trigger__count {
  display: none;
}

/*
 * Cart panel: one per page, outside the module (footer on the front end, a <body> portal in the builder). Its root
 * carries `{orderClass}_cart`, which the owner module's design CSS targets.
 */
.dmc5-cart {
  line-height: 1.4;
  text-align: left;
}
.dmc5-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  z-index: var(--dmc5-z, 100000); /* Advanced → Mini Cart Window → Mini Cart Z Index */
  display: flex;
  flex-direction: column;
  width: 380px;
  max-width: 100vw;
  /* No padding: header, body and footer pad themselves, so the header can span the full width */
  padding: 0;
  /* Clip the parts to a border radius set in Divi (the header's top corners). Doesn't clip the panel's own
     box-shadow; the items scroll in .dmc5-panel__body, not here. */
  overflow: hidden;
  overflow: clip;
  background: #fff;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
}
.dmc5-cart--left .dmc5-panel {
  right: auto;
  left: 0;
}

/*
 * Open / close animation. Closed, the panel sits off-screen on its side and the overlay is transparent; `is-open`
 * slides it in. JS removes `hidden` before adding `is-open` and sets it back after the closing transition, so the
 * closed panel stays out of the tab order. --dmc5-duration comes from the module's Animation Duration setting.
 */
.dmc5-panel {
  transform: translateX(100%);
  transition: transform var(--dmc5-duration, 300ms) cubic-bezier(0.4, 0, 0.2, 1);
}
.dmc5-cart--left .dmc5-panel {
  transform: translateX(-100%);
}
.dmc5-overlay {
  opacity: 0;
  transition: opacity var(--dmc5-duration, 300ms) ease;
}
.dmc5-cart.is-open .dmc5-panel {
  transform: none;
}
.dmc5-cart.is-open .dmc5-overlay {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .dmc5-panel,
  .dmc5-overlay {
    transition: none;
  }
}
/* Below the WordPress admin bar (fixed from 601px up) */
@media (min-width: 601px) {
  .admin-bar .dmc5-panel {
    top: 32px;
  }
}
@media (min-width: 601px) and (max-width: 782px) {
  .admin-bar .dmc5-panel {
    top: 46px;
  }
}
.dmc5-panel[hidden],
.dmc5-overlay[hidden] {
  display: none;
}
.dmc5-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--dmc5-z, 100000) - 1);
  background: rgba(0, 0, 0, 0.4); /* default of Design → Mini Cart Window → Overlay Color */
}
html.dmc5-scroll-lock {
  overflow: hidden;
}
/*
 * Hiding the page scrollbar would widen the page and shift everything (the header with its cart icon too) sideways
 * under a resting pointer: in hover mode the icon slid away, closed the panel, slid back and reopened it. So its space
 * stays reserved, but only when the page had a scrollbar (JS adds the class): on a short page a gutter would narrow
 * the page instead. A gutter (unlike padding-right) also keeps fixed headers in place.
 */
html.dmc5-scroll-lock--gutter {
  scrollbar-gutter: stable;
}

/* Builder: the panel opens while its module is edited; the overlay must not block the canvas */
.dmc5-cart--builder .dmc5-overlay {
  pointer-events: none;
}
/* Builder: shown on a module that doesn't own the page's cart panel */
.dmc5-builder-notice {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid #f0a500;
  background: #fff6e0;
  color: #6b4a00;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 12px;
  font-weight: normal;
  line-height: 1.5;
}

/* Global Mini Cart placements (DMC5_Global::icon_html()), ported from the classic cart's wrappers */
/*
 * Left padding: the global cart's default Design → Spacing value (GLOBAL_DEFAULT_ATTRS in src/global/index.jsx),
 * which Divi doesn't print. A value set there is printed on the same order class, after this file, and wins.
 */
.dmc5-place--header {
  position: relative;
  display: inline-block;
  padding-left: 15px;
}
.dmc5-place--menu-module {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-left: 15px;
}
.et_pb_menu--style-inline_centered_logo .dmc5-place--menu-module {
  order: 1;
}
/* Menu item: the <li> itself is the wrapper; the menu's own item spacing applies, so no default padding here */
.dmc5-place--menu-item {
  position: relative;
}
/* Shortcode [divi_mini_cart]: inline in content, like the classic `.mini-cart-shortcode-wrap` (minus its padding: the
   global Design → Spacing default applies, as for the header). */
.dmc5-place--shortcode { position: relative; display: inline-flex; align-items: center; justify-content: center; padding-left: 15px; }
/* Builder: the Menu module's own cart button, replaced by the global icon placed before it (src/global/menu-module.jsx) */
.dmc5-place--menu-module + .et_pb_menu__cart-button {
  display: none !important;
}
@media (max-width: 980px) {
  .et_pb_menu--style-inline_centered_logo .dmc5-place--menu-module {
    order: 0;
  }
}

/* Builder: the Global Mini Cart's icon preview, at the top of the canvas above the panel and its overlay */
.dmc5-global-preview {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  transform: translateX(-50%);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
.dmc5-global-preview__label {
  color: #6b7280;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

/*
 * Header: title, then the close button. Design → Header → Close Button Position sets flex-direction per device
 * (row = × on the right, row-reverse = × on the left). The title grows to fill the row and flex-end keeps a lone ×
 * on its side, so the direction is the only thing that changes.
 */
.dmc5-panel__header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  border-bottom: 1px solid #f1f1f1;
}
.dmc5-panel__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  font-size: 18px;
}
.dmc5-panel__close {
  padding: 0 4px;
  border: 0;
  background: none;
  color: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

/* Items */
.dmc5-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Thin scrollbar: standard properties (Chrome/Edge 121+, Firefox, Safari 26.2+), which take precedence over the
     ::-webkit-scrollbar fallback below for older Safari / iOS. Color via --dmc5-scrollbar (Design → Mini Cart Window →
     Scrollbar Color, default rgba(0, 0, 0, 0.25)). */
  scrollbar-width: thin;
  scrollbar-color: var(--dmc5-scrollbar, rgba(0, 0, 0, 0.25)) transparent;
}
.dmc5-panel__body::-webkit-scrollbar {
  width: 6px;
}
.dmc5-panel__body::-webkit-scrollbar-track {
  background: transparent;
}
.dmc5-panel__body::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: var(--dmc5-scrollbar, rgba(0, 0, 0, 0.25));
}
/* Padding defaults match Design → Body / Footer → Spacing (default-attrs in module.json) */
.dmc5-panel__footer {
  padding: 0 20px 20px;
}
.dmc5-items {
  margin: 0;
  padding: 0;
  list-style: none;
}
/*
 * Item grid. Every part is a direct child of the li, placed by grid-template-areas; Content → Items → Item Layout
 * sets dmc5--items-{classic|price-top|qty-top|stacked} on the cart. Columns: image (its width + gap, 0
 * without thumbnails), text, a gap track, right column. The gap is --dmc5-col-gap (Design → Items → Column Gap,
 * default 12px); it's built into the tracks instead of column-gap so a hidden image column leaves no gap. Rows have no gap: parts carry 2px margins, so an empty
 * area (no meta) adds no space. The last row takes the spare height when the image is taller than the text.
 */
.dmc5-item {
  --dmc5-img-w: 64px;
  --dmc5-col-gap: 12px;
  --dmc5-img-col: calc(var(--dmc5-img-w) + var(--dmc5-col-gap));
  display: grid;
  grid-template-columns: var(--dmc5-img-col) minmax(0, 1fr) var(--dmc5-col-gap) auto;
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    "img name . remove"
    "img meta . ."
    "img qty  . price";
  align-items: start;
  padding: 10px 0; /* defaults of Design → Items → Spacing / Border */
  border-bottom: 1px solid #f1f1f1;
  transition: opacity 0.2s;
}
.dmc5-item > * {
  margin: 2px 0;
}
/* Design → Image: Image Width sets --dmc5-img-w; the border goes on this box (its radius clips the image) */
.dmc5-item__image {
  grid-area: img;
  display: block;
  box-sizing: border-box;
  width: var(--dmc5-img-w);
  margin: 0;
  overflow: hidden;
}
.dmc5-item__name {
  grid-area: name;
}
.dmc5-item__meta {
  grid-area: meta;
}
.dmc5-qty,
.dmc5-item__qty-text {
  grid-area: qty;
  justify-self: start;
}
/*
 * Price: a flex row so Content → Items → Sale Price Order can swap <del> and <ins> (dmc5--price-reverse). Each price
 * stays on one line; they wrap as a pair when the column is narrow.
 */
.dmc5-item__price {
  grid-area: price;
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-end;
  column-gap: 0.4em;
  text-align: end;
}
.dmc5-item__price del,
.dmc5-item__price ins {
  white-space: nowrap;
}
/* Design → Price → Regular Price Vertical Align sets top (default 0) */
.dmc5-item__price del {
  position: relative;
  top: 0;
  opacity: 0.6;
}
.dmc5-item__price ins {
  background: none;
  text-decoration: none;
}
.dmc5--price-reverse .dmc5-item__price del {
  order: 1;
}
/* Content → Elements → Show Regular Price on Sale Items off: the sale price only (its screen reader text stays) */
.dmc5--no-regular-price .dmc5-item__price del,
.dmc5--no-regular-price .dmc5-item__price del + .screen-reader-text {
  display: none;
}
.dmc5-item__price .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.dmc5-item__remove {
  grid-area: remove;
  justify-self: end;
}
/* Classic: quantity and price sit at the bottom */
.dmc5--items-classic .dmc5-qty,
.dmc5--items-classic .dmc5-item__qty-text,
.dmc5--items-classic .dmc5-item__price {
  align-self: end;
}
/* Price Top */
.dmc5--items-price-top .dmc5-item {
  grid-template-areas:
    "img name . price"
    "img meta . ."
    "img qty  . remove";
}
.dmc5--items-price-top .dmc5-qty,
.dmc5--items-price-top .dmc5-item__qty-text,
.dmc5--items-price-top .dmc5-item__remove {
  align-self: end;
}
/* Quantity Top */
.dmc5--items-qty-top .dmc5-item {
  grid-template-areas:
    "img name  . qty"
    "img price . remove"
    "img meta  . .";
}
.dmc5--items-qty-top .dmc5-qty,
.dmc5--items-qty-top .dmc5-item__qty-text {
  justify-self: end;
}
.dmc5--items-qty-top .dmc5-item__price {
  justify-self: start;
  justify-content: flex-start;
  text-align: start;
}
/* Stacked: name, price and meta in one column; quantity and remove at the bottom */
.dmc5--items-stacked .dmc5-item {
  grid-template-rows: auto auto auto 1fr;
  grid-template-areas:
    "img name  name  name"
    "img price price price"
    "img meta  meta  meta"
    "img qty   .     remove";
}
.dmc5--items-stacked .dmc5-item__price {
  justify-self: start;
  justify-content: flex-start;
  text-align: start;
}
.dmc5--items-stacked .dmc5-qty,
.dmc5--items-stacked .dmc5-item__qty-text,
.dmc5--items-stacked .dmc5-item__remove {
  align-self: end;
}
.dmc5-item.is-removing {
  opacity: 0.4;
  pointer-events: none;
}
.dmc5-item__image img {
  display: block;
  width: 100%;
  height: auto;
}
.dmc5--no-thumbs .dmc5-item {
  --dmc5-img-col: 0px;
}
.dmc5--no-thumbs .dmc5-item__image {
  display: none;
}
.dmc5-item__name {
  display: block;
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}
/*
 * Item meta (DMC5_Cart_Renderer::item_meta()): variation attributes and plugin data, one "Label: Value" span each.
 * Content → Item Meta: Column (default) stacks them; Row (dmc5--meta-row) puts them on one line, with a middle dot
 * (dmc5--meta-dot) or slash (dmc5--meta-slash) between them. The separator is decorative ("" alt text). Show Labels
 * off (dmc5--meta-no-labels) hides the labels visually only, so screen readers still announce "Color: Blue".
 */
.dmc5-item__meta {
  display: flex;
  flex-direction: column;
  font-size: 0.85em;
  line-height: 1.4;
}
.dmc5-item__meta-label {
  opacity: 0.7;
}
.dmc5-item__meta-value p {
  display: inline;
  margin: 0;
}
.dmc5--meta-no-labels .dmc5-item__meta-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.dmc5--meta-row .dmc5-item__meta {
  flex-direction: row;
  flex-wrap: wrap;
}
.dmc5--meta-row .dmc5-item__meta-row + .dmc5-item__meta-row::before {
  margin: 0 0.4em;
  opacity: 0.7;
}
.dmc5--meta-dot .dmc5-item__meta-row + .dmc5-item__meta-row::before {
  content: "\00B7";
  content: "\00B7" / "";
}
.dmc5--meta-slash .dmc5-item__meta-row + .dmc5-item__meta-row::before {
  content: "/";
  content: "/" / "";
}
/* Remove button: its text (Content → Text → Remove Button Text, × by default) comes from --dmc5-remove-text on the
   cart root; decorative for screen readers, which use the link's aria-label. Font: Design → Remove Button. */
.dmc5-item__remove {
  color: inherit;
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.dmc5-item__remove::before {
  content: var(--dmc5-remove-text, "\00D7");
  content: var(--dmc5-remove-text, "\00D7") / "";
}

/* Quantity: control by default, "2 ×" text with dmc5--no-qty */
/*
 * One row, one height (--dmc5-qty-size, Design → Quantity → Control Height): the buttons stretch to it and stay
 * square (aspect-ratio), the input stretches too. Default border 1px solid rgba(0,0,0,.2) (same as default-attrs.json).
 * Quantity Style (class on the cart) decides
 * where Divi's border goes (see DMC5_Module::qty_border_props()): on .dmc5-qty (dividers, outline) or on the input
 * (input); radius always on .dmc5-qty, which clips its background and children to it.
 */
.dmc5-qty {
  --dmc5-qty-size: 26px;
  display: inline-flex;
  font-size: 14px; /* Design → Quantity → Text Size default */
  align-items: stretch;
  box-sizing: border-box;
  height: var(--dmc5-qty-size);
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0;
  overflow: hidden;
  vertical-align: middle;
}
.dmc5-qty__btn {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: auto;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}
/* Two classes: beats the theme's input[type=text] (Divi: white background, 1px #bbb border, 2px padding) */
.dmc5-qty .dmc5-qty__input {
  flex: none;
  box-sizing: border-box;
  width: 2.5em;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: center;
  box-shadow: none;
}
/* Theme focus rule (input[type=text]:focus) recolors the text */
.dmc5-qty .dmc5-qty__input:focus {
  color: inherit;
}
/* Number Box: the default border moves from the control to the number (Divi's border is routed the same way) */
.dmc5--qty-input .dmc5-qty {
  border: 0;
}
.dmc5--qty-input .dmc5-qty__input {
  border: 1px solid rgba(0, 0, 0, 0.2);
}
/* Outline + Dividers: the number's left/right border copies the control's own */
.dmc5--qty-dividers .dmc5-qty .dmc5-qty__input,
.dmc5--qty-dividers .dmc5-qty .dmc5-qty__input:focus {
  border-left: inherit;
  border-right: inherit;
}
.dmc5-item__qty-text {
  display: none;
}
.dmc5--no-qty .dmc5-qty {
  display: none;
}
.dmc5--no-qty .dmc5-item__qty-text {
  display: inline;
}

/* Empty state */
/*
 * Empty cart: message centered horizontally and vertically (it fills the body, which becomes a flex column while the
 * cart is empty), optional icon above it (Content → Text → Empty Cart Icon).
 */
.dmc5-cart.is-empty .dmc5-panel__body {
  display: flex;
  flex-direction: column;
}
.dmc5-empty {
  display: none;
  flex: 1 0 auto;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 0;
  text-align: center;
}
/* Beats Divi's p:not(.has-background):last-of-type { padding-bottom: 0 } */
.dmc5-cart .dmc5-panel p.dmc5-empty {
  padding: 20px 0;
}
.dmc5-empty__icon {
  font-family: ETmodules;
  font-size: 48px;
  line-height: 1;
  speak: none;
}
/* Uploaded cart icon: as tall as the icon size */
.dmc5-empty__icon--image img {
  display: block;
  width: auto;
  height: 1em;
}
.dmc5-cart.is-empty .dmc5-items,
.dmc5-cart.is-empty .dmc5-panel__footer {
  display: none;
}
.dmc5-cart.is-empty .dmc5-empty {
  display: flex;
}

/* Footer */
.dmc5-subtotal {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  font-weight: 600;
}
/* Design → Footer: Button Layout sets flex-direction, Swap Button Order sets order on the checkout button */
.dmc5-buttons {
  display: flex;
  flex-direction: row;
  gap: 10px;
}
.dmc5-button {
  flex: 1 1 0;
  padding: 10px;
  background: #666;
  color: #fff;
  text-align: center;
  text-decoration: none;
}

/* Cart changes */
.dmc5-item.is-leaving {
  opacity: 0;
  pointer-events: none;
}
.dmc5-qty__btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.dmc5-cart.is-loading .dmc5-panel__body {
  cursor: progress;
}

/*
 * Progress bar: a segment sliding along the bottom edge of the header while a request is pending (`is-loading`, set
 * by JS after a short delay). Color from --dmc5-accent, else the header's text color.
 */
.dmc5-panel__header {
  position: relative;
}
.dmc5-panel__header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(var(--dmc5-accent, currentColor), var(--dmc5-accent, currentColor)) no-repeat;
  background-size: 40% 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  /* Always attached, paused when idle: removing it would snap the segment back to the start during the fade-out */
  animation: dmc5-progress 1s ease-in-out infinite paused;
}
.dmc5-cart.is-loading .dmc5-panel__header::after {
  opacity: 1;
  animation-play-state: running;
}
/* With a 40% wide segment, -66.67% / 166.67% put it just outside the left / right edge */
@keyframes dmc5-progress {
  from {
    background-position: -66.67% 0;
  }
  to {
    background-position: 166.67% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .dmc5-panel__header::after {
    background-size: 100% 100%;
    animation: none;
  }
  .dmc5-cart.is-loading .dmc5-panel__header::after {
    opacity: 0.5;
  }
}
/* Notification bar (notices.js): between the header and the items, one message at a time */
.dmc5-notices:empty {
  display: none;
}
/*
 * Design → Notification. Defaults match the field defaults (margin 10px 20px 0, padding 8px 10px). Success and error
 * messages differ only by their default background; a Background set in the fields applies to both.
 */
.dmc5-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 20px 0;
  padding: 8px 10px;
  font-size: 0.9em;
  animation: dmc5-notice-in 0.2s ease-out;
  transition: opacity 0.2s;
}
.dmc5-notice.is-leaving {
  opacity: 0;
}
.dmc5-notice--success {
  background: #edf7ee;
}
.dmc5-notice--error {
  background: #fcf0f1;
}
.dmc5-notice__text {
  flex: 1 1 auto;
}
.dmc5-notice__action {
  flex: none;
  padding: 2px 8px;
  border: 1px solid currentColor;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
@keyframes dmc5-notice-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .dmc5-notice {
    animation: none;
  }
}
