.dispense-cart-button-wrapper {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 10;
}

.dispense-cart-table tr {
  transition: opacity 0.3s ease;
  display: flex;

}

.dispense-cart-sidebar-floating-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #0073aa;
    color: white;
    padding: 12px 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dispense-cart-sidebar {
    position: fixed;
    top: 0;
    right: -460px;
    width: 460px;
    max-width: 100vw;
    height: 100%;
    background: #fff;
    border-left: 2px solid #0073aa;
    box-shadow: -3px 0 5px rgba(0, 0, 0, 0.1);
    padding: 20px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.dispense-cart-sidebar.open {
    right: 0;
    z-index: 9999;
}

/* Dims the page beside the open cart; clicking there closes the cart (1.0.40). */
.dispense-cart-sidebar.open::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: 100%;
    width: 100vw;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.dispense-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.dispense-cart-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.dispense-cart-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Table styling with inline content */
.dispense-cart-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.dispense-cart-table th,
.dispense-cart-table td {
    border: none;
    padding: 8px 5px;
    font-size: 14px;
    vertical-align: middle;
    white-space: nowrap;
    text-align: start;
}

/* Compact product rows */
.dispense-cart-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dispense-cart-table td, .dispense-cart-table th{
    flex: 0 20%;
    max-width: 20%;
}

/* Truncate product names */
.dispense-cart-table td:first-child, .dispense-cart-table th:first-child {
    flex: 0 40%;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 10px;
    max-width: 170px;
    display: block;
}


/* Quantity field */
.dispense-cart-table input[type="number"] {
    width: 50px;
    padding: 4px;
    text-align: center;
    margin: 0 5px;
}

/* Remove button as cross icon */
.dispense-remove-product {
    background: none;
    border: none;
    font-size: 18px;
    color: #dc3545;
    cursor: pointer;
    font-weight: bold;
    line-height: 1;
}

/* The cross is drawn from two bars, so it sits dead centre in the button at
   any size; a letter "x" sat low and off-centre (1.0.46). */
.dispense-remove-product {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 1.5em;
    height: 1.5em;
    padding: 0;
}

.dispense-remove-product::before,
.dispense-remove-product::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.62em;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}

.dispense-remove-product::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Cart footer pinned at bottom */
.dispense-cart-footer {
    padding-top: 15px;
    background: #fff;
    border-top: 1px solid #eee;
    position: fixed;
    bottom: 0;
    z-index: 2;
}

.dispense-cart-total {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: right;
}

.dispense-reset-cart {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    border-radius: 4px;
}

#dispense-reset-cart[disabled]{
    pointer-events: none;
    background-color: #efefef;
    color: gray;
}

.dispense-cart-icon-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
    font-size: 1.5em;
}

.dispense-cart-count {
    position: absolute;
    top: -7px;
    right: -12px;
    background-color: red;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    width: 20px;
    height: 20px;

    display: flex;
    align-items: center;
    justify-content: center;
}

#dispense-checkout-btn, #dispense-reset-cart{
    font-size: 16px;
    text-transform: capitalize;
    background: #efefef;
    padding: 5px 10px;
    color: gray;
    border: none;
    cursor: pointer
}
.dispense-cart-buttons{
    display: flex;
    gap: 10px
}
.dispense-add-to-cart-btn{
    cursor: pointer;
}

/*
 confirmation popup 
*/

.dispense-cart-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.dispense-cart-popup-content {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  max-width: 350px;
  width: 100%;
}
.dispense-cart-popup-content button {
  margin: 5px;
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
#dispense-cart-confirm-yes {
  background: #d63638;
  color: #fff;
}
#dispense-cart-confirm-no {
  background: #2271b1;
  color: #fff;
}


.dispense-add-to-cart-btn{
    display: flex;
    flex-flow: row;
    gap: 10px;
    background: #B93930;
    color: white;
    border: none;
    padding: 5px 10px;
    font-size: 14px;
    border-radius: 8px;
    align-items: flex-end
}


.dispense-cart-empty-message{
   color: green;
}

.dispense-cart-footer{
    width: 100%;
    position: absolute;
    margin-bottom: 20px
}
.dispense-cart-subtotal, .dispense-cart-total, .dispense-cart-tax, .dispense-cart-discount{
    display: flex;
    justify-content: space-between;
    max-width: calc(100% - 40px);
    font-size: 16px
}
.dispense-cart-discount span{
    color: #16a34a;
}
.dispense-cart-discount[hidden], .dispense-cart-tax[hidden]{
    display: none !important;
}
#dispense-reset-cart{
    background-color: red;
    color: white;
    border-radius: 4px
}
#dispense-checkout-btn{
    background-color: green;
    color: white;
    border-radius: 4px
}
/* Item count on the floating cart button; hidden while the cart is empty. */
.dispense-cart-count--floating {
    top: -4px;
    right: -4px;
}
.dispense-cart-count--floating[data-count="0"],
.dispense-cart-count--floating[data-dispense-loading] {
    display: none;
}

