/**
 * Cart Page - Conversion-focused, simple, modern
 * GeneratePress Child Theme
 */

/* ==========================================================================
   Variables & Base
   ========================================================================== */

.gp-cart-page {
  --gp-cart-gap: 32px;
  --gp-cart-radius: 12px;
  --gp-cart-border: 1px solid #e8e8e8;
  --gp-cart-bg: #fafafa;
  --gp-cart-accent: #111;
  --gp-cart-accent-text: #fff;
  --gp-cart-text: #333;
  --gp-cart-text-muted: #666;
}

/* ==========================================================================
   Layout - Two columns (items | summary)
   ========================================================================== */

.gp-cart-page .gp-cart-layout {
  display: grid;
  gap: var(--gp-cart-gap);
  margin-top: 24px;
}

@media (min-width: 992px) {
  .gp-cart-page .gp-cart-layout {
    grid-template-columns: 1fr 420px;
    align-items: start;
  }

  .gp-cart-page .gp-cart-summary-col {
    position: sticky;
    top: 24px;
    min-width: 0;
  }
}

/* ==========================================================================
   Cart Items - Card-style table
   ========================================================================== */

.gp-cart-page .woocommerce-cart-form {
  background: #fff;
  border: var(--gp-cart-border);
  border-radius: var(--gp-cart-radius);
  overflow: visible;
}

.gp-cart-page .shop_table.cart {
  margin: 0;
  border: none;
}

.gp-cart-page .shop_table.cart thead {
  display: none;
}

.gp-cart-page .shop_table.cart tbody tr {
  display: grid;
  grid-template-columns: 80px 1fr auto auto auto;
  grid-template-areas: "thumb name qty price remove";
  gap: 16px;
  padding: 20px 24px;
  align-items: center;
}

.gp-cart-page .shop_table.cart tbody td {
  border-bottom: none !important;
}

/* Row dengan actions - sembunyikan coupon & update (tampil di summary) */
.gp-cart-page .shop_table.cart tbody tr.cart-actions-row {
  border-top: var(--gp-cart-border);
  display: none;
}

.gp-cart-page .shop_table.cart .product-thumbnail {
  grid-area: thumb;
}

.gp-cart-page .shop_table.cart .product-thumbnail a,
.gp-cart-page .shop_table.cart .product-thumbnail img {
  display: block;
}

.gp-cart-page .shop_table.cart .product-thumbnail img {
  border-radius: 8px;
  border: var(--gp-cart-border);
  width: 80px;
  height: 80px;
  object-fit: cover;
}

.gp-cart-page .shop_table.cart .product-name {
  grid-area: name;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.4;
}

.gp-cart-page .shop_table.cart .product-name a {
  color: var(--gp-cart-text);
  text-decoration: none;
}

.gp-cart-page .shop_table.cart .product-name a:hover {
  text-decoration: underline;
}

.gp-cart-page .shop_table.cart .product-name .variation,
.gp-cart-page .shop_table.cart .product-name dl.variation {
  font-size: 13px;
  color: var(--gp-cart-text-muted);
  margin: 6px 0 0;
  font-weight: 400;
}

.gp-cart-page .shop_table.cart .product-name .variation dt,
.gp-cart-page .shop_table.cart .product-name dl.variation dt {
  display: none;
}

.gp-cart-page .shop_table.cart .product-name .variation dd,
.gp-cart-page .shop_table.cart .product-name dl.variation dd {
  margin: 0;
}

.gp-cart-page .shop_table.cart .product-quantity {
  grid-area: qty;
}

/* Subtotal / price column - ensure proper width for Rupiah/long prices */
.gp-cart-page .shop_table.cart .product-subtotal .woocommerce-Price-amount,
.gp-cart-page .shop_table.cart .product-subtotal bdi {
  white-space: nowrap;
}

.gp-cart-page .shop_table.cart .product-remove {
  grid-area: remove;
  margin-top: -4px;
}

.gp-cart-page .shop_table.cart .product-remove .remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--gp-cart-text-muted) !important;
  font-size: 20px;
  line-height: 1;
  text-decoration: none !important;
  border: none !important;
  background: transparent;
  transition: background 0.2s, color 0.2s;
}

