/* ==========================================================================
   Ridge Water - Shopping Cart Stylesheet (Clean Geometry & Clamped Text)
   ========================================================================== */

.cart-header-banner {
  background: linear-gradient(135deg, #081d38 0%, #0c2b54 50%, #0077c8 100%);
  padding: 40px 0;
  color: #ffffff;
  text-align: center;
}

.cart-header-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
}

.cart-header-banner h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.cart-header-banner p {
  font-size: 14.5px;
  color: #cbd5e1;
}

.cart-page-section {
  padding: 50px 0 80px;
  background-color: #f8fafc;
  min-height: 70vh;
}

.cart-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
}

/* 2-Column Grid Layout */
.cart-layout-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 32px;
  align-items: start;
}

/* Left: Cart Items Panel */
.cart-items-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 4px 14px rgba(11, 30, 54, 0.04);
}

.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.panel-header-row h2 {
  font-size: 18px;
  font-weight: 800;
  color: #081d38;
}

.btn-text-clear {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.btn-text-clear:hover {
  background: #fee2e2;
}

/* Fixed Table Layout */
.cart-table-wrapper {
  overflow-x: auto;
  width: 100%;
}

.cart-items-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.cart-items-table th {
  font-size: 11.5px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 10px 8px 14px;
  border-bottom: 1.5px solid #e2e8f0;
  text-align: left;
}

.cart-items-table td {
  padding: 16px 8px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  box-sizing: border-box;
}

/* Product Info Cell */
.cell-product-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cart-item-thumb {
  width: 62px;
  height: 62px;
  min-width: 62px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 3px;
  text-decoration: none;
  box-sizing: border-box;
}

.cart-item-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}

.cart-item-thumb:hover img {
  transform: scale(1.08);
}

.cart-item-details {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* 2-Line Clamped Title with Ellipsis */
.cart-product-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #081d38;
  line-height: 1.35;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 38px;
  transition: color 0.2s ease;
  word-break: break-word;
}

.cart-product-title:hover {
  color: #0077c8;
}

.cell-price {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  text-align: center;
}

.custom-quote-tag {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 4px;
}

/* Quantity Adjuster */
.cell-qty {
  text-align: center;
}

.cart-qty-picker {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  height: 34px;
}

.qty-btn-adjust {
  width: 28px;
  height: 100%;
  border: none;
  background: #f8fafc;
  color: #081d38;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.qty-btn-adjust:hover {
  background: #e2e8f0;
}

.qty-val-input {
  width: 32px;
  border: none;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: #081d38;
  background: #ffffff;
  outline: none;
}

.cell-line-total {
  font-size: 14.5px;
  font-weight: 800;
  color: #0077c8;
  text-align: right;
}

.cell-action-remove {
  text-align: right;
}

.btn-remove-item {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-remove-item:hover {
  color: #ef4444;
  background: #fee2e2;
}

.btn-remove-item svg {
  width: 16px;
  height: 16px;
}

.cart-continue-strip {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #f1f5f9;
}

.btn-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 800;
  color: #0077c8;
  text-decoration: none;
}

.btn-back-link svg {
  width: 14px;
  height: 14px;
}

/* Right: Order Summary & Checkout Box */
.cart-checkout-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.summary-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 14px rgba(11, 30, 54, 0.04);
}

.summary-title {
  font-size: 17px;
  font-weight: 800;
  color: #081d38;
  margin-bottom: 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  color: #64748b;
  margin-bottom: 12px;
}

.summary-row strong {
  color: #081d38;
  font-weight: 700;
}

.free-shipping-tag {
  font-size: 11px;
  font-weight: 800;
  color: #0077c8;
  background: #e0f2fe;
  padding: 3px 8px;
  border-radius: 4px;
}

.summary-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 14px 0;
}

.summary-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 17px;
  font-weight: 900;
  color: #081d38;
}

.total-amount-val {
  font-size: 20px;
  color: #0077c8;
}

