/* ============================================
   CHECKOUT LAYOUT - CSS GRID (erzwingt 2 Spalten)
   ============================================ */

body.woocommerce-checkout .su-checkout-wrapper,
body.woocommerce-checkout form.checkout,
body.woocommerce-checkout .su-cart-layout {
  overflow: visible !important;
}

/* Zwei-Spalten ab 992px: Links = 1fr, Rechts = 380px */
@media (min-width: 992px) {
  body.woocommerce-checkout .su-cart-layout,
  body.woocommerce-checkout form.checkout .su-cart-layout {
    display: grid !important;
    grid-template-columns: 1fr 380px !important;
    grid-template-areas: "main sidebar" !important;
    gap: 2rem !important;
    align-items: start !important;
  }

  body.woocommerce-checkout .su-cart-main {
    grid-area: main !important;
    min-width: 0 !important;
  }

  body.woocommerce-checkout .su-cart-sidebar {
    grid-area: sidebar !important;
    width: 380px !important;
    position: sticky !important;
    top: 1rem !important;
    margin-top: 0 !important;
    align-self: flex-start !important;
  }

  /* Sticky-Bereich: wenig Abstand oben (wie Cart-Seite) */
  body.woocommerce-checkout .su-cart-sidebar .su-cart-sidebar-inner,
  body.woocommerce-checkout .su-cart-sidebar .su-checkout-summary {
    margin-top: 0 !important;
  }

  body.woocommerce-checkout .content_wrap,
  body.woocommerce-checkout .content,
  body.woocommerce-checkout .su-checkout-main,
  body.woocommerce-checkout .su-checkout-wrapper,
  body.woocommerce-checkout form.checkout {
    overflow: visible !important;
  }
}

body.woocommerce-checkout .su-cart-layout {
  display: flex !important;
  flex-direction: column !important;
  gap: 2rem !important;
  width: 100% !important;
}

/* Theme-Floats überschreiben – unser Grid/Flex hat Vorrang */
body.woocommerce-checkout .su-cart-main,
body.woocommerce-checkout .su-cart-sidebar,
body.woocommerce-checkout #customer_details,
body.woocommerce-checkout #order_review {
  float: none !important;
}

/* Mobile: 1 Spalte, Zusammenfassung ganz UNTEN */
@media (max-width: 991px) {
  body.woocommerce-checkout .su-cart-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
  }

  body.woocommerce-checkout .su-cart-main {
    order: 1 !important;
  }

  body.woocommerce-checkout .su-cart-sidebar {
    order: 2 !important;
    width: 100% !important;
    position: static !important; /* NICHT sticky auf Mobile/Tablet */
    top: auto !important;
  }

  body.woocommerce-checkout .su-checkout-main {
    padding: 1rem 0.75rem !important;
  }

  body.woocommerce-checkout .su-checkout-card,
  body.woocommerce-checkout .su-cart-sidebar-inner {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  body.woocommerce-checkout .su-checkout-section-title {
    margin-bottom: 0.75rem !important;
    padding-bottom: 0.5rem !important;
    font-size: 0.75rem !important;
  }

  body.woocommerce-checkout .su-checkout-form .form-row {
    margin-bottom: 0.625rem !important;
  }
}

/* Main container – vereinheitlicht mit Cart (su-cart-main-wrap) */
.su-checkout-main,
body.woocommerce-checkout .su-checkout-main {
  max-width: 80rem !important;
  margin: 0 auto !important;
  padding: 2rem 1rem !important;
  width: 100% !important;
}

/* Linke Spalte: alle Boxen EINHEITLICH volle Breite */
body.woocommerce-checkout .su-cart-main {
  display: flex !important;
  flex-direction: column !important;
  overflow-wrap: break-word !important;
  width: 100% !important;
  max-width: 100% !important;
}

body.woocommerce-checkout .su-cart-main > *,
body.woocommerce-checkout .su-cart-main .su-checkout-card,
body.woocommerce-checkout .su-cart-main .su-checkout-order-items,
body.woocommerce-checkout .su-cart-main .su-checkout-payment-section,
body.woocommerce-checkout .su-cart-main .woocommerce-billing-fields,
body.woocommerce-checkout .su-cart-main .shipping_address,
body.woocommerce-checkout .su-cart-main #payment,
body.woocommerce-checkout .su-cart-main .su-checkout-order-notes,
body.woocommerce-checkout .su-cart-main #customer_details,
body.woocommerce-checkout .su-cart-main #dokan-delivery-time-box,
body.woocommerce-checkout .su-cart-main section {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

body.woocommerce-checkout .su-cart-main .col-1,
body.woocommerce-checkout .su-cart-main .col-2,
body.woocommerce-checkout .su-cart-main #customer_details .col-1,
body.woocommerce-checkout .su-cart-main #customer_details .col-2 {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 100% !important;
  float: none !important;
  display: block !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
}

