.cart-grid {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  margin-top: 20px;
}

.cart-items {
  flex: 3;
}

.cart-card {
  display: flex;
  align-items: center;
  background: #fff;
  box-shadow: 0 0 10px #eee;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 8px;
}

.item-img img {
  width: 100px;
  border-radius: 6px;
}

.item-details {
  flex: 2;
  padding-left: 20px;
}

.item-qty {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-btn {
  padding: 5px 10px;
  background: purple;
  color: white;
  border: none;
  font-size: 16px;
  border-radius: 4px;
  cursor: pointer;
}

.item-total {
  font-weight: bold;
  margin-left: 20px;
}

.item-remove {
  margin-left: 20px;
}

.delete-btn {
  background: red;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.summary {
  flex: 1;
  background: #ffffff;
  padding: 24px 20px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 80px; /* Adjust based on your navbar height */
  height: fit-content;
  align-self: flex-start;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.summary h3 {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 10px;
}

.summary p {
  font-size: 15px;
  color: #555;
  margin: 10px 0;
  display: flex;
  justify-content: space-between;
}

.summary p strong {
  color: #000;
}

.checkout-btn {
  background:  #6a0dad;
  color: white;
  padding: 12px 18px;
  border: none;
  width: 100%;
  margin-top: 20px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.checkout-btn:hover {
  background:  #520489;
}

/* =========================
   CART — MOBILE LAYOUT ONLY
   ========================= */
@media (max-width: 768px) {
  /* the inline "position:sticky" on .container can cause overlap on phones */
  .container { position: static !important; }

  /* stack summary below items */
  .cart-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 12px;
  }

  /* summary becomes a normal block (not sticky) */
  .summary {
    position: static;
    top: auto;
    width: 100%;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    padding: 18px 16px;
  }

  /* each cart row as a compact grid */
  .cart-card {
    display: grid;
    grid-template-columns: 88px 1fr auto; /* img | details | remove */
    grid-template-rows: auto auto auto;   /* title/details, qty, total */
    grid-template-areas:
      "img details remove"
      "img qty     remove"
      "img total   remove";
    gap: 10px 12px;
    padding: 12px;
    align-items: center;
  }

  .cart-card .item-img    { grid-area: img; }
  .cart-card .item-details{ grid-area: details; padding-left: 0; }
  .cart-card .item-qty    { grid-area: qty; }
  .cart-card .item-total  { grid-area: total; margin-left: 0; }
  .cart-card .item-remove { grid-area: remove; justify-self: end; margin-left: 0; }

  .item-img img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; }

  .item-details h4 { margin: 0 0 4px; font-size: 15px; line-height: 1.2; }
  .item-details p  { margin: 2px 0; font-size: 13px; color: #555; }

  .item-qty { gap: 8px; }
  .qty-btn { padding: 6px 10px; font-size: 16px; border-radius: 6px; }
  .item-qty input {
    width: 48px;
    height: 34px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
  }

  .item-total {
    font-size: 15px;
    font-weight: 700;
  }

  .delete-btn {
    padding: 6px 10px;
    border-radius: 8px;
  }
}

/* very small phones */
@media (max-width: 380px) {
  .cart-card {
    grid-template-columns: 76px 1fr auto;
  }
  .item-img img { width: 72px; height: 72px; }
}
