/* ===========================
        Reset
=========================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--z-color-background);
  color: var(--z-color-text);
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  border: none;
  cursor: pointer;
  font-family: inherit;
}

img {
  width: 100%;
  display: block;
}

/* ===========================
        Container
=========================== */

.container {
  width: min(
    var(--z-container-wide),
    calc(100% - (2 * var(--z-container-padding)))
  );
  margin: auto;
}

/* ===========================
        Cart Page
=========================== */

.cart-page {
  padding: 40px 0 60px;
  min-height: 100vh;
}

/* ===========================
        Breadcrumb
=========================== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
  font-size: 15px;
  color: var(--z-color-text-muted);
}

.breadcrumb a {
  color: var(--z-color-accent-strong);
  font-weight: 500;
}

.breadcrumb span:last-child {
  color: var(--z-color-text);
}

/* ===========================
        Layout
=========================== */

.cart-layout {
  display: grid;
  grid-template-columns: 2fr 380px;
  gap: 30px;
  align-items: start;
}
.cart-layout[hidden] {
  display: none;
}

.cart-loading {
  display: grid;
  padding: var(--z-card-padding);
  gap: var(--z-space-5);
}
.cart-loading[hidden] {
  display: none;
}
.cart-loading-row {
  display: flex;
  align-items: center;
  gap: var(--z-space-5);
}
.cart-loading-copy {
  display: grid;
  width: min(100%, 360px);
  gap: var(--z-space-3);
}
.cart-loading-copy .short {
  width: 55%;
}

/* ===========================
        Cart Items
=========================== */

.cart-items {
  background: var(--z-color-surface);
  border-radius: var(--z-radius-card);
  padding: var(--z-card-padding);
  box-shadow: var(--z-shadow-card);
}

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

.cart-header h2 {
  font-size: 28px;
  color: var(--z-color-brand);
}

#cartItemCount {
  font-size: 15px;
  color: var(--z-color-text-muted);
  font-weight: 500;
}

/* ===========================
        Empty Cart
=========================== */

.empty-cart {
  background: var(--z-color-surface);
  border-radius: var(--z-radius-card);
  padding: 60px 30px;
  text-align: center;
  box-shadow: var(--z-shadow-card);
}

.empty-cart i {
  font-size: 70px;
  color: var(--z-color-accent);
  margin-bottom: 25px;
}

.empty-cart h2 {
  font-size: 30px;
  margin-bottom: 15px;
  color: var(--z-color-brand);
}

.empty-cart p {
  color: var(--z-color-text-muted);
  margin-bottom: 35px;
}

#continueShopping {
  background: var(--z-color-brand);
  color: #fff;
  padding: 14px 28px;
  border-radius: var(--z-radius-control);
  font-size: 15px;
  transition: var(--z-motion-fast) var(--z-ease-standard);
}

#continueShopping:hover {
  background: var(--z-color-brand-strong);
}

/* ===========================
        Cart Product
=========================== */

.cart-product {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--z-color-border);
}

.cart-product:last-child {
  border-bottom: none;
}

/* ===========================
        Product Left
=========================== */

.product-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

.product-left img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--z-radius-card);
  border: 1px solid var(--z-color-border);
  background: var(--z-color-surface-soft);
}

.product-left div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-left h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--z-color-brand);
}

.product-left p {
  font-size: 17px;
  font-weight: 600;
  color: var(--z-color-accent-strong);
}

.product-left small {
  color: var(--z-color-text-muted);
  font-size: 14px;
}

/* ===========================
        Product Right
=========================== */

.product-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* ===========================
        Quantity Box
=========================== */

.qty-box {
  display: flex;
  align-items: center;
  border: 1px solid var(--z-color-border);
  border-radius: var(--z-radius-control);
  overflow: hidden;
}

.qty-box button {
  width: 42px;
  height: 42px;
  background: var(--z-color-surface);
  color: var(--z-color-text);
  font-size: 18px;
  font-weight: 600;
  transition: var(--z-motion-fast) var(--z-ease-standard);
}

.qty-box button:hover {
  background: var(--z-color-blush);
  color: var(--z-color-brand);
}

.qty-box span {
  width: 45px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}

/* ===========================
        Remove Button
=========================== */

.remove-btn {
  width: 46px;
  height: 46px;
  border-radius: var(--z-radius-control);
  background: var(--z-color-error);
  color: #fff;
  font-size: 18px;
  transition: var(--z-motion-fast) var(--z-ease-standard);
}

.remove-btn:hover {
  background: #852432;
  color: #fff;
}

/* ===========================
        Product Price
=========================== */

.product-price {
  min-width: 100px;
  text-align: right;
}

.product-price h4 {
  font-size: 22px;
  color: var(--z-color-brand);
  margin-bottom: 5px;
}

.product-price del {
  color: var(--z-color-text-muted);
  font-size: 15px;
}

/* ===========================
        Order Summary
=========================== */

.cart-summary {
  background: var(--z-color-surface);
  border-radius: var(--z-radius-card);
  padding: var(--z-card-padding);
  box-shadow: var(--z-shadow-card);
  position: sticky;
  top: calc(73px + var(--z-space-5));
}

.cart-summary h2 {
  font-size: 26px;
  margin-bottom: 25px;
  color: #222;
}

