.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 45%);
  z-index: 1998;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cart-overlay.is-visible {
  opacity: 1;
}

.cart-drawer {
  position: fixed;
  z-index: 1999;
  top: 0;
  right: 0;
  width: 75vw;
  max-width: 620px;
  min-width: 320px;
  height: 100dvh;
  background: #fff;
  box-shadow: -8px 0 30px rgb(0 0 0 / 15%);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  transition:
    transform 0.3s ease,
    visibility 0.3s;
}

.cart-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.cart-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid #eee;
}

.cart-drawer-header h2 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.cart-drawer-header p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

.cart-close {
  border: 0;
  background: transparent;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.drawer-cart-lines {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.drawer-cart-item {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px solid #eee;
}

.drawer-cart-item img {
  width: 90px;
  height: 110px;
  object-fit: cover;
  border-radius: 6px;
  background: #f5f5f5;
}

.drawer-cart-item h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.drawer-cart-item p {
  margin: 5px 0;
  color: #555;
  font-size: 0.9rem;
}

.drawer-cart-item-price {
  font-weight: 700;
  color: #222;
}

.drawer-cart-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.drawer-cart-controls button {
  width: 32px;
  height: 32px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1.1rem;
}

.drawer-cart-controls .remove-item {
  width: auto;
  border: 0;
  color: #a33;
  font-size: 0.85rem;
}

.drawer-cart-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  background: #fff;
}

.drawer-cart-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 1.1rem;
}

.drawer-cart-total strong {
  font-size: 1.25rem;
}

.cart-minimum-message {
  color: #666;
  font-size: 0.88rem;
}

.cart-error {
  color: #b42318;
  font-size: 0.9rem;
}

.cart-primary,
.cart-secondary {
  display: block;
  width: 100%;
  padding: 13px;
  margin-top: 10px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.cart-primary {
  color: #fff;
  background: #222;
  border: 1px solid #222;
}

.cart-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cart-secondary {
  color: #222;
  background: #fff;
  border: 1px solid #ddd;
}

.drawer-full-cart-link {
  display: block;
  margin-top: 14px;
  text-align: center;
  color: #555;
  font-size: 0.9rem;
}

body.cart-drawer-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  .cart-drawer {
    width: 92vw;
    min-width: 0;
  }

  .cart-drawer-header,
  .drawer-cart-footer {
    padding: 16px;
  }

  .drawer-cart-lines {
    padding: 12px;
  }

  .drawer-cart-item {
    grid-template-columns: 75px minmax(0, 1fr);
    gap: 10px;
  }

  .drawer-cart-item img {
    width: 75px;
    height: 95px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cart-drawer,
  .cart-overlay {
    transition: none;
  }
}