/*
 * Shopify-Style Checkout - Complete Redesign
 * Mobile-first responsive checkout following e-commerce best practices
 * Two-column layout with sticky order summary
 */

/* ========================================
   0. ANIMATIONS
   ======================================== */

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========================================
   1. LAYOUT FOUNDATION - Two Column Grid
   ======================================== */

.checkout-container {
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* Desktop: Two columns - FULL WIDTH backgrounds attached to edges */
@media (min-width: 992px) {
  /* Form column (left side - white background) */
  .container-fluid .row.g-0 > .col-12.col-lg-6.order-1.order-lg-1,
  .row.g-0 > .col-12.col-lg-6.order-1.order-lg-1,
  .row.g-0 > .col-lg-6.order-lg-1 {
    background-color: #ffffff !important;
    padding: 25px 5% !important;
    min-height: 100vh !important;
    position: relative !important;
    z-index: 1 !important;
    border-right: 1px solid #e5e5e5 !important;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04) !important;
  }

  /* Summary column (right side - grey background) */
  .container-fluid .row.g-0 > .col-12.col-lg-6.order-2.order-lg-2,
  .row.g-0 > .col-12.col-lg-6.order-2.order-lg-2,
  .row.g-0 > .col-lg-6.order-lg-2 {
    background-color: #fafafa !important;
    padding: 25px 5% !important;
    position: sticky;
    top: 0;
    min-height: 100vh;
    overflow-y: visible;
    box-shadow: inset 2px 0 8px rgba(0, 0, 0, 0.02) !important;
  }
}

/* Tablet: Reduce padding but keep layout */
@media (min-width: 768px) and (max-width: 991px) {
  .checkout-form-column {
    padding: 32px 40px;
    order: 2;
  }

  .checkout-summary-column {
    padding: 32px 40px;
    background-color: #fafafa;
    border-top: 1px solid #e5e5e5;
    border-bottom: 1px solid #e5e5e5;
    order: 1;
  }
}

/* Mobile: Stack vertically with minimal padding */
@media (max-width: 767px) {
  .checkout-form-column {
    padding: 20px 16px;
    order: 2;
  }

  .checkout-summary-column {
    padding: 20px 16px;
    background-color: #fafafa;
    border-top: 1px solid #e5e5e5;
    border-bottom: 1px solid #e5e5e5;
    order: 1;
  }
}

/* Unified Card System */
.checkout-card {
  background-color: #ffffff;
  border: 1px solid #e1e1e1;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.checkout-card-title {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

/* Section spacing */
.checkout-section {
  margin-top: 25px;
  margin-bottom: 32px;
}

.checkout-section:last-child {
  margin-bottom: 0;
}

/* Divider lines */
.checkout-divider {
  height: 1px;
  background-color: #e1e1e1;
  margin: 24px 0;
}

/* ========================================
   1. INPUT STYLING - Shopify Exact Copy
   ======================================== */

.checkout-input,
.checkoutform-input-mobile,
.form-control.checkout-enhanced {
  border: 1px solid #ccc !important;
  border-radius: 10px !important;
  padding: 14px 14px !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  min-height: 44px !important;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
  background-color: #ffffff !important;
  font-weight: 400 !important;
}

/* Textarea specific padding */
textarea.form-control.checkout-enhanced,
textarea#additional_notes {
  padding: 14px 14px !important;
  line-height: 1.6 !important;
}

/* Coupon input specific */
#couponCode.checkout-input,
input#couponCode {
  padding: 14px 14px !important;
  line-height: 1.5 !important;
}

.checkout-input:focus,
.checkoutform-input-mobile:focus,
.form-control.checkout-enhanced:focus {
  outline: none !important;
  border-color: #1773b0 !important;
  border-width: 2px !important;
  border-radius: 10px !important;
  box-shadow: 0 0 0 3px rgba(23, 115, 176, 0.15) !important;
}


/* Error state - red border */
.checkout-input.error,
.form-control.checkout-enhanced.error,
.checkout-input.is-invalid,
.form-control.checkout-enhanced.is-invalid {
  border-color: #d72c0d !important;
}

