/* Import Noto Sans Thai font */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700&display=swap");

/* Cart Wrapper */
.custom-cart-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: "Noto Sans Thai", sans-serif;
}

/* Cart Layout */
.cart-layout,
.woocommerce-cart .cart-layout {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

/* Force cart elements into proper layout */
.woocommerce-cart .cart-collaterals,
.woocommerce-cart .cart_totals,
.woocommerce-cart .e-cart-totals,
.woocommerce-cart .e-cart-section {
  width: 100% !important;
  float: none !important;
  margin: 0 !important;
}

/* Style e-cart-totals inside cart-totals-section */
.cart-totals-section .e-cart-totals.e-cart-section,
.cart-totals-section .e-cart-totals,
.cart-totals-section .e-cart-section {
  width: 100% !important;
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
}

/* Ensure cart layout container is relative */
.custom-cart-wrapper {
  position: relative;
}

/* Override any conflicting styles */
.woocommerce-cart .cart-collaterals {
  background: transparent;
  padding: 0;
  border: none;
}

/* Left Side: Cart Table */
.cart-table-section {
  flex: 0 0 60%;
  background: #fff;
  padding: 25px;
  border-radius: 8px;
  border: 1px solid #eaeaea;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Right Side: Cart Totals */
.cart-totals-section,
.e-cart-totals,
.e-cart-section {
  flex: 0 0 40%;
  background: #f8f9fa;
  padding: 25px;
  border-radius: 8px;
  border: 1px solid #eaeaea;
  position: sticky;
  top: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Cart Table Styling */
.cart-table-section table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
}

.cart-table-section table thead {
  background: #f8f9fa;
}

.cart-table-section table th {
  padding: 20px 15px;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #eaeaea;
  font-family: "Noto Sans Thai", sans-serif;
  font-size: 14px;
}

.cart-table-section table td {
  padding: 20px 15px;
  border-bottom: 1px solid #eaeaea;
  vertical-align: middle;
  font-family: "Noto Sans Thai", sans-serif;
}

/* Product Info Cell */
.product-info-content {
  display: flex;
  align-items: center;
  gap: 15px;
  position: relative;
}

.product-remove {
  position: absolute;
  top: -10px;
  right: -10px;
  z-index: 10;
}

.product-remove .remove {
  width: 24px;
  height: 24px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 16px;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

.product-remove .remove:hover {
  background: #c82333;
}

.product-thumbnail {
  flex-shrink: 0;
}

.product-thumbnail img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #eaeaea;
}

.product-name {
  flex: 1;
  color: #333;
  font-size: 14px;
  font-weight: 500;
}

.product-name a {
  color: #333;
  text-decoration: none;
}

.product-name a:hover {
  color: #007cba;
}

/* Price Column */
.product-price {
  text-align: center;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

/* Quantity Column */
.product-quantity {
  text-align: center;
}

.product-quantity .quantity {
  display: flex;
  justify-content: center;
}

.product-quantity input[type="number"] {
  width: 60px;
  padding: 8px;
  border: 1px solid #eaeaea;
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  font-family: "Noto Sans Thai", sans-serif;
}

/* Subtotal Column */
.product-subtotal {
  text-align: right;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

/* Cart Actions Below Table */
.cart-actions-wrapper {
  margin-top: 20px;
  padding: 20px 0;
}

.update-cart-btn {
  padding: 12px 25px;
  background: #f8f9fa;
  border: 2px solid #17a2b8;
  border-radius: 4px;
  color: #17a2b8;
  font-size: 14px;
  font-family: "Noto Sans Thai", sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.update-cart-btn:hover {
  background: #17a2b8;
  color: white;
}

/* Coupon Section in Right Panel */
.coupon-section {
  display: flex;
  gap: 5px;
  margin-bottom: 20px;
  align-items: stretch;
}

.coupon-input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #eaeaea;
  border-radius: 4px;
  font-size: 14px;
  font-family: "Noto Sans Thai", sans-serif;
  color: #999;
}

.coupon-btn {
  padding: 10px 15px;
  background: #17a2b8;
  border: 1px solid #17a2b8;
  border-radius: 4px;
  color: white;
  font-size: 14px;
  font-family: "Noto Sans Thai", sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  white-space: nowrap;
}

.coupon-btn:hover {
  background: #138496;
  border-color: #138496;
}

/* Cart Totals Styling */
.cart-totals-title,
.cart_totals h2,
.e-cart-totals h2 {
  margin: 0 0 25px 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  text-align: center;
  font-family: "Noto Sans Thai", sans-serif;
}

/* Additional styling for cart totals elements */
.cart-totals-section .cart_totals,
.cart-totals-section .e-cart-totals,
.cart-totals-section .e-cart-section {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

/* Style the totals table */
.cart-totals-section .shop_table,
.cart-totals-section .e-cart-totals table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

.cart-totals-section .shop_table th,
.cart-totals-section .shop_table td,
.cart-totals-section .e-cart-totals th,
.cart-totals-section .e-cart-totals td {
  padding: 12px 0;
  border: none;
  border-bottom: 1px solid #eaeaea;
  font-family: "Noto Sans Thai", sans-serif;
  text-align: left;
}

.cart-totals-section .shop_table th,
.cart-totals-section .e-cart-totals th {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.cart-totals-section .shop_table td,
.cart-totals-section .e-cart-totals td {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  text-align: right;
}

.cart-totals-content > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #eaeaea;
  font-family: "Noto Sans Thai", sans-serif;
}

.cart-totals-content > div:last-child {
  border-bottom: none;
}

.totals-label {
  color: #333;
  font-size: 14px;
  font-weight: 500;
}

.totals-value {
  color: #333;
  font-size: 14px;
  font-weight: 600;
}

/* Order Total Row */
.order-total-row {
  padding: 20px 0 !important;
  border-top: 2px solid #333 !important;
  margin-top: 15px;
}

.order-total-row .totals-label {
  font-size: 16px;
  font-weight: 600;
}

.order-total-row .totals-value {
  font-size: 16px;
  font-weight: 700;
}

/* Checkout Button */
.wc-proceed-to-checkout,
.cart-totals-section .wc-proceed-to-checkout,
.e-cart-totals .wc-proceed-to-checkout {
  margin-top: 25px;
}

.wc-proceed-to-checkout .checkout-button,
.wc-proceed-to-checkout a,
.cart-totals-section .checkout-button,
.e-cart-totals .checkout-button {
  width: 100% !important;
  padding: 15px !important;
  background: #17a2b8 !important;
  color: white !important;
  border: none !important;
  border-radius: 8px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  font-family: "Noto Sans Thai", sans-serif !important;
  cursor: pointer !important;
  transition: background-color 0.3s ease !important;
  text-decoration: none !important;
  display: block !important;
  text-align: center !important;
  text-transform: uppercase !important;
}

.wc-proceed-to-checkout .checkout-button:hover,
.wc-proceed-to-checkout a:hover,
.cart-totals-section .checkout-button:hover,
.e-cart-totals .checkout-button:hover {
  background: #138496 !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .cart-layout {
    flex-direction: column;
    gap: 20px;
  }

  .cart-table-section,
  .cart-totals-section {
    flex: none;
    width: 100%;
  }

  .cart-totals-section {
    position: static;
  }

  .custom-cart-wrapper {
    padding: 15px;
  }

  .cart-table-section,
  .cart-totals-section {
    padding: 20px;
  }

  .cart-table-section table th,
  .cart-table-section table td {
    padding: 12px 8px;
    font-size: 13px;
  }

  .product-thumbnail img {
    width: 60px;
    height: 60px;
  }

  .product-info-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .coupon-section {
    flex-direction: column;
    gap: 10px;
  }

  .coupon-input {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .cart-table-section table {
    font-size: 12px;
  }

  .product-info-content {
    gap: 8px;
  }

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

  .cart-table-section,
  .cart-totals-section {
    padding: 15px;
  }
}
