/* ==========================================================================
   CART & CHECKOUT MOBILE RESPONSIVE STYLES
   aff.duocphamvinhgia.vn
   ========================================================================== */

:root {
  --cart-primary: #108043;
  --cart-primary-hover: #0b6635;
  --cart-accent: #f26522;
  --cart-accent-hover: #d94e0e;
  --cart-bg: #f8fafc;
  --cart-card-bg: #ffffff;
  --cart-border: #e2e8f0;
  --cart-text: #1e293b;
  --cart-muted: #64748b;
  --cart-radius: 12px;
  --cart-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* 1. STEPPER PROGRESS BAR */
.checkout-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 16px 20px;
  border-radius: var(--cart-radius);
  margin-bottom: 24px;
  box-shadow: var(--cart-shadow);
  border: 1px solid var(--cart-border);
}

.checkout-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--cart-muted);
}

.checkout-step.active {
  color: var(--cart-primary);
}

.checkout-step.completed {
  color: #059669;
}

.checkout-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s;
}

.checkout-step.active .checkout-step-num {
  background: var(--cart-primary);
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(16, 128, 67, 0.2);
}

.checkout-step.completed .checkout-step-num {
  background: #059669;
  color: #ffffff;
}

.checkout-step-divider {
  flex: 1;
  max-width: 60px;
  height: 2px;
  background: #e2e8f0;
  margin: 0 12px;
}

.checkout-step.completed + .checkout-step-divider {
  background: #059669;
}

/* 2. GENERAL CART CONTAINERS */
.detail_product.contentMain {
  padding: 20px 0 60px;
  background: var(--cart-bg);
}

.product_detail_bg {
  background: var(--cart-card-bg);
  border-radius: var(--cart-radius);
  padding: 20px;
  box-shadow: var(--cart-shadow);
  border: 1px solid var(--cart-border);
  margin-bottom: 20px;
}