.checkout-input.error:focus,
.form-control.checkout-enhanced.error:focus,
.checkout-input.is-invalid:focus,
.form-control.checkout-enhanced.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(215, 44, 13, 0.1) !important;
}

/* Success state - green border */
.checkout-input.valid,
.form-control.checkout-enhanced.valid,
.checkout-input.is-valid,
.form-control.checkout-enhanced.is-valid {
  border-color: #198754 !important;
}

.checkout-input.valid:focus,
.form-control.checkout-enhanced.valid:focus,
.checkout-input.is-valid:focus,
.form-control.checkout-enhanced.is-valid:focus {
  box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.1) !important;
}

/* Success checkmark */
.checkout-input.valid::after,
.checkout-input.is-valid::after {
  content: '✓';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #198754;
  font-weight: bold;
}

/* ========================================
   2. SECTION HEADERS - Shopify Style
   ======================================== */

.checkout-section {
  margin-bottom: 24px;
}

/* Remove gap from checkout sections - no space between title and fields */
.checkout-section.d-flex.flex-column.gap-2,
.checkout-section.d-flex.flex-column.gap-3,
.checkout-section.d-flex.flex-column.gap-4,
.checkout-section.gap-2,
.checkout-section.gap-3,
.checkout-section.gap-4 {
  gap: 0 !important;
}

/* Form container - reduce spacing between sections */
form.d-flex.flex-column.gap-4,
.d-flex.flex-column.gap-4 {
  gap: 20px !important;
}

/* Main container - reduce spacing */
.h-100.d-flex.flex-column.gap-3,
.d-flex.flex-column.gap-3 {
  gap: 16px !important;
}

.checkout-section-title,
h2.checkout-section-title,
h3.checkout-section-title,
h4.checkout-section-title,
h5.checkout-section-title,
h5.fw-bold {
  margin-top: 0 !important;
  margin-bottom: 0px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  font-size: 1.2rem !important;
  line-height: 1.2 !important;
  font-weight: 600 !important;
  color: black !important;
  letter-spacing: -0.01em;
}

/* Product name in cart - smaller font */
h6.fw-semibold {
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
}

/* Force remove any default h2 spacing in checkout */
.checkout-section h2,
.checkout-section h3,
.checkout-section h4,
.checkout-section h5,
.checkout-section h6 {
  margin: 0 !important;
  padding: 0 !important;
}

.checkout-section-description {
  font-size: 13px;
  color: #6d6d6d;
  margin-bottom: 22px;
  line-height: 1;
}

/* Checkout main row spacing */
.row.g-0 {
  margin-top: 30px !important;
}

/* ========================================
   3. PAYMENT/DELIVERY OPTION CARDS - Clean Minimal Style
   ======================================== */

.payment-option-card,
.delivery-option-card {
  border: 2px solid #e1e1e1 !important;
  border-radius: 8px !important;
  padding: 16px !important;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  margin-bottom: 12px;
  background-color: #ffffff;
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 12px !important;
}

.payment-option-card:hover,
.delivery-option-card:hover {
  border-color: #2c6ecb !important;
  box-shadow: 0 0 0 1px rgba(44, 110, 203, 0.1);
}

.payment-option-card.selected,
.delivery-option-card.selected {
  border-color: #2c6ecb !important;
  background-color: #f7faff !important;
  box-shadow: 0 0 0 1px rgba(44, 110, 203, 0.15);
}

/* Native browser radio buttons - Clean and solid */
.payment-option-card input[type="radio"],
.delivery-option-card input[type="radio"],
.payment-option-card .form-check-input,
.delivery-option-card .form-check-input {
  /* Solid browser radio button */
  appearance: auto !important;
  -webkit-appearance: radio !important;
  -moz-appearance: radio !important;
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  margin-top: 2px !important;
  cursor: pointer !important;
  opacity: 1 !important;
  visibility: visible !important;
  position: relative !important;
  flex-shrink: 0 !important;
  accent-color: #2c6ecb !important;
}