/* Checkout Form Card */
.checkout-form-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 14px rgba(11, 30, 54, 0.04);
}

.checkout-form-card h3 {
  font-size: 16px;
  font-weight: 800;
  color: #081d38;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.checkout-form-card h3 svg {
  width: 18px;
  height: 18px;
  color: #0077c8;
}

.form-group-block {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
}

.form-label .required {
  color: #ef4444;
}

.form-control-input,
.form-control-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  color: #081d38;
  background: #ffffff;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control-input:focus,
.form-control-textarea:focus {
  border-color: #0077c8;
  background: #f0f9ff;
  box-shadow: 0 0 0 3px rgba(0, 119, 200, 0.12);
}

.checkout-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-submit-order {
  width: 100%;
  background: #0077c8;
  color: #ffffff;
  padding: 13px 20px;
  border-radius: 8px;
  border: none;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 119, 200, 0.25);
  transition: background 0.2s ease, transform 0.15s ease;
  margin-top: 6px;
}

.btn-submit-order:hover {
  background: #005fa3;
}

.btn-submit-order:active {
  transform: scale(0.98);
}

.btn-submit-order svg {
  width: 18px;
  height: 18px;
}

/* Empty State / Success State */
.cart-empty-card,
.order-success-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 60px 24px;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.empty-icon-wrap,
.success-icon-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon-wrap {
  background: #f1f5f9;
  color: #64748b;
}

.success-icon-badge {
  background: #dcfce7;
  color: #16a34a;
}

.empty-icon-wrap svg,
.success-icon-badge svg {
  width: 32px;
  height: 32px;
}

.cart-empty-card h2,
.order-success-card h2 {
  font-size: 22px;
  font-weight: 800;
  color: #081d38;
  margin-bottom: 8px;
}

.cart-empty-card p,
.order-success-card p {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 24px;
  line-height: 1.5;
}

.btn-primary-action {
  background: #0077c8;
  color: #ffffff;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary-action {
  background: #f1f5f9;
  color: #081d38;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #cbd5e1;
}

/* ==========================================================================
   Mobile Responsive Formatting
   ========================================================================== */

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

@media (max-width: 640px) {
  .cart-header-banner {
    padding: 30px 0;
  }

  .cart-header-banner h1 {
    font-size: 24px;
  }

  .cart-items-panel,
  .summary-box,
  .checkout-form-card {
    padding: 20px 16px;
  }

  .cart-items-table thead {
    display: none;
  }

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

  .cart-row-item {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    position: relative;
    gap: 10px;
    box-sizing: border-box;
  }

  .cart-row-item td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    border: none;
    width: 100%;
    box-sizing: border-box;
  }

  .cell-product-info {
    justify-content: flex-start !important;
    gap: 12px;
    padding-bottom: 8px !important;
    padding-right: 32px !important;
    border-bottom: 1px solid #f1f5f9 !important;
  }

  .cart-item-thumb {
    width: 50px;
    height: 50px;
    min-width: 50px;
  }

  .cell-price::before,
  .cell-qty::before,
  .cell-line-total::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
  }

  .cell-line-total {
    padding-top: 8px !important;
    border-top: 1px dashed #e2e8f0 !important;
  }

  .cell-action-remove {
    position: absolute !important;
    top: 12px;
    right: 12px;
    width: auto !important;
  }

  .btn-remove-item {
    background: #fee2e2;
    color: #ef4444;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .btn-remove-item svg {
    width: 13px;
    height: 13px;
  }

  .checkout-row-2 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Custom Floating Toast & Confirmation Modal
   ========================================================================== */

.custom-cart-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: #081d38;
  color: #ffffff;
  padding: 14px 22px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 14px 35px rgba(8, 29, 56, 0.25);
  z-index: 100000;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.custom-cart-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.custom-cart-toast.toast-success {
  border-left: 4px solid #16a34a;
}

.custom-cart-toast.toast-error {
  border-left: 4px solid #ef4444;
}