/* col-1 + customer_details: gleiche Breite wie su-checkout-payment-section */
body.woocommerce-checkout form.checkout #customer_details,
body.woocommerce-checkout .su-cart-main #customer_details,
body.woocommerce-checkout .su-cart-main #customer_details .col-1,
body.woocommerce-checkout .su-cart-main .woocommerce-billing-fields {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.woocommerce-checkout .su-cart-main .col2-set,
body.woocommerce-checkout .su-cart-main #customer_details,
body.woocommerce-checkout .su-cart-main .su-checkout-form-fields {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
}

body.woocommerce-checkout .su-cart-main .col2-set .col-1,
body.woocommerce-checkout .su-cart-main .col2-set .col-2 {
  width: 100% !important;
  float: none !important;
  display: block !important;
}

/* Lieferadresse: Vorname/Nachname und PLZ/Stadt nebeneinander */
body.woocommerce-checkout .su-cart-main .col-2 .su-checkout-form-row-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 1rem !important;
}

body.woocommerce-checkout .su-cart-main .col-2 .su-checkout-form-row-grid .form-row-wide {
  grid-column: 1 / -1 !important;
}

body.woocommerce-checkout .su-cart-main .col-1 .su-checkout-form-row-grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 1rem !important;
}

@media (max-width: 639px) {
  body.woocommerce-checkout .su-cart-main .col-2 .su-checkout-form-row-grid {
    grid-template-columns: 1fr !important;
  }
}

body.woocommerce-checkout .su-cart-main .su-checkout-payment-methods,
body.woocommerce-checkout .su-cart-main #payment {
  display: block !important;
  width: 100% !important;
}

body.woocommerce-checkout .su-cart-main .su-checkout-payment-methods .wc_payment_method {
  width: 100% !important;
  float: none !important;
  display: block !important;
}

/* Sticky Sidebar – geringer Abstand nach oben, vollständig sichtbar */
body.woocommerce-checkout .su-cart-sidebar {
  top: 1rem !important;
}

body.woocommerce-checkout .su-cart-main > * {
  width: 100% !important;
  max-width: 100% !important;
}

body.woocommerce-checkout .su-cart-main .form-row {
  width: 100% !important;
  float: none !important;
  display: block !important;
}

body.woocommerce-checkout .su-cart-main .form-row.form-row-first,
body.woocommerce-checkout .su-cart-main .form-row.form-row-last {
  width: 100% !important;
  float: none !important;
}

/* Hide duplicate step bars from theme/plugins */
.woocommerce-breadcrumb,
.woocommerce_status_bar,
.woocommerce-products-header,
.store-kit-checkout-steps {
  display: none !important;
}

/* Redundante Überschriften vor Order Review ausblenden */
.su-cart-sidebar > h2,
.su-cart-sidebar > h3,
.su-cart-sidebar #order_review_heading,
.su-cart-sidebar .woocommerce-checkout-review-order > h3 {
  display: none !important;
}

/* Hide payment info in right column if it leaks there */
.su-cart-sidebar .woocommerce-checkout-payment,
.su-cart-sidebar #payment {
  display: none !important;
}

/* AGB + Place Order NUR in Sidebar – in linker Spalte ausblenden */
body.woocommerce-checkout .su-cart-main #payment .form-row.place-order,
body.woocommerce-checkout .su-cart-main .form-row.place-order {
  display: none !important;
}

/* Hide default WC table in our layout if it appears as a table */
.su-checkout-wrapper table.woocommerce-checkout-review-order-table {
  display: none;
}

/* Ensure our custom div-based review order is visible */
.su-checkout-wrapper div.woocommerce-checkout-review-order-table {
  display: block !important;
}

/* Order review / Zusammenfassung: wie Cart-Sidebar, keine Layout-Sprünge */
body.woocommerce-checkout #order_review {
  width: 100% !important;
  min-width: 0 !important;
}

