.cart-page {
  padding: 3rem 0 5rem;
}

.cart-page-header {
  margin-bottom: 2rem;
}

.cart-page-header h1 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
}

.cart-page-header p {
  margin: 0;
  color: var(--color-text-muted, #777);
}

.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 2rem;
  align-items: start;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cart-item {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 1.25rem;
  align-items: center;
  padding: 1.25rem;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e5e5);
  border-radius: 16px;
}

.cart-item-image-link {
  display: block;
  width: 110px;
  height: 110px;
  overflow: hidden;
  border-radius: 12px;
  background: #f5f5f5;
}

.cart-item-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.cart-item-info {
  min-width: 0;
}

.cart-item-name {
  display: block;
  margin-bottom: 0.65rem;
  color: var(--color-text, #222);
  font-weight: 700;
  line-height: 1.8;
  text-decoration: none;
}

.cart-item-name:hover {
  color: var(--color-primary, #05668d);
}

.cart-item-price {
  font-weight: 700;
  font-size: 1rem;
}

.cart-item-price small,
.cart-item-subtotal small {
  font-size: 0.75rem;
  font-weight: 400;
}

.cart-item-stock {
  margin-top: 0.45rem;
  color: var(--color-text-muted, #777);
  font-size: 0.8rem;
}

.cart-item-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.8rem;
}

.cart-quantity-selector {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 10px;
  overflow: hidden;
}

.cart-qty-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--color-text, #222);
  font-size: 1.15rem;
  cursor: pointer;
}

.cart-qty-btn:hover:not(:disabled) {
  background: #f5f5f5;
}

.cart-qty-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.cart-quantity {
  min-width: 38px;
  text-align: center;
  font-weight: 700;
}

.cart-item-subtotal {
  font-size: 1rem;
  white-space: nowrap;
}

.cart-remove-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: #b44;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.cart-remove-btn:hover {
  text-decoration: underline;
}

.cart-summary {
  position: sticky;
  top: 1.5rem;
  padding: 1.5rem;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e5e5);
  border-radius: 16px;
}

.cart-summary h2 {
  margin: 0 0 1.5rem;
  font-size: 1.15rem;
}

.cart-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--color-border, #eee);
}

.cart-summary-total {
  padding-top: 1.1rem;
  border-bottom: 0;
}

.cart-summary-total strong {
  font-size: 1.15rem;
}

.cart-summary-total small {
  font-size: 0.75rem;
  font-weight: 400;
}

.cart-checkout-btn {
  width: 100%;
  margin-top: 1rem;
}

.cart-empty,
.cart-error {
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e5e5);
  border-radius: 16px;
}

.cart-empty-icon {
  margin-bottom: 1rem;
  font-size: 3rem;
}

.cart-empty h2,
.cart-error h2 {
  margin: 0 0 0.7rem;
}

.cart-empty p,
.cart-error p {
  margin: 0 0 1.5rem;
  color: var(--color-text-muted, #777);
}

.cart-loading {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--color-text-muted, #777);
}

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

  .cart-summary {
    position: static;
  }
}

@media (max-width: 640px) {
  .cart-page {
    padding: 2rem 0 3rem;
  }

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

  .cart-item-image-link {
    width: 80px;
    height: 80px;
  }

  .cart-item-controls {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border, #eee);
  }

  .cart-item-subtotal {
    margin-right: auto;
  }
}
