/* =========================================================================
   The CraftingTable — Cart styles
   ========================================================================= */

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

.cart-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 40px;
  align-items: start;
  margin-top: 20px;
}

/* ------------------------------- Items --------------------------------- */
.cart-items {
  display: grid;
  gap: 14px;
}

.cart-item {
  display: grid;
  grid-template-columns: 96px 1fr auto auto;
  gap: 18px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow: hidden;
}

.cart-item__media {
  width: 96px;
  height: 96px;
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 40%, var(--cream), var(--sand));
  display: grid;
  place-items: center;
  padding: 10px;
}

.cart-item__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cart-item__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cart-item__name {
  font-size: 17px;
  font-weight: 800;
}

.cart-item__name:hover {
  color: var(--primary);
}

.cart-item__cat {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

.cart-item__remove {
  align-self: flex-start;
  margin-top: 4px;
  background: none;
  border: none;
  color: #c0392b;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.cart-item__remove:hover {
  text-decoration: underline;
}

.cart-item__price {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}

/* Compact qty for the cart */
.cart-item .qty {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.cart-item .qty__btn {
  width: 38px;
  min-height: 42px;
  border: none;
  background: none;
  font-size: 19px;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.cart-item .qty__btn:hover {
  background: var(--cream);
  color: var(--primary);
}

.cart-item .qty__val {
  width: 36px;
  text-align: center;
  font-weight: 700;
}

/* ------------------------------ Summary -------------------------------- */
.cart-summary {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.cart-summary h3 {
  font-size: 20px;
  margin-bottom: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.summary-row--total {
  border-bottom: none;
  color: var(--foreground);
  font-size: 20px;
  font-weight: 800;
  padding-top: 16px;
  margin-bottom: 20px;
}

.summary-row--total span:last-child {
  color: var(--primary);
}

.cart-summary__cont {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-weight: 600;
  color: var(--muted);
}

.cart-summary__cont:hover {
  color: var(--primary);
}

.cart-summary__trust {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

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

@media (max-width: 540px) {
  .cart-item {
    grid-template-columns: 72px 1fr;
    grid-template-areas:
      'media info'
      'qty price';
    row-gap: 14px;
  }
  .cart-item__media {
    width: 72px;
    height: 72px;
    grid-area: media;
  }
  .cart-item__info {
    grid-area: info;
  }
  .cart-item__qty {
    grid-area: qty;
  }
  .cart-item__price {
    grid-area: price;
    text-align: right;
    align-self: center;
  }
}