.summary-row,
.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-row {
  padding: 14px 0;
  color: #666;
  font-size: 16px;
}

.summary-total {
  margin-top: 20px;
  font-size: 22px;
  font-weight: 700;
  color: #222;
}

.cart-summary hr {
  border: none;
  border-top: 1px solid #ececec;
  margin-top: 15px;
}

/* ===========================
        Checkout Button
=========================== */

#checkoutBtn {
  width: 100%;
  min-height: var(--z-control-height);
  margin-top: 30px;
  background: var(--z-color-brand);
  color: #fff;
  border-radius: var(--z-radius-control);
  font-size: 16px;
  font-weight: 600;
  transition: var(--z-motion-base) var(--z-ease-standard);
}

#checkoutBtn:hover {
  background: var(--z-color-brand-strong);
}

/* ===========================
        Responsive
=========================== */

@media (max-width: 992px) {
  .cart-layout {
    grid-template-columns: 1fr;
  }

  .cart-summary {
    position: static;
  }
}

@media (max-width: 768px) {
  .cart-page {
    padding: 25px 0 50px;
  }

  .cart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .cart-product {
    flex-direction: column;
    align-items: flex-start;
  }

  .product-left {
    width: 100%;
  }

  .product-left img {
    width: 100px;
    height: 100px;
  }

  .product-right {
    width: 100%;
    justify-content: space-between;
  }

  .product-price {
    text-align: left;
  }
}

@media (max-width: 576px) {
  .breadcrumb {
    font-size: 13px;
    flex-wrap: wrap;
  }

  .cart-items,
  .cart-summary,
  .empty-cart {
    padding: 20px;
  }

  .product-left {
    min-width: 0;
    align-items: flex-start;
    gap: 12px;
  }
  .product-left > div {
    min-width: 0;
  }

  .product-left img {
    width: 88px;
    height: 88px;
    flex: 0 0 88px;
  }

  .product-left h3 {
    overflow-wrap: anywhere;
    font-size: 16px;
  }

  .product-left p {
    font-size: 16px;
  }

  .product-right {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px;
    gap: 10px;
  }
  .qty-box {
    width: 100%;
    justify-content: space-between;
  }

  .qty-box button {
    flex: 1;
  }

  .qty-box span {
    width: 60px;
  }

  .remove-btn {
    width: 46px;
    height: 46px;
  }

  #checkoutBtn {
    height: 50px;
    font-size: 15px;
  }
}

.cart-coupon {
  margin: 18px 0;
  padding: 14px;
  border: 1px dashed var(--z-color-accent);
  border-radius: 12px;
  background: #fff8fb;
}
.cart-coupon__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cart-coupon__form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.cart-coupon__view {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--z-color-accent);
  border-radius: var(--z-radius-control);
  background: var(--z-color-surface);
  color: var(--z-color-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.cart-coupon__view:hover {
  background: #fff0f6;
}
.cart-coupon input {
  min-width: 0;
  flex: 1;
}
.cart-coupon p {
  margin-top: 7px;
  min-height: 1.2em;
  font-size: 13px;
  color: #20663f;
}
.cart-coupon p.error {
  color: #b42318;
}
.coupon-suggestion {
  display: block;
  margin-top: 8px;
  padding: 9px;
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
}
.coupon-suggestion button {
  margin-left: 6px;
  border: 0;
  background: none;
  color: var(--z-color-accent);
  font-weight: 700;
  cursor: pointer;
}
.cart-coupon-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  visibility: hidden;
  background: transparent;
  transition:
    background 0.2s ease,
    visibility 0.2s;
}
.cart-coupon-drawer.open {
  visibility: visible;
  background: var(--z-color-overlay);
}
.cart-coupon-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(440px, 100%);
  height: 100%;
  padding: 24px;
  overflow: auto;
  background: var(--z-color-surface);
  box-shadow: -16px 0 45px rgba(35, 17, 23, 0.16);
  transform: translateX(100%);
  transition: transform 0.25s var(--z-ease-standard);
}
.cart-coupon-drawer.open .cart-coupon-drawer__panel {
  transform: translateX(0);
}
.cart-coupon-drawer header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--z-color-border);
}
.cart-coupon-drawer h2 {
  margin: 3px 0 0;
  font-family: var(--z-font-heading);
  color: var(--z-color-brand);
}
.available-coupon-list {
  display: grid;
  gap: 12px;
  padding: 18px 0;
}
.available-coupon {
  padding: 16px;
  border: 1px solid var(--z-color-border);
  border-radius: var(--z-radius-control);
}
.available-coupon__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.available-coupon code {
  font-weight: 700;
  color: var(--z-color-brand);
  letter-spacing: 0.06em;
}
.available-coupon p {
  margin: 8px 0;
  color: var(--z-color-text-subtle);
  font-size: 14px;
}
.available-coupon__saving {
  color: #20663f !important;
  font-weight: 700;
}
.available-coupon button {
  align-self: start;
  white-space: nowrap;
}
.available-coupon--unavailable {
  opacity: 0.65;
}
.available-coupon--unavailable .available-coupon__saving {
  color: #9a6312 !important;
}
@media (max-width: 576px) {
  .cart-coupon__heading {
    align-items: flex-start;
  }
  .cart-coupon__view {
    min-height: 34px;
    padding: 6px 9px;
    font-size: 13px;
  }
}