.gp-cart-page .shop_table.cart .product-remove .remove:hover {
  background: #fee2e2;
  color: #b91c1c !important;
}

/* Sale price: harga coret kiri, harga sale kanan (inline) */
.gp-cart-page .gp-cart-price-stack {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: baseline;
  white-space: nowrap;
}

.gp-cart-page .gp-cart-price-stack__regular,
.gp-cart-page .gp-cart-price-stack__sale,
.gp-cart-page .gp-cart-price-stack .woocommerce-Price-amount,
.gp-cart-page .gp-cart-price-stack bdi {
  white-space: nowrap;
}

.gp-cart-page .gp-cart-price-stack__regular {
  font-size: 12px !important;
  font-weight: 400 !important;
  color: var(--gp-cart-text-muted) !important;
  text-decoration: line-through;
}

.gp-cart-page .gp-cart-price-stack__sale {
  text-decoration: none;
  font-weight: 600;
}

/* Quantity input */
.gp-cart-page .quantity {
  display: inline-block;
}

.gp-cart-page .quantity input.qty {
  width: 56px;
  min-height: 40px;
  text-align: center;
  border: var(--gp-cart-border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

/* ==========================================================================
   Cart Actions - Coupon & Update (secondary)
   ========================================================================== */

.gp-cart-page .woocommerce-cart-form .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 20px 24px;
  background: var(--gp-cart-bg);
  border-top: var(--gp-cart-border);
}

.gp-cart-page .woocommerce-cart-form .coupon {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}

.gp-cart-page .woocommerce-cart-form .coupon input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: var(--gp-cart-border);
  border-radius: 8px;
  font-size: 14px;
}

.gp-cart-page .woocommerce-cart-form .coupon .button {
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
}

.gp-cart-page .woocommerce-cart-form .button[name="update_cart"] {
  padding: 10px 18px;
  background: transparent !important;
  color: var(--gp-cart-text) !important;
  border: var(--gp-cart-border) !important;
  border-radius: 8px;
  font-weight: 500;
}

.gp-cart-page .woocommerce-cart-form .button[name="update_cart"]:hover {
  background: var(--gp-cart-bg) !important;
}

/* ==========================================================================
   Cart Summary (Totals)
   ========================================================================== */

/* Override WooCommerce layout: cart_totals 48% → 100% */
.gp-cart-page .cart-collaterals .cart_totals,
.gp-cart-page .woocommerce .cart-collaterals .cart_totals {
  width: 100%;
}

.gp-cart-page .cart_totals {
  background: #fff;
  border: var(--gp-cart-border);
  border-radius: var(--gp-cart-radius);
  padding: 20px 24px;
}

.gp-cart-page .cart_totals h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 16px;
  padding: 0;
  border: none;
  background: transparent !important;
}

.gp-cart-page .cart_totals .shop_table {
  margin: 0;
  border: none;
}

.gp-cart-page .cart_totals .shop_table tr,
.gp-cart-page .cart_totals .shop_table th,
.gp-cart-page .cart_totals .shop_table td {
  border: none !important;
  background: transparent !important;
}

.gp-cart-page .cart_totals .shop_table tr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  font-size: 14px;
}

.gp-cart-page .cart_totals .wc-proceed-to-checkout {
  margin-top: 16px;
  padding-top: 16px;
  border-top: none;
}

/* Order notes - moved from checkout to cart totals (inside wc-proceed-to-checkout) */
.gp-cart-page .cart_totals .gp-cart-order-notes {
  margin-top: 0;
  margin-bottom: 16px;
  padding-top: 0;
  border-top: none;
}

.gp-cart-page .cart_totals .gp-cart-order-notes label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gp-cart-text);
}

.gp-cart-page .cart_totals .gp-cart-order-notes textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.gp-cart-page .cart_totals .shop_table th {
  flex-shrink: 0;
  min-width: 0;
  font-weight: 500;
  color: var(--gp-cart-text);
  white-space: nowrap;
}

.gp-cart-page .cart_totals .shop_table td {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  text-align: right;
}