/* RTL support */
html[dir="rtl"] .payment-option-card,
html[dir="rtl"] .delivery-option-card {
  flex-direction: row-reverse !important;
}

/* Card content styling - Clean and organized */
.payment-option-card .flex-grow-1,
.delivery-option-card .flex-grow-1 {
  flex: 1;
  min-width: 0;
}

.payment-option-card .flex-grow-1.ms-2,
.delivery-option-card .flex-grow-1.ms-2 {
  margin-left: 0 !important;
}

.payment-option-card .fw-semibold,
.delivery-option-card .fw-semibold {
  font-size: 15px !important;
  font-weight: 500 !important;
  color: #1a1a1a !important;
  margin-bottom: 0 !important;
  line-height: 1.4 !important;
}

.payment-option-card .text-muted.small,
.delivery-option-card .text-muted.small {
  font-size: 13px !important;
  color: #666 !important;
  margin-top: 4px !important;
  line-height: 1.4 !important;
}

.payment-option-card .d-flex.align-items-center.gap-2,
.delivery-option-card .d-flex.align-items-center.gap-2 {
  gap: 8px !important;
  margin-bottom: 4px !important;
}

.payment-option-card .d-flex.align-items-center.gap-2.mb-2,
.delivery-option-card .d-flex.align-items-center.gap-2.mb-2 {
  margin-bottom: 4px !important;
}

.payment-option-card img,
.delivery-option-card img {
  max-height: 24px !important;
  max-width: 70px !important;
}

/* Hide custom checkmarks */
.payment-checkmark,
.delivery-checkmark {
  display: none !important;
}

/* Required field indicator - only show for required inputs */
.form-floating > input:required ~ label::after,
.form-floating > textarea:required ~ label::after,
.form-floating > select:required ~ label::after,
.checkout-label.required::after {
  content: ' *';
  color: #d72c0d;
  font-weight: 600;
}

/* ========================================
   4. CONTINUE/SUBMIT BUTTON STYLING - Shopify
   ======================================== */

