/* Cart (1.7.0): Shopee-style compact rows with tick boxes; the summary is a sticky card on desktop and a
   bottom bar on phones (Voucher row, nudge, "Semua", total, "Checkout (N)"). */
.duera-bag {
  --bag-ink: var(--dark, #311b14);
  --bag-muted: #311b14a6;
  --bag-line: #311b1424;
  --bag-brand: var(--duera-burgundy, #4f0a09);
  --bag-soft: #f7f3ef;
  color: var(--bag-ink);
}

/* Reset at class specificity (1.9.1): beats global element rules, later class rules keep their margins. */
.duera-bag :where(h1, h2, p, dl, dd) {
  margin: 0;
}

.duera-bag-section.commerce-cart-section {
  padding-bottom: 96px;
}

/* Title → notices → list, with the same clear rhythm on every width (1.9.1). */
.duera-bag-section > h1 {
  margin-bottom: 28px;
}

.duera-bag-section > .woocommerce-notices-wrapper:not(:empty) {
  margin-bottom: 20px;
}

.duera-bag-count {
  color: var(--bag-muted);
  font-weight: 400;
}

.duera-bag-feedback {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #8a1c13;
  background: #fbeceb;
  font-size: 14px;
  line-height: 1.5;
}

.duera-bag-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  gap: 28px;
  align-items: start;
}

.duera-bag-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

/* Tick box */
.duera-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.duera-check input {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.duera-check-box {
  display: grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid #b9aca4;
  border-radius: 6px;
  color: #fff;
  background: #fff;
}

.duera-check-box svg {
  width: 15px;
  height: 15px;
  opacity: 0;
}

.duera-check input:checked + .duera-check-box {
  border-color: var(--bag-brand);
  background: var(--bag-brand);
}

.duera-check input:checked + .duera-check-box svg {
  opacity: 1;
}

.duera-check input:focus-visible + .duera-check-box {
  outline: 2px solid var(--bag-brand);
  outline-offset: 2px;
}

.duera-check input:disabled + .duera-check-box {
  border-color: #ddd4ce;
  background: #f4efeb;
}

.duera-check input:disabled {
  cursor: default;
}

.duera-bag-head {
  padding: 12px 16px;
  border: 1px solid var(--bag-line);
  border-radius: 14px;
  background: #fff;
}

.duera-bag-items {
  display: grid;
  gap: 10px;
}

/* Rows */
.duera-bag-line {
  display: grid;
  grid-template-columns: 22px 96px minmax(0, 1fr) 36px;
  gap: 14px;
  align-items: start;
  padding: 14px 12px 14px 16px;
  border: 1px solid var(--bag-line);
  border-radius: 14px;
  background: #fff;
  transition: opacity 0.2s ease;
}

.duera-bag-tick {
  align-self: center;
}

.duera-bag-thumb {
  display: block;
  width: 96px;
  height: 120px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--bag-soft);
}

.duera-bag-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duera-bag-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 100%;
}

.duera-bag-name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.duera-bag-name a {
  color: inherit;
  text-decoration: none;
}

.duera-bag-name a:hover {
  text-decoration: underline;
}

.duera-bag-variant {
  width: fit-content;
  max-width: 100%;
  padding: 3px 8px;
  overflow: hidden;
  border-radius: 6px;
  color: var(--bag-muted);
  background: var(--bag-soft);
  font-size: 12.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duera-bag-warn {
  color: #8a1c13;
  font-size: 12.5px;
  font-weight: 600;
}

.duera-bag-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: auto;
}

.duera-bag-price {
  color: var(--bag-brand);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.duera-bag .duera-bag-qty {
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
}

.duera-bag .duera-bag-qty button {
  width: 28px;
  height: 26px;
}

.duera-bag .duera-bag-qty input {
  width: 34px;
  height: 26px;
  border: 0;
  padding: 0;
  background: #fff;
  font-size: 14px;
}

.duera-bag-remove {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--bag-muted);
  background: transparent;
  cursor: pointer;
}

.duera-bag-remove:hover {
  color: var(--bag-brand);
  background: var(--bag-soft);
}

.duera-bag-remove svg {
  width: 19px;
  height: 19px;
}

.duera-bag-line.is-unavailable :is(.duera-bag-thumb, .duera-bag-name, .duera-bag-price) {
  opacity: 0.55;
}

.duera-bag.is-busy :is(.duera-bag-items, .duera-bag-head, .duera-bag-foot) {
  opacity: 0.6;
  pointer-events: none;
}

.duera-bag-empty {
  padding: 32px 16px;
  border: 1px dashed var(--bag-line);
  border-radius: 14px;
  text-align: center;
}

/* Summary card (desktop/tablet) */
.duera-bag-summary {
  min-width: 0;
}

.duera-bag-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--bag-line);
  border-radius: 16px;
  background: #fff;
}