/* Total Penghematan - merah */
.gp-cart-page .cart_totals .shop_table tr.penghematan-row th,
.gp-cart-page .cart_totals .shop_table tr.penghematan-row td {
  color: #dc3545;
  font-weight: 600;
}

/* Informasi Total (order total row) - hidden */
.gp-cart-page .cart_totals .shop_table tr.order-total {
  display: none !important;
}

/* Shipping - hidden di cart totals (info shipping tampil di checkout) */
.gp-cart-page .cart_totals .shop_table tr.shipping {
  display: none !important;
}

.gp-cart-page .cart_totals .shop_table tr.shipping th {
  padding-top: 4px;
}

.gp-cart-page .cart_totals .shop_table tr.shipping td {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.gp-cart-page .cart_totals .shop_table tr.shipping td ul.woocommerce-shipping-methods {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.gp-cart-page .cart_totals .shop_table tr.shipping td ul.woocommerce-shipping-methods li {
  margin: 4px 0;
}

.gp-cart-page .cart_totals .shop_table tr.shipping td .woocommerce-shipping-destination {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--gp-cart-text-muted);
  text-align: right;
  width: 100%;
}

.woocommerce table.shop_table th {
  padding: 0 !important;
}

tr.cart-discount.coupon-vqvagd5q {
  display: none !important;
}

/* ==========================================================================
   Proceed to Checkout - Primary CTA
   ========================================================================== */

.gp-cart-page .wc-proceed-to-checkout {
  margin-top: 20px;
  padding-top: 20px;
  border-top: var(--gp-cart-border);
}

.gp-cart-page .wc-proceed-to-checkout .checkout-button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px;
  width: 100%;
  padding: 16px 24px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  text-align: center !important;
  white-space: nowrap;
  color: var(--gp-cart-accent-text) !important;
  border: none !important;
  transition: opacity 0.2s;
}

.gp-cart-page .wc-proceed-to-checkout .checkout-button .gp-icon-lock {
  flex-shrink: 0;
}

.gp-cart-page .wc-proceed-to-checkout .checkout-button:hover {
  opacity: 0.9;
}

.gp-cart-page .wc-proceed-to-checkout .gp-continue-shopping-link {
  display: block;
  margin-top: 14px;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  color: var(--brand-600);
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s;
  border-top: 1px solid #ccc;
  padding-top: 16px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 16px;
}

.gp-cart-page .wc-proceed-to-checkout .gp-continue-shopping-link:hover {
  color: var(--gp-cart-accent);
}

.gp-cart-page .cart_totals .wc-proceed-to-checkout {
  padding: 0 !important;
}

/* ==========================================================================
   Cross-sells (compact, below layout)
   ========================================================================== */

.gp-cart-page .cross-sells {
  margin-top: 40px;
  padding-top: 32px;
  border-top: var(--gp-cart-border);
}