.checkout-continue-button {
  width: 100%;
  padding: 18px 32px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  letter-spacing: 0.03em !important;
  color: var(--v2-button-text-color, #ffffff) !important;
  background-color: var(--v2-button-bg-color, #2c6ecb) !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 56px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(44, 110, 203, 0.25) !important;
  position: relative;
  overflow: hidden;
}

.checkout-continue-button:hover:not(:disabled) {
  background-color: var(--v2-button-bg-color-hover, #1557a0) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(44, 110, 203, 0.35) !important;
}

.checkout-continue-button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(44, 110, 203, 0.3) !important;
}

.checkout-continue-button:disabled {
  background-color: #d9d9d9 !important;
  color: #999999 !important;
  cursor: not-allowed;
  transform: none;
  box-shadow: none !important;
  opacity: 0.6;
}

/* Agreement Section Styling */
.form-check {
  display: flex !important;
  align-items: flex-start !important;
  padding: 18px 20px !important;
  background-color: #f8f9fa;
  border: 2px solid #e1e1e1;
  border-radius: 10px;
  margin-top: 24px !important;
  margin-bottom: 24px !important;
  transition: all 0.2s ease;
  gap: 12px;
}

.form-check:hover {
  background-color: #f0f4f8;
  border-color: #c5d0db;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.form-check-input {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  margin-top: 0px !important;
  margin-right: 0px !important;
  margin-left: 0px !important;
  cursor: pointer !important;
  border: 2px solid #999 !important;
  border-radius: 5px !important;
  flex-shrink: 0 !important;
  transition: all 0.2s ease;
}

.form-check-input:hover {
  border-color: var(--v2-button-bg-color, #2c6ecb) !important;
}

.form-check-input:checked {
  background-color: var(--v2-button-bg-color, #2c6ecb) !important;
  border-color: var(--v2-button-bg-color, #2c6ecb) !important;
  box-shadow: 0 0 0 3px rgba(44, 110, 203, 0.1) !important;
}

.form-check-input:focus {
  box-shadow: 0 0 0 4px rgba(44, 110, 203, 0.2) !important;
  border-color: var(--v2-button-bg-color, #2c6ecb) !important;
  outline: none !important;
}

.form-check-label {
  font-size: 14.5px !important;
  line-height: 1.65 !important;
  color: #2d3748 !important;
  cursor: pointer !important;
  user-select: none;
  margin: 0 !important;
  padding: 0 !important;
  flex: 1;
}

.form-check-label a {
  color: var(--v2-button-bg-color, #2c6ecb) !important;
  text-decoration: underline !important;
  font-weight: 600 !important;
  transition: all 0.2s ease;
  text-underline-offset: 2px;
}

.form-check-label a:hover {
  color: var(--v2-button-bg-color-hover, #1557a0) !important;
  text-decoration-thickness: 2px !important;
}

/* Spacing for agreement + button section */
.d-flex.flex-column.gap-3 {
  margin-top: 32px;
}

/* ========================================
   5. ORDER SUMMARY IMPROVEMENTS - SHOPIFY STYLE
   ======================================== */

.product-thumbnail {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  position: relative;
}

.quantity-badge {
  position: absolute;
  top: -8px;
  left: -8px;
  background-color: var(--v2-button-bg-color, #2c6ecb) !important;
  color: var(--v2-button-text-color, #ffffff) !important;
  border-radius: 50%;
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 13px !important;
  font-weight: 700 !important;
  border: 3px solid #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
  z-index: 10;
  line-height: 1;
}

/* Ensure badge text color is applied */
.quantity-badge,
.quantity-badge > *,
span.quantity-badge {
  color: var(--v2-button-text-color, #ffffff) !important;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 14px;
  color: #303030;
}

.price-row span {
  display: inline-block;
}

.price-row .label {
  color: #6d6d6d;
}

.price-row .value {
  color: #1a1a1a;
  font-weight: 500;
}

.price-row.total {
  border-top: 1px solid #e1e1e1 !important;
  font-weight: 600 !important;
  font-size: 18px !important;
  padding-top: 16px !important;
  margin-top: 12px !important;
  padding-bottom: 4px !important;
  color: #1a1a1a !important;
}

.price-row.total .label,
.price-row.total .value {
  color: #1a1a1a !important;
  font-weight: 600 !important;
}

.checkout-summary-box {
  background-color: #f5f5f5;
  border-color: #e1e1e1 !important;
  border-radius: 5px !important;
  padding: 14px !important;
}

.checkout-summary-title {
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  line-height: 1.0;
}

/* Sticky sidebar for desktop - Shopify style */
@media (min-width: 992px) {
  .sticky-md-top {
    position: sticky !important;
    top: 0 !important;
    max-height: 100vh;
    overflow-y: auto;
  }

  .checkout-summary-box {
    background-color: #f5f5f5;
    border: 1px solid #e5e5e5 !important;
  }
}

/* Coupon code input - Responsive layout */
@media (max-width: 575px) {
  .mb-3 .d-flex.align-items-stretch.gap-2 {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .mb-3 .d-flex.align-items-stretch.gap-2 .form-floating {
    width: 100% !important;
  }

  .mb-3 .d-flex.align-items-stretch.gap-2 button {
    width: 100% !important;
  }

  /* Add spacing to bottom summary box to avoid tab bar overlap */
  .checkout-summary-box-bottom {
    margin-bottom: 80px !important;
    padding-bottom: 40px !important;
  }

  /* Hide back to top button on mobile checkout */
  .back-to-top,
  #back-to-top,
  .scroll-to-top,
  .backtotop,
  #backtotop,
  #goTop,
  button#goTop,
  [class*="back-to-top"],
  [id*="back-to-top"],
  [class*="backtotop"],
  [id*="backtotop"],
  [class*="scroll-top"],
  [id*="scroll-top"],
  a[href="#top"],
  button[onclick*="scrollTo"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* Mobile toggle header - Show total */
.cart-mobile-header-toggle {
  cursor: pointer;
  padding: 8px 0 !important;
  border-bottom: 1px solid #e5e5e5;
  transition: background-color 0.2s ease;
}

.cart-mobile-header-toggle:hover {
  background-color: #f9f9f9;
}

.cart-mobile-total-display {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
}

.cart-mobile-header-toggle {
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* ========================================
   6. ERROR MESSAGES
   ======================================== */

.checkout-error-message {
  margin-top: 6px;
  font-size: 13px;
  color: #d72c0d;
  display: flex;
  align-items: center;
  gap: 4px;
}

.checkout-error-message::before {
  content: '⚠';
  font-size: 14px;
}

/* ========================================
   7. LABEL STYLING - Above Inputs
   ======================================== */

.checkout-label,
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: #333333;
  margin-bottom: 8px;
  display: block;
  letter-spacing: 0.01em;
}

.checkout-label.required::after,
.form-label.required::after {
  content: ' *';
  color: #d72c0d;
  font-weight: 600;
}

/* ========================================
   8. FIELD WRAPPER - Proper Spacing
   ======================================== */

.checkout-field,
.form-group {
  margin-bottom: 16px;
  position: relative;
}

.checkout-field:last-child,
.form-group:last-child {
  margin-bottom: 0;
}

/* Field with validation message */
.checkout-field.has-error .checkout-label,
.form-group.has-error .form-label {
  color: #d72c0d;
}

.checkout-field.has-success .checkout-label,
.form-group.has-success .form-label {
  color: #198754;
}

/* ========================================
   8.5. CHECKOUT STEPS BREADCRUMB
   ======================================== */

.checkout-breadcrumb {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e1e1e1;
}

.checkout-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #999;
  text-decoration: none;
  transition: color 0.2s ease;
}

.checkout-step.active {
  color: #1a1a1a;
  font-weight: 600;
}

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

.checkout-step.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.checkout-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #e1e1e1;
  color: #6d6d6d;
  font-size: 12px;
  font-weight: 600;
}

.checkout-step.active .checkout-step-number {
  background-color: var(--v2-primary-color, #2c6ecb);
  color: #ffffff;
}

.checkout-step.completed .checkout-step-number {
  background-color: #198754;
  color: #ffffff;
}

.checkout-step.completed .checkout-step-number::before {
  content: '✓';
}

.checkout-breadcrumb-separator {
  color: #d0d0d0;
  font-size: 18px;
}

/* Tighter spacing within sections */
.checkout-section .form-floating,
.checkout-section .d-flex.flex-column {
  margin-bottom: 12px !important;
}

.checkout-section .w-100 {
  margin-bottom: 12px !important;
}

/* Row gaps - compact like Shopify */
.checkout-section .row {
  row-gap: 12px !important;
}

/* ========================================
   9. MOBILE OPTIMIZATIONS - ULTRA COMPACT
   ======================================== */

@media (max-width: 768px) {
  .checkout-continue-button {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
    padding: 12px 20px !important;
  }

  .checkout-input,
  .checkoutform-input-mobile,
  .form-control.checkout-enhanced {
    font-size: 16px !important; /* Critical for iOS - prevents zoom */
    padding: 10px 12px !important;
    min-height: 44px !important;
  }

  .checkout-section {
    margin-bottom: 16px !important;
  }

  .checkout-section-title {
    font-size: 1.1rem !important;
    line-height: 1.2 !important;
    font-weight: 600 !important;
    color: black !important;
    margin-bottom: 6px !important;
  }

  .payment-option-card,
  .delivery-option-card {
    padding: 10px !important;
    margin-bottom: 8px !important;
  }

  .price-row {
    padding: 4px 0 !important;
    font-size: 13px !important;
    line-height: 1 !important;
    min-height: 24px !important;
  }

  .price-row.total {
    padding-top: 8px !important;
    margin-top: 5px !important;
    font-size: 15px !important;
    min-height: 30px !important;
  }

  .checkout-summary-box {
    padding: 12px !important;
  }

  /* Tighter mobile spacing */
  .container-fluid {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .p-3, .px-3, .py-3 {
    padding: 12px !important;
  }

  .p-2, .px-2, .py-2 {
    padding: 8px !important;
  }

  .mb-3 {
    margin-bottom: 8px !important;
  }

  .gap-3 {
    gap: 8px !important;
  }

  .gap-2 {
    gap: 6px !important;
  }

  /* Mobile form field spacing */
  .form-floating {
    margin-bottom: 10px !important;
  }

  .w-100 {
    margin-bottom: 10px !important;
  }

  /* Hide desktop order summary on mobile */
  .shoppingcartui-cart-bg.d-none.d-lg-block {
    display: none !important;
  }
}

/* ========================================
   SHOPIFY TIGHT SPACING - Global Overrides
   ======================================== */

/* Reduce gap between form sections */
.d-flex.flex-column.gap-4 {
  gap: 20px !important;
}

.d-flex.flex-column.gap-3 {
  gap: 12px !important;
}

.d-flex.flex-column.gap-2 {
  gap: 10px !important;
}

/* Compact padding on containers */
.container-fluid .py-2 {
  padding-top: 12px !important;
  padding-bottom: 12px !important;
}

/* Tighter margins */
.mb-3 {
  margin-bottom: 12px !important;
}

.mb-4 {
  margin-bottom: 20px !important;
}

/* Form labels - smaller, less space */
.form-floating > label {
  font-size: 13px !important;
  color: #6d6d6d !important;
  padding: 11px 12px !important;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
  transform: scale(0.85) translateY(-0.6rem) translateX(0.15rem) !important;
  color: #6d6d6d !important;
}

/* Remove excessive Bootstrap spacing */
.border.rounded {
  border-radius: 5px !important;
}

.rounded-3 {
  border-radius: 5px !important;
}

.rounded-4 {
  border-radius: 5px !important;
}

/* ========================================
   10. SELECT/DROPDOWN STYLING
   ======================================== */

select.checkout-input,
select.form-control.checkout-enhanced {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px !important;
}

/* ========================================
   11. COLOR SYSTEM INTEGRATION
   ======================================== */

:root {
  --checkout-primary: var(--v2-primary-color, #000000);
  --checkout-link: var(--v2-link-color, #1773b0);
  --checkout-button-bg: var(--v2-button-bg-color, #000000);
  --checkout-button-text: var(--v2-button-text-color, #ffffff);
  --checkout-border: #d9d9d9;
  --checkout-error: #d72c0d;
}

/* Shopify blue focus for all form inputs */
.form-control:focus,
.form-select:focus,
input.form-control:focus,
textarea.form-control:focus,
select.form-control:focus,
select.form-select:focus,
.form-floating > .form-control:focus,
.form-floating > input:focus,
.form-floating > select:focus,
.form-floating > textarea:focus {
  border-color: #1773b0 !important;
  border-width: 2px !important;
  border-radius: 10px !important;
  box-shadow: 0 0 0 3px rgba(23, 115, 176, 0.15) !important;
  outline: none !important;
}

/* Shopify blue for floating labels when focused */
.form-floating > .form-control:focus ~ label,
.form-floating > input:focus ~ label,
.form-floating > select:focus ~ label,
.form-floating > textarea:focus ~ label {
  color: #1773b0 !important;
}

/* ========================================
   12. SMOOTH TRANSITIONS
   ======================================== */

* {
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  touch-action: manipulation;
}

/* ========================================
   13. FLOATING LABEL OVERRIDE (OPTIONAL)
   ======================================== */

.form-floating.checkout-enhanced > label {
  font-size: 14px;
  color: #737373;
}

.form-floating.checkout-enhanced > .form-control:focus ~ label,
.form-floating.checkout-enhanced > .form-control:not(:placeholder-shown) ~ label {
  color: #1773b0;
}

/* ========================================
   14. LOADING STATE
   ======================================== */

.checkout-continue-button.loading {
  position: relative;
  color: transparent !important;
}

.checkout-continue-button.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: checkout-spinner 0.6s linear infinite;
}

@keyframes checkout-spinner {
  to { transform: rotate(360deg); }
}

/* ========================================
   15. TRUST & SECURITY INDICATORS
   ======================================== */

.checkout-security-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background-color: #f0f7ff;
  border: 1px solid #d0e7ff;
  border-radius: 6px;
  margin-bottom: 24px;
  font-size: 13px;
  color: #1a1a1a;
}

.checkout-security-badge .icon {
  color: #198754;
  font-size: 18px;
}

.checkout-security-badge .lock-icon::before {
  content: '🔒';
}

.payment-methods-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e1e1e1;
}

.payment-method-icon {
  width: 40px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  background-color: #ffffff;
  font-size: 10px;
  color: #6d6d6d;
  font-weight: 600;
}

.checkout-trust-text {
  font-size: 12px;
  color: #6d6d6d;
  text-align: center;
  margin-top: 16px;
}

/* ========================================
   16. MOBILE COLLAPSIBLE ORDER SUMMARY
   ======================================== */

@media (max-width: 991px) {
  .checkout-summary-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background-color: #fafafa;
    border: none;
    border-bottom: 1px solid #e1e1e1;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s ease;
  }

  .checkout-summary-toggle:hover {
    background-color: #f5f5f5;
  }

  .checkout-summary-toggle-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--v2-primary-color, #2c6ecb);
  }

  .checkout-summary-toggle-icon {
    transition: transform 0.3s ease;
  }

  .checkout-summary-toggle.expanded .checkout-summary-toggle-icon {
    transform: rotate(180deg);
  }

  .checkout-summary-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .checkout-summary-content.expanded {
    max-height: 2000px;
  }

  /* Sticky CTA at bottom on mobile */
  .checkout-mobile-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #ffffff;
    border-top: 1px solid #e1e1e1;
    padding: 12px 16px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
  }

  body.has-mobile-cta {
    padding-bottom: 80px;
  }
}

/* ========================================
   17. PRODUCT ROW IN ORDER SUMMARY
   ======================================== */

.cart-product-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e1e1e1;
}

.cart-product-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.cart-product-image-wrapper {
  position: relative;
  flex-shrink: 0;
}

.cart-product-thumbnail {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e1e1e1;
}

.cart-product-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Product cell organization */
.cart-product-name {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1.4;
  margin: 0 0 4px 0;
}

.cart-product-variant {
  font-size: 12px;
  color: #6d6d6d;
  margin: 0 0 4px 0;
}

.cart-product-quantity {
  font-size: 12px;
  color: #6d6d6d;
}

.cart-product-price {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  text-align: right;
  flex-shrink: 0;
}

/* SKU styling */
.text-muted.small {
  font-size: 11px !important;
  color: #999 !important;
  margin-bottom: 6px !important;
}

/* Remove button styling */
.delete-btn-enhanced {
  font-size: 12px !important;
  text-decoration: none !important;
  font-weight: 500 !important;
  margin-top: 4px !important;
  display: inline-block !important;
}

.delete-btn-enhanced:hover {
  text-decoration: underline !important;
}

/* Quantity controls spacing */
.qty-controls {
  margin-top: 8px !important;
}

/* Product options styling */
.small.text-muted {
  line-height: 1.4 !important;
  margin-bottom: 2px !important;
}

/* ========================================
   18. PROMO CODE IN ORDER SUMMARY
   ======================================== */

.checkout-promo-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e1e1e1;
}

.checkout-promo-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  font-size: 14px;
  color: var(--v2-link-color, #2c6ecb);
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.checkout-promo-toggle:hover {
  opacity: 0.8;
}

.checkout-promo-toggle-icon {
  transition: transform 0.3s ease;
}

.checkout-promo-toggle.expanded .checkout-promo-toggle-icon {
  transform: rotate(180deg);
}

.checkout-promo-input-wrapper {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.checkout-promo-input {
  flex: 1;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  min-height: 40px;
}

.checkout-promo-input:focus {
  outline: none;
  border-color: #1773b0;
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(23, 115, 176, 0.15);
}

.checkout-promo-button {
  padding: 10px 20px;
  background-color: #f0f0f0;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.checkout-promo-button:hover {
  background-color: #e5e5e5;
}

.checkout-promo-message {
  margin-top: 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.checkout-promo-message.success {
  color: #198754;
}

.checkout-promo-message.error {
  color: #d72c0d;
}

/* ========================================
   19. SMOOTH TRANSITIONS & ANIMATIONS
   ======================================== */

/* Smooth step transitions */
.checkout-step-content {
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Order summary update animation */
.price-row.updating {
  animation: pulse 0.5s ease;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Field focus animation */
.checkout-input,
.form-control.checkout-enhanced {
  transition: all 0.2s ease;
}

/* Validation feedback slide */
.checkout-error-message,
.checkout-success-message {
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   20. RTL SUPPORT ENHANCEMENTS
   ======================================== */

html[dir="rtl"] .checkout-breadcrumb {
  flex-direction: row-reverse;
}

html[dir="rtl"] .checkout-step {
  flex-direction: row-reverse;
}

html[dir="rtl"] .cart-product-row {
  flex-direction: row-reverse;
}

html[dir="rtl"] .cart-product-price {
  text-align: left;
}

html[dir="rtl"] .checkout-promo-toggle {
  flex-direction: row-reverse;
}

html[dir="rtl"] .checkout-security-badge {
  flex-direction: row-reverse;
}

html[dir="rtl"] .payment-methods-icons {
  flex-direction: row-reverse;
}

html[dir="rtl"] .checkout-input.valid::after,
html[dir="rtl"] .checkout-input.is-valid::after {
  right: auto;
  left: 12px;
}

/* ========================================
   21. PAYMENT/DELIVERY OPTIONS IMPROVEMENTS
   ======================================== */

.option-card-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.option-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
  border-radius: 6px;
  flex-shrink: 0;
}

.option-card-details {
  flex: 1;
}

.option-card-title {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 2px;
}

.option-card-description {
  font-size: 12px;
  color: #6d6d6d;
  margin: 0;
}

.option-card-price {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  flex-shrink: 0;
}

/* Conditional fields reveal */
.option-conditional-fields {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, margin-top 0.3s ease;
}

.option-conditional-fields.visible {
  max-height: 500px;
  margin-top: 16px;
}

/* ========================================
   22. AUTO-SCROLL TO ERROR
   ======================================== */

.checkout-field.has-error {
  scroll-margin-top: 100px;
}

/* ========================================
   23. CONTENT CLEANUP - MINIMAL DESIGN
   ======================================== */

.checkout-minimal {
  max-width: 100%;
}

.checkout-minimal .unnecessary-text {
  display: none;
}

.checkout-minimal h1,
.checkout-minimal h2,
.checkout-minimal h3 {
  margin-top: 0;
}

/* Remove excessive decorations */
.checkout-minimal .decorative-element {
  display: none;
}

/* Focus on essentials */
.checkout-essential-only .optional-content {
  display: none;
}

/* ========================================
   24. ENHANCED BACKGROUNDS - BORDERS & SHADOWS
   ======================================== */

@media (min-width: 992px) {
  /* Add subtle border between white and grey sections */
  .row.g-0 > .col-lg-6.order-lg-1 {
    border-right: 1px solid #e5e5e5;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.02);
  }

  /* Enhanced grey background section */
  .row.g-0 > .col-lg-6.order-lg-2 {
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.02);
  }


  /* Enhanced summary box on grey background */
  .checkout-summary-box,
  .border-start.border-2.border-light-subtle {
    background-color: #ffffff;
    border: 1px solid #e1e1e1 !important;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04),
                0 1px 3px rgba(0, 0, 0, 0.02);
    padding: 20px !important;
  }

  /* Form sections on white background - subtle cards */
  .payment-option-card,
  .delivery-option-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }

  .payment-option-card:hover,
  .delivery-option-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  }

  .payment-option-card.selected,
  .delivery-option-card.selected {
    box-shadow: 0 2px 8px rgba(44, 110, 203, 0.12);
  }
}
