/* =============================================================
   Cart page — responsive layout
   ============================================================= */

/* Two-column layout: items | summary */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-8, 2rem);
  align-items: start;
  margin-top: var(--space-6, 1.5rem);
}

/* Items panel */
.cart-items-panel {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Table ─────────────────────────────────────────────────── */
.cart-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 340px;
}
.cart-table th {
  text-align: left;
  padding: 8px 10px 12px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #aaa;
  border-bottom: 1px solid #f0f0f4;
  white-space: nowrap;
}
.cart-table td {
  padding: 14px 10px;
  border-bottom: 1px solid #f0f0f4;
  vertical-align: middle;
}
.cart-table tr:last-child td { border-bottom: none; }

/* Product cell */
.cart-item__product {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cart-item__img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.cart-item__name {
  font-size: .9rem;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.3;
  margin-bottom: 2px;
}
.cart-item__variant {
  font-size: .8rem;
  color: #aaa;
}

/* Price / total cells */
.cart-item__price-cell,
.cart-item__total-cell {
  font-size: .9rem;
  font-weight: 700;
  color: #1a1a2e;
  white-space: nowrap;
}
.cart-item__qty-cell { white-space: nowrap; }

/* Qty input */
.cart-qty {
  width: 58px;
  padding: 6px 8px;
  border: 1.5px solid #d0d0d8;
  border-radius: 8px;
  text-align: center;
  font-size: .9rem;
  font-weight: 600;
  color: #1a1a2e;
}
.cart-qty:focus { outline: none; border-color: #6b0f2b; }

/* Remove button */
.cart-remove {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.cart-remove:hover { color: #e94560; background: #fff0f2; }

/* ── Order Summary ─────────────────────────────────────────── */
.cart-summary {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  position: sticky;
  top: calc(var(--header-height, 72px) + 16px);
}
.cart-summary__title {
  font-size: 1.0625rem;
  font-weight: 800;
  color: #1a1a2e;
  margin: 0 0 20px;
}
.cart-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: .9rem;
  color: #555;
  border-bottom: 1px solid #f4f5f7;
}
.cart-summary__total {
  font-size: 1.1rem;
  font-weight: 800;
  color: #1a1a2e;
  border-bottom: none;
  padding-top: 14px;
  margin-top: 4px;
}
.cart-summary__shipping-note { color: #999; font-size: .85rem; }

.cart-summary__btn {
  display: flex;
  width: 100%;
  justify-content: center;
  margin-top: var(--space-4, 1rem);
  min-height: unset; /* override responsive.css 44px min */
}

/* Empty state */
.cart-empty {
  text-align: center;
  padding: 80px 20px;
  color: #999;
}

/* ── Tablet (769px–1024px) — narrower summary column ──────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .cart-layout {
    grid-template-columns: 1fr 260px;
    gap: var(--space-5, 1.25rem);
  }
}

/* ── Mobile (≤ 768px): stack vertically ───────────────────── */
@media (max-width: 768px) {
  .cart-layout {
    grid-template-columns: 1fr !important;
    gap: var(--space-4, 1rem);
  }

  /* Summary goes above the items table on mobile */
  .cart-summary {
    position: static !important;
    top: auto;
    order: -1;
  }

  .cart-items-panel {
    padding: 12px;
  }

  .cart-item__img {
    width: 44px;
    height: 44px;
  }
  .cart-item__name { font-size: .85rem; }
  .cart-qty { width: 50px; }

  /* Hide the Price column on mobile — total is enough */
  .cart-table th:nth-child(2),
  .cart-table td:nth-child(2) { display: none; }
}

/* ── Cart page wrapper ─────────────────────────────────────── */
.shop-cart-page {
  padding-top: var(--space-8, 2rem);
  padding-bottom: var(--space-8, 2rem);
}

.shop-cart-page .section-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  margin-bottom: var(--space-6, 1.5rem);
}

@media (max-width: 768px) {
  .shop-cart-page {
    padding-top: var(--space-4, 1rem);
    padding-bottom: calc(var(--space-4, 1rem) + 68px); /* clear bottom nav */
  }

  .shop-cart-page .section-title {
    font-size: 1.5rem;
    margin-bottom: var(--space-4, 1rem);
  }
}
