/* =============================================
   CART PAGE STYLES
   ============================================= */

:root {
  --light-bg: #f5f5f5;
  --border-color: #e2e8f0;
}

body {
    background-color: #fff;
}

.cart-container {
  max-width: 1120px;
  margin: calc(var(--nav-h) + 30px) auto 60px;
  padding: 0 18px;
}

.cart-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.cart-title {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin-bottom: 0;
}

.btn-back {
  padding: 10px 18px;
}

/* --- Table --- */
.cart-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 40px;
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.cart-table thead {
  background-color: #f1f5f9;
}

.cart-table th {
  padding: 16px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  text-transform: capitalize;
}

.cart-table td {
  padding: 18px 18px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
}

.cart-table tr:nth-child(odd) {
    background-color: #f8fafc;
}

.cart-product {
  display: flex;
  align-items: center;
  gap: 20px;
}

.cart-product img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
}

.cart-product-name {
  font-weight: 600;
  color: #1e293b;
}

/* --- Quantity Input --- */
.quantity-control {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  width: fit-content;
  background: white;
}

.quantity-control input {
  width: 35px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  -moz-appearance: textfield;
  appearance: textfield;
}

.quantity-control input::-webkit-outer-spin-button,
.quantity-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.quantity-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  padding: 2px;
}

.quantity-btn:hover {
    color: var(--green);
}

/* --- Buttons Row --- */
.cart-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 48px;
}

.btn-secondary {
  padding: 12px 30px;
  border: 2px solid var(--green);
  background: transparent;
  color: #333;
  font-weight: 600;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-block;
}

.btn-secondary:hover {
  background-color: var(--green);
  color: white;
}

.btn-update {
    border: 2px solid #cbd5e1;
}

/* --- Coupon & Totals --- */
.cart-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}

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

@media (max-width: 850px) {
  .cart-container {
    padding: 0 14px;
  }

  .cart-header-row {
    gap: 14px;
  }

  .cart-title {
    font-size: 1.75rem;
  }

  .btn-back {
    padding: 10px 16px;
  }

  .cart-table th,
  .cart-table td {
    padding: 14px 14px;
  }

  .cart-product {
    gap: 12px;
  }

  .cart-product img {
    width: 50px;
    height: 50px;
  }

  .quantity-control {
    gap: 6px;
    padding: 4px 8px;
  }

  .btn-secondary,
  .btn-apply,
  .btn-checkout {
    width: 100%;
    text-align: center;
  }

  .coupon-section {
    flex-direction: column;
    align-items: stretch;
  }

  .coupon-input {
    width: 100%;
  }

  .cart-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 680px) {
  .cart-footer-grid {
    gap: 28px;
  }

  .totals-box {
    padding: 22px;
  }

  .cart-table-wrapper {
    overflow: hidden;
  }

  .cart-table thead {
    display: none;
  }

  .cart-table,
  .cart-table tbody,
  .cart-table tr,
  .cart-table td {
    display: block;
    width: 100%;
  }

  .cart-table tr {
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
  }

  .cart-table td {
    padding: 14px 16px;
    border-bottom: none;
  }

  .cart-table td + td {
    border-top: 1px solid #f1f5f9;
  }

  .cart-table td::before {
    display: block;
    margin-bottom: 8px;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .cart-table td:nth-of-type(1)::before { content: 'Product'; }
  .cart-table td:nth-of-type(2)::before { content: 'Price'; }
  .cart-table td:nth-of-type(3)::before { content: 'Quantity'; }
  .cart-table td:nth-of-type(4)::before { content: 'Subtotal'; }
}

.coupon-section {
  display: flex;
  gap: 12px;
}

.coupon-input {
  flex: 1;
  padding: 12px 20px;
  border: 2px solid var(--green);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

.btn-apply {
  padding: 12px 30px;
  background-color: #1a6b2a;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}

/* --- Totals Box --- */
.totals-box {
  border: 2px solid rgba(46, 158, 71, 0.4);
  padding: 30px;
  border-radius: 4px;
}

.totals-box h3 {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 25px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 2px solid #e2e8f0;
  font-size: 14px;
  color: #1e293b;
}

.total-row:last-of-type {
  border-bottom: none;
  margin-bottom: 30px;
}

.total-row.grand-total {
    font-weight: 700;
}

.btn-checkout {
  width: 100%;
  padding: 16px;
  background-color: #1a6b2a;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-checkout:hover {
    background-color: #145321;
}

/* --- Empty Cart State --- */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart h2 {
    color: #64748b;
    margin-bottom: 20px;
}