.duera-bag-card-title {
  font-size: 18px;
  font-weight: 600;
}

.duera-bag-rows {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.duera-bag-rows > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.duera-bag-rows dt {
  color: var(--bag-muted);
}

.duera-bag-rows dd {
  font-weight: 600;
  text-align: right;
}

.duera-bag-rows .is-discount dd {
  color: #1b6b3a;
}

.duera-bag-rows .is-total {
  padding-top: 10px;
  border-top: 1px solid var(--bag-line);
  font-size: 16px;
}

.duera-bag-rows .is-total dt {
  color: inherit;
  font-weight: 600;
}

.duera-bag-muted {
  color: var(--bag-muted);
  font-weight: 400;
}

.duera-bag-foot {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--bag-line);
}

.duera-bag-all {
  display: none;
}

.duera-bag-total {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 2px 12px;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: none;
  font: inherit;
  text-align: left;
  cursor: default;
}

.duera-bag-total-label {
  font-size: 16px;
  font-weight: 600;
}

.duera-bag-total strong {
  color: var(--bag-brand);
  font-size: 20px;
  font-weight: 700;
  text-align: right;
}

.duera-bag-total small {
  grid-column: 2;
  color: #1b6b3a;
  font-size: 12.5px;
  font-weight: 600;
  text-align: right;
}

.duera-bag-total-chevron {
  display: none;
}

.duera-bag-checkout {
  display: grid;
  place-items: center;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 12px;
  color: #fff;
  background: var(--bag-brand);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.duera-bag-checkout:hover {
  color: #fff;
  background: #3a0706;
}

.duera-bag-checkout[aria-disabled="true"] {
  background: #d6ccc5;
  pointer-events: none;
}

.duera-bag-details {
  width: min(440px, calc(100vw - 32px));
  max-width: none;
  padding: 0 0 16px;
  border: 0;
  border-radius: 16px;
  color: var(--bag-ink);
  background: #fff;
}

.duera-bag-details::backdrop {
  background: #1d0e0a80;
}

.duera-bag-details .duera-bag-rows {
  padding: 16px 20px 0;
}

.duera-bag-note {
  padding: 12px 20px 0;
  color: var(--bag-muted);
  font-size: 12.5px;
}

@media (max-width: 991px) {
  .duera-bag-layout {
    grid-template-columns: 1fr;
  }

  .duera-bag .commerce-summary {
    position: static;
  }
}

/* Phones: Shopee-style bottom bar */
@media (max-width: 767px) {
  .duera-bag-section.commerce-cart-section {
    padding-bottom: 40px;
  }

  /* Room for the fixed bar after the footer too, so nothing ends up hidden behind it. */
  body:has([data-bag-card]) {
    padding-bottom: var(--duera-bag-bar, 150px);
  }

  .duera-bag-head {
    display: none;
  }

  .duera-bag-section > h1 {
    margin-bottom: 20px;
  }

  .duera-bag-section > .woocommerce-notices-wrapper:not(:empty) {
    margin-bottom: 16px;
  }

  .duera-bag-line {
    grid-template-columns: 22px 80px minmax(0, 1fr) 28px;
    gap: 10px;
    padding: 12px 8px 12px 12px;
  }

  .duera-bag-thumb {
    width: 80px;
    height: 100px;
  }

  .duera-bag-remove {
    width: 28px;
    height: 28px;
  }

  .duera-bag-card {
    position: fixed;
    inset: auto 0 0;
    z-index: 60;
    gap: 8px;
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 24px #311b141f;
  }

  .duera-bag-card :is(.duera-bag-card-title, .duera-bag-rows) {
    display: none;
  }

  .duera-bag-card .duera-vc {
    gap: 6px;
  }

  .duera-bag-card .duera-vc-row {
    min-height: 44px;
    padding: 6px 2px;
    border: 0;
    border-bottom: 1px solid var(--bag-line);
    border-radius: 0;
  }

  .duera-bag-card .duera-vc-nudge {
    padding: 7px 10px;
  }

  .duera-bag-foot {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding-top: 2px;
    border-top: 0;
  }

  .duera-bag-all {
    display: inline-flex;
    font-weight: 500;
  }

  .duera-bag-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    position: relative;
    padding-right: 18px;
    cursor: pointer;
  }

  .duera-bag-total-label {
    display: none;
  }

  .duera-bag-total strong {
    font-size: 17px;
    line-height: 1.25;
  }

  .duera-bag-total small {
    font-size: 11.5px;
  }

  .duera-bag-total-chevron {
    position: absolute;
    top: 3px;
    right: 0;
    display: block;
    width: 16px;
    height: 16px;
    transform: rotate(180deg);
    color: var(--bag-muted);
  }

  .duera-bag-checkout {
    min-height: 44px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 15px;
  }

  .duera-bag-details {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    margin: 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
  }
}