.dispense-cart-count.updating {
  transition: transform 0.3s ease;
  transform: scale(1.2);
}

/* ── Add-to-cart toast ── */
#dispense-cart-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #74cf7f8f;
  color: #ffffff;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1.5px solid #5cb85c;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  z-index: 99999;
  font-size: 14px;
  max-width: 360px;
  opacity: 0;
  transform: translateY(-16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
#dispense-cart-toast.dispense-cart-toast--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.dispense-cart-toast-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: #5cb85c;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dispense-cart-toast-icon::after {
  content: '';
  display: block;
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.dispense-cart-toast-label {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
}
.dispense-cart-toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #aaa;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  align-self: flex-start;
}
.dispense-cart-toast-close:hover {
  color: #333;
}

/* Product thumbnail in the cart row */
.dispense-cart-table td.dispense-cart-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dispense-cart-thumb {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: #fff;
}

.dispense-cart-name-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Keep the name beside its thumbnail however wide the cart is. */
.dispense-cart-sidebar .dispense-cart-table td.dispense-cart-name {
    justify-content: flex-start;
    text-align: left;
}

/* Product name and thumbnail link to the product page (1.0.40). */
a.dispense-cart-name-link {
    color: inherit;
    text-decoration: none;
}

a.dispense-cart-name-link:hover,
a.dispense-cart-name-link:focus-visible {
    text-decoration: underline;
}

a.dispense-cart-thumb-link {
    display: inline-flex;
    flex: 0 0 auto;
    line-height: 0;
}

/* Every price sits against the right edge of its column, so a discounted line
   and a regular one line up (1.0.46). The cell is a flex row, where text-align
   alone does not move the price. */
.dispense-cart-table td.dispense-cart-price {
    justify-content: flex-end;
    text-align: right;
}

.dispense-cart-table th:nth-child(3) {
    text-align: right;
}

/* A discounted line: the listed price crossed out, then the price paid (1.0.40). */
.dispense-cart-price--sale {
    white-space: nowrap;
    line-height: 1.2;
}

/* Stack the two prices, right-aligned, whether the theme lays the cell out as
   a table cell or as a flex row. */
.dispense-cart-sidebar .dispense-cart-table td.dispense-cart-price--sale {
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    text-align: right;
}

.dispense-cart-price-was {
    display: block;
    font-size: 0.82em;
    font-weight: 400;
    opacity: 0.6;
    text-decoration: line-through;
}

.dispense-cart-price-now {
    display: block;
    font-weight: 700;
}

/* A row whose removal has been requested: hidden at once, restored by JS if
   the removal fails. */
.dispense-cart-table tr.dispense-cart-row--removing {
    display: none;
}

/* Hide the header while the last remaining row is being removed. */
.dispense-cart-table:not(:has(tr[data-product-id]:not(.dispense-cart-row--removing))) {
    display: none;
}

/* "Adding to cart" line shown in the sidebar while an add is in progress
   (Settings → Cart Sidebar → Open the cart sidebar when a product is added). */
@keyframes dispense-cart-pending-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

.dispense-cart-pending {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-left: 4px solid #0073aa;
    background: #f1f5f9;
    animation: dispense-cart-pending-pulse 1.1s ease-in-out infinite;
}

.dispense-cart-pending-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.dispense-cart-pending-name {
    font-size: 14px;
    font-weight: 600;
}

/* Hide "Your cart is empty." while the first item is being added. */
.dispense-cart-sidebar--adding .dispense-cart-empty-message {
    display: none;
}

/* Purchase limit tracker, shown above the subtotal
   (Settings → Purchase Limits). */
.dispense-cart-limits {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eee;
    max-width: calc(100% - 40px);
}

.dispense-cart-limits[hidden] {
    display: none;
}

.dispense-cart-limit-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
}

.dispense-cart-limit-label {
    font-weight: 600;
}

.dispense-cart-limit-value {
    white-space: nowrap;
}

.dispense-cart-limit-bar {
    height: 8px;
    margin-top: 6px;
    background: #e5e7eb;
    overflow: hidden;
}

.dispense-cart-limit-fill {
    display: block;
    height: 100%;
    background: #16a34a;
    transition: width .25s ease;
}

.dispense-cart-limit-note {
    margin-top: 4px;
    font-size: 12px;
    color: #555;
}

.dispense-cart-limit--near .dispense-cart-limit-fill {
    background: #d97706;
}

.dispense-cart-limit--full .dispense-cart-limit-fill,
.dispense-cart-limit--over .dispense-cart-limit-fill {
    background: #dc2626;
}

.dispense-cart-limit--full .dispense-cart-limit-note,
.dispense-cart-limit--over .dispense-cart-limit-note {
    color: #dc2626;
    font-weight: 600;
}


/* Sold out: the Add to Cart button's disabled state (1.0.36). */
.dispense-add-to-cart-btn--sold-out,
.dispense-add-to-cart-btn--sold-out:hover {
  opacity: .55;
  cursor: not-allowed;
}
