/**
 * WooCommerce Cart - Custom Flexbox Layout
 * Responsive cart layout inspired by Casa Paulista structure
 */

/* ============================================
   CART CONTAINER
   ============================================ */

.custom-cart-form {
  width: 100%;
}

.screen-reader-text {
  display: none;
}

.cart-items-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
}

/* ============================================
   CART ITEM ROW
   ============================================ */

.cart-item-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  gap: 20px;
  transition: box-shadow 0.2s ease;
}

.cart-item-row:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ============================================
   LEFT SIDE: Thumbnail + Product Info
   ============================================ */

.cart-item-start {
  display: flex;
  flex: 1 1 auto;
  gap: 15px;
  min-width: 0;
  /* Important for text truncation */
}

.cart-item-left {
  flex-shrink: 0;
}

.product-thumbnail {
  width: 100px;
  height: 100px;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
}

.product-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumbnail a {
  display: block;
}

.cart-item-middle {
  flex: 1 1 auto;
  min-width: 0;
}

.product-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-name label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 5px;
  letter-spacing: 0.5px;
}

.product-name a {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  text-decoration: none;
  line-height: 1.4;
}

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

/* Variations */
.product-name .variation,
.product-name dl.variation {
  margin-top: 8px;
  font-size: 13px;
  color: #666;
}

.product-name .variation dt,
.product-name dl.variation dt {
  font-weight: 600;
  display: inline;
  margin-right: 5px;
}

.product-name .variation dd,
.product-name dl.variation dd {
  display: inline;
  margin: 0 10px 0 0;
}

/* ============================================
   RIGHT SIDE: Actions + Price
   ============================================ */

.cart-item-right {
  display: flex;
  flex-direction: row;
  gap: 15px;
  align-items: center;
  min-width: 200px;
}

.product-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.product-actions label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 0.5px;
}

/* Quantity Input */
.woocommerce .quantity.buttons_added,
.product-quantity .quantity {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.product-quantity .quantity a,
.product-quantity .quantity .minus,
.product-quantity .quantity .plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #f8f8f8;
  color: #333;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.product-quantity .quantity a:hover,
.product-quantity .quantity .minus:hover,
.product-quantity .quantity .plus:hover {
  background: #e8e8e8;
  color: #000;
}

.product-quantity .quantity input[type="number"] {
  width: 50px;
  height: 32px;
  text-align: center;
  border: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
}

/* Remove Button */
.product-remove .remove-item {
  display: inline-block;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #999;
  text-decoration: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.product-remove .remove-item:hover {
  background: #e74c3c;
  color: #fff;
  border-color: #e74c3c;
}

/* Price */
.product-price {
  text-align: right;
}

.product-price label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 5px;
  letter-spacing: 0.5px;
}

.product-price .woocommerce-Price-amount {
  font-size: 20px;
  font-weight: 700;
  color: #333;
}

.product-price .payment-method-note {
  display: block;
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

/* ============================================
   CART ACTIONS ROW
   ============================================ */

.cart-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 20px;
  background: #f8f8f8;
  border-radius: 8px;
  margin-top: 10px;
}

#coupon-container {
  flex: 1 1 auto;
  min-width: 250px;
}

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