body.woocommerce-checkout .su-cart-sidebar #order_review,
body.woocommerce-checkout .su-cart-sidebar .su-checkout-order-review {
  display: block !important;
  width: 100% !important;
}

/* ============================================
   KOMPAKTERE ABSTÄNDE
   ============================================ */

/* Cards: weniger margin-bottom */
.su-checkout-card {
  margin-bottom: 1.25rem !important;
  padding: 1.25rem 1.5rem !important;
}

/* Kontaktinformation + Lieferadresse: gleiches Padding */
body.woocommerce-checkout .woocommerce-billing-fields.su-checkout-card,
body.woocommerce-checkout .shipping_address.su-checkout-card {
  padding: 1.25rem 1.5rem !important;
  margin-bottom: 1.25rem !important;
}

/* Section titles: kompakter */
.su-checkout-section-title {
  margin-bottom: 1rem !important;
  padding-bottom: 0.75rem !important;
  font-size: 0.8125rem !important;
}

/* Order items: weniger padding */
.su-checkout-order-items .su-checkout-item {
  padding: 1rem 0 !important;
  gap: 1rem !important;
}

/* Produktbild kleiner */
.su-checkout-item-img {
  width: 4.5rem !important;
  height: 4.5rem !important;
}

/* Coupon note: kompakter */
.su-checkout-coupon-note {
  margin-top: 1rem !important;
  padding-top: 0.75rem !important;
  font-size: 0.6875rem !important;
}

/* Form rows: weniger margin */
.su-checkout-form .form-row {
  margin-bottom: 0.75rem !important;
}

/* Eingabefelder: weniger padding */
body.woocommerce-checkout .su-checkout-form input[type="text"],
body.woocommerce-checkout .su-checkout-form input[type="email"],
body.woocommerce-checkout .su-checkout-form input[type="tel"],
body.woocommerce-checkout .su-checkout-form select,
body.woocommerce-checkout .su-checkout-form textarea,
body.woocommerce-checkout .woocommerce-input-wrapper input,
body.woocommerce-checkout .woocommerce-input-wrapper select {
  padding: 0.5rem 0.75rem !important;
}

/* Payment methods: kompakter */
.su-checkout-payment-methods .wc_payment_method {
  margin-bottom: 0.5rem !important;
}

.woocommerce-checkout #payment ul.payment_methods {
  padding: 0 !important;
}

.su-checkout-payment-methods label,
.su-checkout-payment-methods .su-checkout-payment-label {
  padding: 0.875rem 1rem !important;
}

/* Duplikat-Anmerkungen ausblenden - nur EINE unter Zahlungsmethode */
.woocommerce-additional-fields:not(.su-checkout-order-notes),
#customer_details .woocommerce-additional-fields,
.col-2 .woocommerce-additional-fields,
.woocommerce-shipping-fields + .woocommerce-additional-fields,
/* Zweites Vorkommen ausblenden */
.su-checkout-order-notes ~ .su-checkout-order-notes,
.su-checkout-payment-section ~ .woocommerce-additional-fields {
  display: none !important;
}

/* Order notes nach Zahlungsmethode */
.su-checkout-order-notes {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--su-checkout-border, #e2e8f0);
}

.su-checkout-order-notes .form-row {
  margin-bottom: 0 !important;
}

.su-checkout-order-notes label {
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  color: #64748b !important;
  margin-bottom: 0.5rem !important;
  display: block !important;
}

.su-checkout-order-notes textarea {
  min-height: 60px !important;
  resize: vertical !important;
}

/* Summary card: kompakter */
.su-checkout-summary-title {
  margin-bottom: 1rem !important;
  padding-bottom: 0.5rem !important;
}

.su-checkout-summary-row {
  margin-bottom: 0.75rem !important;
}

.su-checkout-summary-total {
  padding-top: 1rem !important;
  margin-top: 1rem !important;
}

.su-checkout-summary-actions {
  margin-top: 1rem !important;
}

/* Trust badges: kompakter */
.su-checkout-trust {
  margin-top: 1.5rem !important;
  padding-top: 1rem !important;
}

.su-checkout-trust-item {
  margin-bottom: 0.75rem !important;
}

/* ============================================
   COMPACT PRODUCT META (INLINE)
   ============================================ */
.su-checkout-item-meta, 
.su-checkout-item-qty {
  display: inline !important;
  margin-top: 0.25rem !important;
  font-size: 0.75rem !important;
  color: #64748b !important;
  line-height: 1.4 !important;
}