.custom-cart-toast .toast-icon {
  display: flex;
  align-items: center;
  color: #38bdf8;
}

.custom-cart-toast.toast-success .toast-icon {
  color: #4ade80;
}

.custom-cart-toast .toast-icon svg {
  width: 18px;
  height: 18px;
}

.custom-confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 29, 56, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100010;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.25s ease;
  padding: 20px;
  box-sizing: border-box;
}

.custom-confirm-modal.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.confirm-modal-box {
  background: #ffffff;
  border-radius: 18px;
  padding: 28px 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(8, 29, 56, 0.2);
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-confirm-modal.is-active .confirm-modal-box {
  transform: scale(1);
}

.confirm-icon-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fee2e2;
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.confirm-icon-badge svg {
  width: 24px;
  height: 24px;
}

.confirm-modal-box h3 {
  font-size: 18px;
  font-weight: 800;
  color: #081d38;
  margin-bottom: 8px;
}

.confirm-modal-box p {
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 22px;
}

.confirm-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-confirm-cancel, .btn-confirm-delete {
  flex: 1;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-confirm-cancel {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
}

.btn-confirm-cancel:hover {
  background: #e2e8f0;
}

.btn-confirm-delete {
  background: #ef4444;
  color: #ffffff;
  border: none;
}

.btn-confirm-delete:hover {
  background: #dc2626;
}

@media (max-width: 640px) {
  .custom-cart-toast {
    left: 20px;
    right: 20px;
    bottom: 20px;
    justify-content: center;
  }
}

/* ==========================================================================
   Cart Table Layout & Alignment Stabilizer
   ========================================================================== */

/* Fix table cell alignment and horizontal overflow */
.cart-items-table,
.cart-table {
  width: 100% !important;
  border-collapse: collapse !important;
  table-layout: fixed !important;
}

/* Specific column width allocations */
.cart-items-table th:nth-child(1),
.cart-items-table td:nth-child(1) { width: 44% !important; } /* Product */

.cart-items-table th:nth-child(2),
.cart-items-table td:nth-child(2) { width: 18% !important; white-space: nowrap !important; } /* Unit Price */

.cart-items-table th:nth-child(3),
.cart-items-table td:nth-child(3) { width: 16% !important; } /* Quantity */

.cart-items-table th:nth-child(4),
.cart-items-table td:nth-child(4) { width: 16% !important; white-space: nowrap !important; } /* Subtotal */

.cart-items-table th:nth-child(5),
.cart-items-table td:nth-child(5) { width: 6% !important; text-align: right !important; } /* Action */

/* Fix broken image rendering and force neat thumbnail box */
.cart-item-img-wrap,
.cart-product-img {
  width: 54px !important;
  height: 54px !important;
  min-width: 54px !important;
  border-radius: 10px !important;
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  padding: 4px !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

.cart-item-img-wrap img,
.cart-product-img img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

/* Prevent rupee symbol from wrapping to next line */
.cart-subtotal-val,
.cart-price-val,
.cart-items-table td {
  white-space: nowrap !important;
  word-break: normal !important;
}

/* Quantity Control pill sizing */
.cart-qty-ctrl {
  display: inline-flex !important;
  align-items: center !important;
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  padding: 2px 6px !important;
}

.cart-qty-ctrl input {
  width: 28px !important;
  text-align: center !important;
  border: none !important;
  background: transparent !important;
  font-weight: 700 !important;
}

.cart-qty-ctrl button {
  background: none !important;
  border: none !important;
  cursor: pointer !important;
  font-weight: bold !important;
  padding: 2px 6px !important;
}

/* Trash remove button */
.btn-remove-item {
  color: #94a3b8 !important;
  background: none !important;
  border: none !important;
  cursor: pointer !important;
  transition: color 0.2s ease !important;
  padding: 6px !important;
}

.btn-remove-item:hover {
  color: #ef4444 !important;
}