.coupon input[type="text"] {
  flex: 1 1 auto;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.coupon .apply-coupon,
.update-cart {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.coupon .apply-coupon {
  background: #333;
  color: #fff;
  border: 1px solid #333;
}

.coupon .apply-coupon:hover {
  background: #000;
  border-color: #000;
}

.update-cart {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
}

.update-cart:hover:not(:disabled) {
  background: #f0f0f0;
}

.update-cart:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   MOBILE STYLES (< 768px)
   ============================================ */

@media screen and (max-width: 768px) {

  .cart-item-row {
    flex-wrap: wrap;
    padding: 15px;
    gap: 15px;
  }

  /* Keep thumbnail and name side by side on mobile */
  .cart-item-start {
    width: 100%;
    gap: 12px;
  }

  .product-thumbnail {
    width: 80px;
    height: 80px;
  }

  .product-name a {
    font-size: 14px;
  }

  /* Stack actions and price vertically */
  .cart-item-right {
    width: 100%;
    align-items: stretch;
    min-width: 100%;
  }

  .product-actions {
    width: 100%;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 10px;
  }

  .product-actions label {
    width: 100%;
  }

  .product-quantity {
    flex: 1 1 auto;
  }

  .product-quantity .quantity {
    width: 100%;
    max-width: 150px;
  }

  .product-remove {
    flex: 0 0 auto;
  }

  .product-price {
    width: 100%;
    text-align: left;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
  }

  .product-price .woocommerce-Price-amount {
    font-size: 18px;
  }

  /* Cart Actions */
  .cart-actions-row {
    flex-direction: column;
    align-items: stretch;
  }

  #coupon-container {
    width: 100%;
    min-width: 100%;
  }

  .coupon {
    flex-direction: column;
  }

  .coupon input[type="text"],
  .coupon .apply-coupon,
  .update-cart {
    width: 100%;
  }
}

/* ============================================
   SMALL MOBILE (< 480px)
   ============================================ */

@media screen and (max-width: 480px) {

  .cart-item-row {
    padding: 12px;
  }

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

  .product-name a {
    font-size: 13px;
  }

  .product-name label,
  .product-actions label,
  .product-price label {
    font-size: 10px;
  }

  .product-price .woocommerce-Price-amount {
    font-size: 16px;
  }
}

/* ============================================
   COMPATIBILITY WITH AURUM THEME
   ============================================ */

/* Ensure Aurum's existing styles don't conflict */
.custom-cart-form .cart-items-container {
  border: none;
}

/* Maintain Aurum's price styling */
.cart-items-container .price {
  display: inline-block;
}

/* Maintain Aurum's name span wrapper */
.cart-items-container .product-name .name {
  display: block;
}

/* Image placeholder compatibility */
.cart-items-container .image-placeholder {
  display: block;
  width: 100%;
}

/* ============================================
   LOADING STATE
   ============================================ */

.woocommerce-cart-form.processing .cart-items-container {
  opacity: 0.6;
  pointer-events: none;
}

/* ============================================
   SCREEN READER TEXT
   ============================================ */

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  word-wrap: normal !important;
}


/* ============================================
   CART TOTALS SIMPLE
   ============================================ */

.cart-totals-simple {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 25px;
  margin-top: 20px;
}

.cart-totals-simple h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 20px 0;
  padding-bottom: 15px;
  border-bottom: 1px solid #e0e0e0;
}

.cart-totals-simple .shop_table {
  width: 100%;
  border: none;
  margin-bottom: 20px;
}

.cart-totals-simple .shop_table tbody {
  border: none;
}

.cart-totals-simple .shop_table tr {
  border: none;
}

.cart-totals-simple .shop_table th,
.cart-totals-simple .shop_table td {
  padding: 15px 0;
  border: none;
  font-size: 18px;
}

.cart-totals-simple .shop_table th {
  text-align: left;
  font-weight: 600;
  color: #333;
}

.cart-totals-simple .shop_table td {
  text-align: right;
}

.cart-totals-simple .order-total th,
.cart-totals-simple .order-total td {
  font-size: 24px;
  font-weight: 700;
  color: #000;
}

.cart-totals-simple .wc-proceed-to-checkout {
  margin: 0;
}

.cart-totals-simple .checkout-button {
  display: block;
  width: 100%;
  padding: 15px 30px;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.cart-totals-simple .checkout-button:hover {
  background: #000;
  color: #fff;
}

/* Mobile adjustments for cart totals */
@media screen and (max-width: 768px) {
  .cart-totals-simple {
    padding: 20px;
  }

  .cart-totals-simple h2 {
    font-size: 18px;
  }

  .cart-totals-simple .shop_table th,
  .cart-totals-simple .shop_table td {
    font-size: 16px;
  }

  .cart-totals-simple .order-total th,
  .cart-totals-simple .order-total td {
    font-size: 20px;
  }

  .cart-totals-simple .checkout-button {
    padding: 12px 20px;
    font-size: 14px;
  }
}