.gp-cart-page .cross-sells h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.gp-cart-page .cross-sells ul.products {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (min-width: 768px) {
  .gp-cart-page .cross-sells ul.products {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   Mobile - Stacked layout
   ========================================================================== */

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

@media (max-width: 767px) {
  .gp-cart-page .gp-cart-items-col {
    overflow: visible;
    min-width: 0;
  }

  .gp-cart-page .woocommerce-cart-form {
    overflow: visible;
    border-radius: var(--gp-cart-radius);
    border-right: 1px solid #e8e8e8 !important;
    border-left: 1px solid #e8e8e8 !important;
  }

  .gp-cart-page .woocommerce-cart-form .woocommerce,
  .gp-cart-page .shop_table.cart {
    overflow: visible;
  }

  /* Layout: thumb | judul | remove atas kanan | harga | qty */
  .gp-cart-page .shop_table.cart.shop_table_responsive tbody tr.cart_item {
    display: grid !important;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    grid-template-areas:
      "thumb name   remove"
      "thumb price  price"
      "thumb qty    qty";
    padding: 12px 14px;
    gap: 3px 10px;
    align-items: start;
  }

  .gp-cart-page .shop_table.cart .product-thumbnail {
    display: block !important;
    grid-area: thumb;
    align-self: start;
  }

  .gp-cart-page .shop_table.cart .product-thumbnail img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
  }

  .gp-cart-page .shop_table.cart tbody td::before {
    display: none !important;
  }

  .gp-cart-page .shop_table.cart tbody td {
    text-align: left !important;
    background: transparent !important;
  }

  .gp-cart-page .shop_table.cart tbody tr:nth-child(2n) td {
    background: transparent !important;
  }

  .gp-cart-page .shop_table.cart tbody tr.cart_item + tr.cart_item {
    border-top: var(--gp-cart-border);
    padding-top: 10px;
  }

  /* Judul & variasi: full ke kanan (span 2 kolom) */
  .gp-cart-page .shop_table.cart .product-name {
    grid-area: name;
    font-size: 14px;
    line-height: 1.35;
    min-width: 0;
  }

  .gp-cart-page .shop_table.cart .product-name > a {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
  }

  .gp-cart-page .shop_table.cart .product-name .variation,
  .gp-cart-page .shop_table.cart .product-name dl.variation {
    font-size: 12px;
    margin: 4px 0 0;
    line-height: 1.35;
    min-width: 0;
  }

  .gp-cart-page .shop_table.cart .product-name .variation dd,
  .gp-cart-page .shop_table.cart .product-name dl.variation dd,
  .gp-cart-page .shop_table.cart .product-name .variation p,
  .gp-cart-page .shop_table.cart .product-name dl.variation dd p {
    margin: 0;
  }

  /* Harga: di bawah judul, left-aligned, bold (referensi) */
  .gp-cart-page .shop_table.cart .product-subtotal {
    grid-area: price;
    justify-self: start;
    align-self: center;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: visible;
  }

  /* Remove: atas kanan baris produk */
  .gp-cart-page .shop_table.cart .product-remove {
    grid-area: remove;
    align-self: start;
    justify-self: end;
    margin-top: -4px;
  }

  .gp-cart-page .shop_table.cart .product-remove .remove {
    width: 28px;
    height: 28px;
    font-size: 16px;
    color: var(--gp-cart-text-muted) !important;
  }

  .gp-cart-page .shop_table.cart .product-quantity {
    grid-area: qty;
    align-self: center;
  }

  /* Qty: lebih compact */
  .gp-cart-page .shop_table.cart .product-quantity .quantity {
    display: inline-flex;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0;
    border: var(--gp-cart-border);
    border-radius: 6px;
    overflow: hidden;
    height: 28px;
  }

  .gp-cart-page .shop_table.cart .product-quantity .quantity .minus,
  .gp-cart-page .shop_table.cart .product-quantity .quantity .plus {
    flex-shrink: 0;
    width: 24px;
    min-width: 24px;
    height: 100%;
    min-height: 28px;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    line-height: 28px;
    border: none;
    border-radius: 0;
    background: var(--gp-cart-bg);
    color: var(--gp-cart-text);
    text-decoration: none !important;
    box-sizing: border-box;
  }

  .gp-cart-page .shop_table.cart .product-quantity .quantity .qty {
    width: 32px;
    min-width: 32px;
    flex: 0 0 32px;
    padding: 2px 4px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    border: none;
    border-left: var(--gp-cart-border);
    border-right: var(--gp-cart-border);
    min-height: 0;
    height: 100%;
    box-sizing: border-box;
  }

  .gp-cart-page .woocommerce-cart-form .actions {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }

  .gp-cart-page .woocommerce-cart-form .coupon {
    flex-direction: column;
  }

  .gp-cart-page .cart_totals {
    padding: 20px 16px;
  }

  .gp-cart-page .cart_totals h2 {
    border-bottom: none;
  }

  .gp-cart-page .cart_totals .shop_table tr,
  .gp-cart-page .cart_totals .shop_table tr.order-total {
    border: none !important;
    border-top: none !important;
  }

  .gp-cart-page .cart_totals .shop_table th,
  .gp-cart-page .cart_totals .shop_table td {
    border: none !important;
  }

  .gp-cart-page .cart_totals .wc-proceed-to-checkout {
    border-top: none;
  }

  .woocommerce table.shop_table td {
    padding: 2px !important;
  }
}