.su-checkout-item-meta dl.variation {
  display: inline !important;
  border: none !important;
  margin: 0 !important;
}

.su-checkout-item-meta dt,
.su-checkout-item-meta dd, 
.su-checkout-item-meta dd p {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
}

.su-checkout-item-meta dt {
  font-weight: 600 !important;
  margin-right: 0.25em !important;
  clear: none !important;
}

.su-checkout-item-meta dd {
  margin-right: 0.75em !important;
}

/* Separator styling for quantity if it follows meta */
.su-checkout-item-qty::before {
  content: "|";
  margin: 0 0.5em;
  opacity: 0.5;
}

.su-checkout-item-qty {
  text-transform: none !important;
}

/* ============================================
   ZUSÄTZLICHE OPTIMIERUNGEN
   ============================================ */

/* Zahlungsmethode: Äußere Box (Card) */
.su-checkout-payment-section {
  background: var(--su-checkout-card-bg, #ffffff) !important;
  padding: 1.25rem 1.5rem !important;
  border-radius: 8px !important;
  border: 1px solid var(--su-checkout-border, #e2e8f0) !important;
  margin-bottom: 1.25rem !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

/* Zahlungsmethode: Box in Box - Expandierter Inhalt (IBAN, SEPA etc.) */
.su-checkout-payment-methods .payment_box {
  margin-top: 0.75rem !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding: 1rem 1.25rem !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  font-size: 0.8125rem !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}

/* Payment labels: Äußere Box */
.su-checkout-payment-methods .wc_payment_method > label,
.su-checkout-payment-methods .su-checkout-payment-label {
  border-radius: 6px !important;
  margin-bottom: 0.5rem !important;
}

/* Wenn Payment innerhalb einer Card liegt: keine Doppel-Rahmen */
.su-checkout-payment-section .su-checkout-payment-methods,
.su-checkout-payment-section #payment {
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  margin: 0 !important;
}

/* Datenschutz-Text kleiner */
.woocommerce-privacy-policy-text,
body.woocommerce-checkout .woocommerce-privacy-policy-text {
  font-size: 0.75rem !important;
  line-height: 1.4 !important;
  color: #64748b !important;
  margin-bottom: 0.75rem !important;
}

.woocommerce-privacy-policy-text p,
body.woocommerce-checkout .woocommerce-privacy-policy-text p {
  font-size: inherit !important;
  margin: 0 0 0.5rem 0 !important;
}

/* Firmenname ausblenden (Fallback falls Filter nicht greift) */
body.woocommerce-checkout #shipping_company_field,
body.woocommerce-checkout #billing_company_field {
  display: none !important;
}

/* Lieferadresse Checkbox Label styling */
#ship-to-different-address label {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  cursor: pointer !important;
  font-size: 0.875rem !important;
}

#ship-to-different-address input[type="checkbox"] {
  width: 1rem !important;
  height: 1rem !important;
  accent-color: var(--su-checkout-primary, #f0527b) !important;
}

/* Smooth transitions */
.su-checkout-card,
.su-checkout-payment-methods label,
.su-checkout-place-order {
  transition: all 0.2s ease !important;
}

/* Focus states für bessere Accessibility */
.su-checkout-form input:focus,
.su-checkout-form select:focus,
.su-checkout-form textarea:focus {
  outline: none !important;
  border-color: var(--su-checkout-primary, #f0527b) !important;
  box-shadow: 0 0 0 3px rgba(240, 82, 123, 0.1) !important;
}

/* Select2 Dropdown styling (für Land-Auswahl) */
.select2-container--default .select2-selection--single {
  height: auto !important;
  padding: 0.5rem 0.75rem !important;
  border: 1px solid var(--su-checkout-border, #e2e8f0) !important;
  border-radius: 4px !important;
  background: var(--su-checkout-input-bg, #f1f5f9) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 1.5 !important;
  padding: 0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100% !important;
  right: 0.75rem !important;
}

/* Responsive: Mobile Optimierungen */
@media (max-width: 767px) {
  .su-checkout-card {
    padding: 1rem !important;
  }
  
  .su-checkout-item-img {
    width: 3.5rem !important;
    height: 3.5rem !important;
  }
  
  .su-checkout-item-meta,
  .su-checkout-item-qty {
    font-size: 0.6875rem !important;
  }
  
  .su-checkout-section-title {
    font-size: 0.75rem !important;
  }
}