.product_detail_bg .title-cart {
  font-size: 18px;
  font-weight: 700;
  color: var(--cart-text);
  margin-top: 0;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.product_detail_bg .title-cart i {
  color: var(--cart-primary);
}

/* 3. MOBILE CART ITEMS CARD (Replaces table on < 768px) */
@media (max-width: 767px) {
  .checkout-stepper {
    padding: 12px 10px;
    font-size: 12px;
    margin-bottom: 16px;
  }
  
  .checkout-step span.step-text {
    display: none;
  }
  
  .checkout-step.active span.step-text {
    display: inline;
    font-size: 12px;
  }
  
  .checkout-step-num {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  
  .checkout-step-divider {
    max-width: 30px;
    margin: 0 6px;
  }

  /* Hide table header on mobile */
  .table-product-pack.table.checkOut thead {
    display: none !important;
  }

  .table-product-pack.table.checkOut,
  .table-product-pack.table.checkOut tbody,
  .table-product-pack.table.checkOut tr {
    display: block !important;
    width: 100% !important;
  }

  /* Make each product row a clean Card */
  .table-product-pack.table.checkOut tbody > tr[id^="product_"] {
    display: flex !important;
    flex-wrap: wrap;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
  }

  /* Left: Product Image */
  .table-product-pack.table.checkOut tbody > tr[id^="product_"] > td:nth-child(1) {
    display: flex !important;
    width: 100% !important;
    padding: 0 0 12px 0 !important;
    border: none !important;
    border-bottom: 1px dashed #f1f5f9 !important;
  }

  .table-product-pack.table.checkOut tbody > tr[id^="product_"] > td:nth-child(1) .col-md-3 {
    width: 75px !important;
    min-width: 75px !important;
    padding: 0 !important;
  }

  .table-product-pack.table.checkOut tbody > tr[id^="product_"] > td:nth-child(1) .col-md-3 img {
    width: 75px !important;
    height: 75px !important;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    background: #fafafa;
  }

  .table-product-pack.table.checkOut tbody > tr[id^="product_"] > td:nth-child(1) .col-md-9 {
    width: calc(100% - 85px) !important;
    padding: 0 0 0 12px !important;
  }

  .table-product-pack.table.checkOut .nameInfo a {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Unit Price row */
  .table-product-pack.table.checkOut tbody > tr[id^="product_"] > td:nth-child(2) {
    display: none !important; /* Hide standalone price td, we show inside subtotal */
  }

  /* Quantity Selector row */
  .table-product-pack.table.checkOut tbody > tr[id^="product_"] > td:nth-child(3) {
    display: flex !important;
    align-items: center;
    width: 50% !important;
    padding: 10px 0 0 0 !important;
    border: none !important;
  }

  .quantity-selector .number-spinner {
    width: 115px !important;
    display: inline-flex !important;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
  }

  .quantity-selector .number-spinner .operator__btn {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    line-height: 34px !important;
    background: #ffffff !important;
    border: none !important;
    color: #334155 !important;
    font-size: 16px !important;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .quantity-selector .number-spinner input.changeQty {
    width: 45px !important;
    height: 34px !important;
    border: none !important;
    border-left: 1px solid #e2e8f0 !important;
    border-right: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    padding: 0 !important;
    text-align: center !important;
    box-shadow: none !important;
  }

  /* Total money & Delete row */
  .table-product-pack.table.checkOut tbody > tr[id^="product_"] > td:nth-child(4) {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    width: 50% !important;
    padding: 10px 0 0 0 !important;
    border: none !important;
    gap: 12px;
  }

  .table-product-pack.table.checkOut .money {
    font-size: 15px;
    font-weight: 700;
    color: #e11d48;
    margin: 0;
  }

  .table-product-pack.table.checkOut .delItemCart {
    margin: 0 !important;
  }

  .table-product-pack.table.checkOut .deleteItemCart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #fee2e2;
    color: #ef4444 !important;
    font-size: 13px;
    cursor: pointer;
  }

  /* Promotion box on mobile */
  .table-product-pack.table.checkOut tbody > tr[id^="itemCart"] {
    display: block !important;
    width: 100% !important;
    margin-top: -6px;
    margin-bottom: 14px;
  }

  .table-product-pack.table.checkOut tbody > tr[id^="itemCart"] > td {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    border: none !important;
  }

  .table-product-pack.table.checkOut .panel {
    border-radius: 10px !important;
    border: 1px solid #fed7aa !important;
    background: #fffaf5 !important;
    box-shadow: none !important;
    margin-bottom: 8px !important;
  }

  .table-product-pack.table.checkOut .panel-heading.ChuongTrinhKM {
    background: transparent !important;
    padding: 8px 12px !important;
    border-bottom: 1px dashed #fed7aa !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #c2410c !important;
  }

  .table-product-pack.table.checkOut .panel-body {
    padding: 8px 12px !important;
  }

  .table-product-pack.table.checkOut .detailKm {
    padding-left: 14px !important;
    margin: 0 !important;
    font-size: 12px !important;
    color: #475569 !important;
  }
}

/* 4. SUMMARY BOX & BUTTONS */
.price_end {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}

.price_end li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--cart-text);
  padding: 8px 0;
}

.price_end .price-total {
  font-size: 18px;
  font-weight: 800;
  color: #e11d48;
}

.button-pay a,
.btn-checkout-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #108043 0%, #0b6635 100%);
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-radius: 10px;
  text-decoration: none !important;
  box-shadow: 0 4px 12px rgba(16, 128, 67, 0.25);
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.button-pay a:hover,
.btn-checkout-primary:hover {
  background: linear-gradient(135deg, #0b6635 0%, #064e26 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 128, 67, 0.35);
}

.button-pay.continue a,
.btn-checkout-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 20px;
  background: #f1f5f9;
  color: #475569 !important;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none !important;
  transition: all 0.2s ease;
  border: 1px solid #e2e8f0;
}

.button-pay.continue a:hover,
.btn-checkout-secondary:hover {
  background: #e2e8f0;
  color: #1e293b !important;
}

/* 5. STICKY MOBILE CHECKOUT BAR */
.cart-mobile-sticky-bar {
  display: none;
}

@media (max-width: 767px) {
  .cart-mobile-sticky-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    bottom: 0 !important; /* Screen bottom as chat menu is hidden in cart */
    padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 10px 16px;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    z-index: 9999;
  }

  .cart-mobile-sticky-bar .sticky-total-info {
    display: flex;
    flex-direction: column;
  }

  .cart-mobile-sticky-bar .sticky-label {
    font-size: 12px;
    color: #64748b;
  }

  .cart-mobile-sticky-bar .sticky-price {
    font-size: 16px;
    font-weight: 800;
    color: #e11d48;
  }

  .cart-mobile-sticky-bar .sticky-btn-pay {
    padding: 10px 18px;
    background: linear-gradient(135deg, #108043 0%, #0b6635 100%);
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 8px;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(16, 128, 67, 0.3);
  }
}

/* 6. ORDER & CHECKOUT PAGE FORM CONTROLS */
.orderCart .form-group {
  margin-bottom: 14px;
}

.orderCart .input-group {
  width: 100%;
  border-radius: 8px;
}

.orderCart .input-group-addon {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: #64748b;
  min-width: 44px;
  padding: 10px 14px;
}

.orderCart .form-control {
  height: 44px;
  border-radius: 0 8px 8px 0;
  border: 1px solid #cbd5e1;
  font-size: 14px;
  box-shadow: none;
  transition: border-color 0.2s;
}

.orderCart .form-control:focus {
  border-color: var(--cart-primary);
  box-shadow: 0 0 0 3px rgba(16, 128, 67, 0.15);
}

/* Custom Select2 styling on mobile */
.select2-container .select2-selection--single {
  height: 44px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 0 8px 8px 0 !important;
  display: flex !important;
  align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 44px !important;
  padding-left: 12px !important;
  font-size: 14px !important;
  color: #1e293b !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 42px !important;
}

/* 7. COUPON CODE SECTION */
.total-all-products {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px;
}

.total-all-products p {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #475569;
  margin-bottom: 10px;
}

.total-all-products p b,
.total-all-products p .price_all {
  font-weight: 700;
  color: #1e293b;
  font-size: 15px;
}

.input-code-coupon {
  display: flex !important;
  gap: 8px;
  margin-top: 6px;
}

.txt-code-coupon {
  flex: 1;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13px;
  background: #ffffff;
}

.btn-code-coupon {
  height: 38px;
  padding: 0 16px;
  background: var(--cart-primary) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* 8. PAYMENT & SHIPPING METHOD CARDS */
.item_thanhtoan .radio-inline {
  display: flex !important;
  align-items: flex-start;
  padding: 14px !important;
  margin: 0 0 10px 0 !important;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.item_thanhtoan .radio-inline:hover,
.item_thanhtoan .radio-inline.active {
  border-color: var(--cart-primary) !important;
  background: #f0fdf4 !important;
}

.item_thanhtoan .radio-inline input[type="radio"] {
  margin-top: 3px;
  margin-right: 10px;
  width: 18px;
  height: 18px;
  accent-color: var(--cart-primary);
}

.item_thanhtoan .online_pay {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.item_thanhtoan .labelPayment {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #cbd5e1;
}

/* 9. ORDER SUCCESS PAGE */
.order-success-card {
  background: #ffffff;
  border-radius: var(--cart-radius);
  padding: 24px;
  box-shadow: var(--cart-shadow);
  border: 1px solid var(--cart-border);
  text-align: center;
  margin-bottom: 24px;
}

.order-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 16px;
}

.order-success-title {
  font-size: 22px;
  font-weight: 800;
  color: #16a34a;
  margin-bottom: 8px;
}

.order-code-badge {
  display: inline-block;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 6px 14px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin: 8px 0 16px;
}

/* 10. AFFILIATE REFERRAL BADGE */
.aff-referral-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: #065f46;
  font-weight: 600;
}
