/**
 * AutoHVAC Mobile Responsive CSS
 * Added 2026-06-02 as part of mobile responsiveness workflow (Steps 1-10).
 * Enqueued from autohvac-core.php.
 * Targets narrow viewports (< 768px) for improved mobile experience.
 * All changes are additive/override only; desktop unaffected.
 * Reversible by removing the enqueue or the file.
 */

@media (max-width: 767px) {
  /* Prevent horizontal scroll and constrain layout */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* Header / top bar: make search full width, improve stacking */
  header, .site-header, #masthead {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  .search-form,
  input[type="search"] {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 8px !important;
  }
  /* Nav buttons row: allow wrap or horizontal scroll if many */
  .main-navigation ul,
  .nav-menu,
  .category-bar,
  .top-nav-buttons {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }
  .main-navigation a,
  .nav-menu a,
  button.nav-button,
  .black-pill,
  .nav-pill {
    min-height: 40px !important; /* better tap target */
    padding: 8px 12px !important;
    font-size: 14px !important;
    white-space: nowrap !important;
  }

  /* Category pills / circles: horizontal scrollable on very narrow */
  .category-pills,
  .category-bar,
  .sub-category-row {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: nowrap !important;
    padding-bottom: 8px !important;
  }
  .category-pill,
  .category-item {
    display: inline-block !important;
    min-width: 70px !important;
    margin-right: 8px !important;
  }

  /* Hero / banner images: constrain height on mobile */
  .hero,
  .hero-image,
  .wp-block-cover,
  .main-hero {
    max-height: 220px !important;
    min-height: 140px !important;
  }
  .hero .wp-block-cover__inner-container,
  .hero-content {
    padding: 12px !important;
  }

  /* Product grids / cards */
  .products,
  .product-grid,
  .woocommerce ul.products,
  .archive-products {
    grid-template-columns: 1fr !important; /* single column on narrow */
    gap: 12px !important;
  }
  .product-card,
  .woocommerce ul.products li.product {
    padding: 8px !important;
  }
  .product-image img {
    max-height: 160px !important;
    object-fit: contain !important;
  }

  /* WooCommerce cart / checkout / account forms */
  .woocommerce-cart-form,
  .woocommerce-checkout,
  .woocommerce-MyAccount-content,
  table.cart,
  .shop_table {
    width: 100% !important;
    max-width: 100% !important;
  }
  .woocommerce input.input-text,
  .woocommerce textarea,
  .woocommerce select,
  .woocommerce button.button {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-height: 44px !important; /* WCAG tap target */
  }
  table.shop_table,
  .cart_totals table {
    display: block !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
  }

  /* Account / login / privacy */
  .woocommerce-form-login,
  .woocommerce-MyAccount-navigation {
    width: 100% !important;
  }

  /* Footer links */
  .site-footer .footer-links,
  .footer-menu {
    flex-direction: column !important;
    gap: 4px !important;
  }
  .footer-links a,
  .footer-menu a {
    min-height: 36px !important;
    display: block !important;
  }

  /* General buttons and links for mobile */
  a, button, .button, input[type="submit"] {
    min-height: 44px !important;
    min-width: 44px !important;
  }

  /* Social icons or side elements that may intrude */
  .social-icons,
  .side-social {
    position: static !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
}

/* Tablet-ish (768-1024) gentle improvements */
@media (min-width: 768px) and (max-width: 1024px) {
  .products,
  .woocommerce ul.products {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* === Checkout consistency fixes (added 2026-06-02 for tablet/mobile/desktop parity) === */
@media (max-width: 1024px) {
  .woocommerce-checkout, .woocommerce-cart, .shop_table, .cart_totals,
  .woocommerce-MyAccount-content, .customer-details, .order-summary,
  .woocommerce-billing-fields, .woocommerce-shipping-fields,
  .woocommerce-checkout-review-order {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  .woocommerce input.input-text, .woocommerce textarea, .woocommerce select,
  .woocommerce button.button, .button, .woocommerce-checkout .form-row {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-height: 44px !important;
  }
  table.shop_table, .woocommerce table.shop_table {
    display: block !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
  }
  .woocommerce-checkout .col2-set, .woocommerce-checkout .col-1, .woocommerce-checkout .col-2 {
    width: 100% !important;
    float: none !important;
    clear: both !important;
  }
}

/* Tablet specific (around 768px) - two-col feel if space, but consistent */
@media (min-width: 768px) and (max-width: 1024px) {
  .woocommerce-checkout .col2-set {
    display: flex !important;
    gap: 16px !important;
  }
  .woocommerce-checkout .col-1, .woocommerce-checkout .col-2 {
    width: 48% !important;
    float: none !important;
  }
  .order-summary {
    width: 100% !important;
  }
}

/* Mobile narrow refinements for checkout form */
@media (max-width: 767px) {
  .woocommerce-checkout .customer-details,
  .woocommerce-checkout .order-summary,
  .secure-payment, .card-section {
    margin-bottom: 16px !important;
  }
  .woocommerce-checkout .social-icons, .side-social, .wp-block-social-links {
    display: flex !important;
    flex-wrap: wrap !important;
    position: static !important;
    margin: 8px 0 !important;
  }
  .woocommerce-checkout h3, .woocommerce-checkout .woocommerce-billing-fields__field-wrapper label {
    font-size: 14px !important;
  }
}

/* === Checkout Fundamental Responsive Redesign — 2026-06-02 (stronger structural fixes per owner tablet squeeze report) === */
/* Goal: prevent checkout content from being forced into a tiny left column at tablet/medium widths.
   Force sane proportions or full stack. Scope to checkout/cart pages only. */

@media (max-width: 1100px) {
  /* Reset common content wrappers that the Global Template / theme may constrain */
  body.woocommerce-cart .entry-content,
  body.woocommerce-checkout .entry-content,
  body.woocommerce-cart .wp-block-post-content,
  body.woocommerce-checkout .wp-block-post-content,
  body.woocommerce-cart .site-main .entry-content,
  body.woocommerce-checkout .site-main .entry-content,
  body.woocommerce-cart .wp-block-group.alignfull > .wp-block-group__inner-container,
  body.woocommerce-checkout .wp-block-group.alignfull > .wp-block-group__inner-container {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box !important;
  }

  /* The main block cart/checkout containers */
  .wp-block-woocommerce-cart,
  .wp-block-woocommerce-checkout,
  .wc-block-cart,
  .wc-block-checkout {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Block sidebar layout (the two-column for cart items + totals or checkout form + summary) */
  .wc-block-components-sidebar-layout,
  .is-large.wc-block-components-sidebar-layout,
  .wp-block-woocommerce-cart .wc-block-components-sidebar-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 360px !important; /* sane right column */
    gap: 24px !important;
    align-items: start !important;
  }

  .wc-block-components-main,
  .wc-block-components-sidebar {
    min-width: 0 !important; /* prevent flex/grid children from overflowing */
  }
}

/* Tablet / medium (roughly 700-1100) — the reported broken range */
@media (min-width: 700px) and (max-width: 1100px) {
  .wc-block-components-sidebar-layout {
    /* Give main content more room; summary not too dominant */
    grid-template-columns: minmax(0, 1fr) 320px !important;
  }

  /* If the above still squeezes, uncomment to force stack on this range */
  /* .wc-block-components-sidebar-layout { grid-template-columns: 1fr !important; } */
}

/* Below tablet — full stack for safety */
@media (max-width: 699px) {
  .wc-block-components-sidebar-layout,
  .wp-block-woocommerce-cart .wc-block-components-sidebar-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .wc-block-components-sidebar {
    order: 2; /* summary below main on very narrow */
  }
}

/* Prevent social / global side elements from claiming layout column in checkout narrow views */
@media (max-width: 1100px) {
  body.woocommerce-cart .social-icons,
  body.woocommerce-checkout .social-icons,
  body.woocommerce-cart [class*="ahv-"][class*="social"],
  body.woocommerce-checkout [class*="ahv-"][class*="social"],
  body.woocommerce-cart .wp-block-social-links,
  body.woocommerce-checkout .wp-block-social-links {
    position: static !important;
    float: none !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin: 8px 0 !important;
    width: auto !important;
    max-width: 100% !important;
  }

  /* If they are in a fixed sidebar that squeezes the form, neutralize */
  body.woocommerce-cart .ahv-main-nav ~ .social-icons,
  body.woocommerce-checkout .ahv-main-nav ~ .social-icons {
    /* keep them visible but not layout-intrusive */
  }
}

/* Ensure form fields and boxes never get squeezed */
@media (max-width: 1100px) {
  .woocommerce-checkout .customer-details,
  .woocommerce-checkout .billing,
  .woocommerce-checkout .payment,
  .woocommerce-cart .cart,
  .wc-block-components-order-summary,
  .wc-block-components-order-summary .wc-block-components-order-summary-item {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .woocommerce input,
  .woocommerce textarea,
  .woocommerce select {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* === Pass 2 Stronger Fundamental Checkout Redesign (2026-06-02) === */
/* More aggressive resets for parents and block layout to fix the narrow-left-column + huge-empty on tablet/medium widths. */

@media (max-width: 1100px) {
  /* Nuclear option for content containers on cart/checkout pages */
  body.woocommerce-cart .entry-content,
  body.woocommerce-checkout .entry-content,
  body.woocommerce-cart .wp-block-post-content,
  body.woocommerce-checkout .wp-block-post-content,
  body.woocommerce-cart main,
  body.woocommerce-checkout main,
  body.woocommerce-cart .site-main,
  body.woocommerce-checkout .site-main,
  body.woocommerce-cart .wp-site-blocks > .wp-block-group,
  body.woocommerce-checkout .wp-site-blocks > .wp-block-group {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  /* Force the Woo block cart/checkout root to take full available width */
  .wp-block-woocommerce-cart,
  .wp-block-woocommerce-checkout,
  .wc-block-cart,
  .wc-block-checkout,
  .is-large.wc-block-components-sidebar-layout {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* The two-column sidebar layout - the source of the squeeze */
  .wc-block-components-sidebar-layout {
    display: grid !important;
    grid-template-columns: 1fr !important; /* default to stack on <=1100 to avoid squeeze */
    gap: 20px !important;
  }
}

/* At true tablet/medium, allow a controlled two-col if it fits, else stack */
@media (min-width: 768px) and (max-width: 1024px) {
  .wc-block-components-sidebar-layout {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr) !important; /* main gets more space */
  }
}

/* On narrow mobile, definitely stack and full width */
@media (max-width: 767px) {
  .wc-block-components-sidebar-layout {
    grid-template-columns: 1fr !important;
  }
}

/* Ensure no child is forcing narrow column */
@media (max-width: 1100px) {
  .wc-block-components-main,
  .wc-block-components-sidebar,
  .wp-block-woocommerce-cart-items-block,
  .wp-block-woocommerce-cart-totals-block,
  .wp-block-woocommerce-cart-order-summary-block,
  .customer-details,
  .billing,
  .payment {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Make sure social/global side elements don't claim a column in narrow checkout */
@media (max-width: 900px) {
  body.woocommerce-cart .social-icons,
  body.woocommerce-checkout .social-icons,
  body.woocommerce-cart [class*="social"],
  body.woocommerce-checkout [class*="social"] {
    position: static !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-top: 8px !important;
    width: 100% !important;
  }
}


/* === DOM-Based Checkout Mobile Squeeze Fix (2026-06-02) === */
/* Based on live inspection: 
   - Page uses Woo Cart blocks (wp-block-woocommerce-cart, filled-cart-block, cart-totals-block, order-summary-*)
   - Main wrapper: main[data-block-name="woocommerce/page-content-wrapper"][data-page="cart"]
   - Then .wp-block-group.alignwide... > .entry-content.alignwide.wp-block-post-content
   - Body: woocommerce-cart + hostinger-ai-theme + autohvac-logged-out + ahv- classes
   - The squeeze (narrow left rail + huge empty right) is caused by theme/Global Template content wrapper constraining the cart block at mobile/tablet widths.
   - Social links (wp-social-link) are intruding in the narrow view.
*/

/* Force the actual content containers to full viewport width on mobile for cart/checkout pages */
@media (max-width: 767px) {
  body.woocommerce-cart main[data-block-name="woocommerce/page-content-wrapper"],
  body.woocommerce-checkout main[data-block-name="woocommerce/page-content-wrapper"],
  body.woocommerce-cart .wp-block-group.alignwide,
  body.woocommerce-checkout .wp-block-group.alignwide,
  body.woocommerce-cart .entry-content.alignwide.wp-block-post-content,
  body.woocommerce-checkout .entry-content.alignwide.wp-block-post-content,
  body.woocommerce-cart .wp-block-post-content,
  body.woocommerce-checkout .wp-block-post-content,
  body.woocommerce-cart .entry-content,
  body.woocommerce-checkout .entry-content {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    box-sizing: border-box !important;
  }

  /* Force the Woo cart block root to full width */
  body.woocommerce-cart .wp-block-woocommerce-cart,
  body.woocommerce-checkout .wp-block-woocommerce-cart,
  body.woocommerce-cart .wp-block-woocommerce-filled-cart-block {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Stack the cart items + totals/summary on mobile */
  body.woocommerce-cart .wp-block-woocommerce-cart-items-block,
  body.woocommerce-cart .wp-block-woocommerce-cart-totals-block,
  body.woocommerce-cart .wp-block-woocommerce-cart-order-summary-block {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
  }

  /* Make all form-like sections (customer, billing, payment, summary) full width */
  body.woocommerce-cart .customer-details,
  body.woocommerce-checkout .customer-details,
  body.woocommerce-cart .billing,
  body.woocommerce-checkout .billing,
  body.woocommerce-cart .payment,
  body.woocommerce-checkout .payment,
  body.woocommerce-cart .order-summary,
  body.woocommerce-checkout .order-summary,
  body.woocommerce-cart .cart,
  body.woocommerce-checkout .cart {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* Inputs, buttons, cards full and usable */
  body.woocommerce-cart input,
  body.woocommerce-checkout input,
  body.woocommerce-cart textarea,
  body.woocommerce-checkout textarea,
  body.woocommerce-cart select,
  body.woocommerce-checkout select,
  body.woocommerce-cart .button,
  body.woocommerce-checkout .button,
  body.woocommerce-cart button,
  body.woocommerce-checkout button {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-height: 44px !important;
  }

  /* Neutralize social icons so they don't squeeze the form on mobile checkout */
  body.woocommerce-cart .wp-social-link,
  body.woocommerce-checkout .wp-social-link,
  body.woocommerce-cart [class*="social"],
  body.woocommerce-checkout [class*="social"] {
    position: static !important;
    display: inline-flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin: 4px 0 !important;
    width: auto !important;
    max-width: 100% !important;
    float: none !important;
  }
}

/* Tablet (768-1024) - prevent the "narrow rail" the owner sees */
@media (min-width: 768px) and (max-width: 1024px) {
  body.woocommerce-cart .entry-content.alignwide.wp-block-post-content,
  body.woocommerce-checkout .entry-content.alignwide.wp-block-post-content,
  body.woocommerce-cart main[data-block-name="woocommerce/page-content-wrapper"],
  body.woocommerce-checkout main[data-block-name="woocommerce/page-content-wrapper"] {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
  }

  /* Allow the cart block to use full or sensible width */
  body.woocommerce-cart .wp-block-woocommerce-cart,
  body.woocommerce-checkout .wp-block-woocommerce-cart {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Make the internal cart layout (items + summary) use better proportions or stack if needed */
  body.woocommerce-cart .wp-block-woocommerce-cart-items-block + .wp-block-woocommerce-cart-totals-block,
  body.woocommerce-cart .wc-block-components-sidebar-layout {
    display: grid !important;
    grid-template-columns: 1fr 320px !important; /* main gets more room */
    gap: 20px !important;
  }
}

/* Ensure no child forces narrow column */
@media (max-width: 1024px) {
  body.woocommerce-cart .wc-block-components-main,
  body.woocommerce-checkout .wc-block-components-main,
  body.woocommerce-cart .wc-block-components-sidebar,
  body.woocommerce-checkout .wc-block-components-sidebar,
  body.woocommerce-cart .customer-details,
  body.woocommerce-checkout .customer-details,
  body.woocommerce-cart .order-summary,
  body.woocommerce-checkout .order-summary {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* === Final DOM-Based Squeeze Fix Pass (2026-06-02) === */
/* Even more direct targeting of the live structure from inspection:
   main[data-block-name="woocommerce/page-content-wrapper"][data-page="cart"]
   .wp-block-group.alignwide... 
   .entry-content.alignwide.wp-block-post-content
   .wp-block-woocommerce-cart
   .wp-block-woocommerce-filled-cart-block
   Plus the woocommerce-cart body and hostinger-ai wrappers.
*/

@media (max-width: 900px) {
  /* Force the page content wrapper (the one containing the cart block) to full width */
  main[data-block-name="woocommerce/page-content-wrapper"],
  body.woocommerce-cart main[data-block-name="woocommerce/page-content-wrapper"],
  body.woocommerce-checkout main[data-block-name="woocommerce/page-content-wrapper"] {
    max-width: 100vw !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 8px !important;
    box-sizing: border-box !important;
  }

  /* The theme alignwide group and entry-content that were likely the narrow container */
  .wp-block-group.alignwide,
  .entry-content.alignwide.wp-block-post-content,
  body.woocommerce-cart .entry-content,
  body.woocommerce-checkout .entry-content,
  body.woocommerce-cart .wp-block-post-content,
  body.woocommerce-checkout .wp-block-post-content {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* The cart block itself and its filled state */
  .wp-block-woocommerce-cart,
  .wp-block-woocommerce-filled-cart-block {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
  }

  /* Stack the items and totals/summary blocks */
  .wp-block-woocommerce-cart-items-block,
  .wp-block-woocommerce-cart-totals-block,
  .wp-block-woocommerce-cart-order-summary-block {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    margin-bottom: 16px !important;
  }

  /* Make the visible "Customer details", billing, payment, order summary full width */
  .customer-details,
  .billing,
  .payment,
  .order-summary,
  .cart,
  .shop_table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* Form fields and buttons usable */
  input, textarea, select, .button, button {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-height: 44px !important;
  }

  /* Neutralize social to not take layout space in the narrow form */
  .wp-social-link,
  [class*="social"] {
    position: static !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    margin: 4px 0 !important;
    width: auto !important;
  }
}

/* For the tablet/medium window the owner is using (~768-900), force better proportions or stack */
@media (min-width: 700px) and (max-width: 950px) {
  .wp-block-woocommerce-cart,
  .wp-block-woocommerce-filled-cart-block,
  .entry-content.alignwide.wp-block-post-content {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* If the layout is still two-col, make the main take most space */
  .wp-block-woocommerce-cart-items-block + .wp-block-woocommerce-cart-totals-block {
    display: grid !important;
    grid-template-columns: 1fr 300px !important;
    gap: 16px !important;
  }
}


/* === DOM-Based Squeeze Fix Repass (Root Structural Pass 2) — 2026-06-02 === */
/* Stronger, more specific overrides targeting the actual live parent chain from fresh DOM + owner screenshots still showing squeeze:
   .ahv-site-shell > .wp-site-blocks (the global template shell)
   main[data-block-name="woocommerce/page-content-wrapper"]
   .wp-block-group.alignwide + .entry-content
   The cart/checkout form cards and sidebar layout
   ahv- nav elements if intruding
   Using page-id-87 + woocommerce body classes + !important + very high specificity to win over theme/Global Template constraints and any prior rules.
*/

body.woocommerce-cart.page-id-87,
body.woocommerce-checkout.page-id-87,
body.woocommerce-cart,
body.woocommerce-checkout {
  /* ensure no transform or offset on root affecting children */
}

body.woocommerce-cart .ahv-site-shell,
body.woocommerce-checkout .ahv-site-shell,
body.woocommerce-cart .ahv-global-shell-source,
body.woocommerce-checkout .ahv-global-shell-source,
body.woocommerce-cart .wp-site-blocks,
body.woocommerce-checkout .wp-site-blocks {
  width: 100% !important;
  max-width: 100vw !important;
  min-width: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}

body.woocommerce-cart main[data-block-name="woocommerce/page-content-wrapper"],
body.woocommerce-checkout main[data-block-name="woocommerce/page-content-wrapper"],
body.woocommerce-cart .wp-block-group.has-global-padding.is-layout-constrained,
body.woocommerce-checkout .wp-block-group.has-global-padding.is-layout-constrained,
body.woocommerce-cart .wp-block-group.alignwide,
body.woocommerce-checkout .wp-block-group.alignwide,
body.woocommerce-cart .entry-content.alignwide.wp-block-post-content,
body.woocommerce-checkout .entry-content.alignwide.wp-block-post-content {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding-left: 4px !important;
  padding-right: 4px !important;
}

/* Force the actual Woo cart/checkout content blocks and their internal columns to expand */
body.woocommerce-cart .wp-block-woocommerce-cart,
body.woocommerce-checkout .wp-block-woocommerce-cart,
body.woocommerce-cart .wp-block-woocommerce-filled-cart-block,
body.woocommerce-checkout .wp-block-woocommerce-filled-cart-block,
body.woocommerce-cart .wc-block-components-sidebar-layout,
body.woocommerce-checkout .wc-block-components-sidebar-layout,
body.woocommerce-cart .wc-block-components-main,
body.woocommerce-checkout .wc-block-components-main,
body.woocommerce-cart .wc-block-components-sidebar,
body.woocommerce-checkout .wc-block-components-sidebar {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  display: block !important; /* fallback, grid reset below for wider */
}

/* On narrow, stack cart items + summary/totals fully */
@media (max-width: 767px) {
  body.woocommerce-cart .wp-block-woocommerce-cart-items-block + .wp-block-woocommerce-cart-totals-block,
  body.woocommerce-checkout .wp-block-woocommerce-cart-items-block + .wp-block-woocommerce-cart-totals-block,
  body.woocommerce-cart .wc-block-components-sidebar-layout {
    display: block !important;
    grid-template-columns: 1fr !important;
  }
  /* Customer details / billing / payment / order-summary / any card-like sections full */
  body.woocommerce-cart .customer-details,
  body.woocommerce-checkout .customer-details,
  body.woocommerce-cart .billing,
  body.woocommerce-checkout .billing,
  body.woocommerce-cart .payment,
  body.woocommerce-checkout .payment,
  body.woocommerce-cart .order-summary,
  body.woocommerce-checkout .order-summary,
  body.woocommerce-cart .shop_table,
  body.woocommerce-checkout .shop_table,
  body.woocommerce-cart .wc-block-components-panel,
  body.woocommerce-checkout .wc-block-components-panel,
  body.woocommerce-cart [class*="customer-details"],
  body.woocommerce-checkout [class*="customer-details"],
  body.woocommerce-cart [class*="billing"],
  body.woocommerce-checkout [class*="billing"],
  body.woocommerce-cart [class*="Secure"],
  body.woocommerce-checkout [class*="Secure"],
  body.woocommerce-cart [class*="order-summary"],
  body.woocommerce-checkout [class*="order-summary"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  /* Inputs, textareas, buttons, card fields usable full width, no 1-2 word wrap */
  body.woocommerce-cart input,
  body.woocommerce-checkout input,
  body.woocommerce-cart textarea,
  body.woocommerce-checkout textarea,
  body.woocommerce-cart select,
  body.woocommerce-checkout select,
  body.woocommerce-cart .button,
  body.woocommerce-checkout .button,
  body.woocommerce-cart button,
  body.woocommerce-checkout button,
  body.woocommerce-cart .wc-block-components-text-input input,
  body.woocommerce-checkout .wc-block-components-text-input input {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-height: 44px !important;
  }
  /* Place Order and Return to Cart full and prominent */
  body.woocommerce-cart #place_order,
  body.woocommerce-checkout #place_order,
  body.woocommerce-cart .wc-block-components-button,
  body.woocommerce-checkout .wc-block-components-button,
  body.woocommerce-cart a[href*="cart"],
  body.woocommerce-checkout a[href*="cart"] {
    width: 100% !important;
    display: block !important;
    text-align: center !important;
  }
  /* Social in flow or top: do not consume form width */
  body.woocommerce-cart .wp-social-link,
  body.woocommerce-checkout .wp-social-link,
  body.woocommerce-cart [class*="ahv-footer-social"],
  body.woocommerce-checkout [class*="ahv-footer-social"],
  body.woocommerce-cart [class*="social"],
  body.woocommerce-checkout [class*="social"] {
    position: static !important;
    width: auto !important;
    max-width: 100% !important;
  }
}

/* Tablet 768-1024: clean, either sensible 2-col with main taking space or full stack, no left rail */
@media (min-width: 768px) and (max-width: 1024px) {
  body.woocommerce-cart .wp-block-woocommerce-cart,
  body.woocommerce-checkout .wp-block-woocommerce-cart,
  body.woocommerce-cart .entry-content.alignwide.wp-block-post-content,
  body.woocommerce-checkout .entry-content.alignwide.wp-block-post-content,
  body.woocommerce-cart .ahv-site-shell,
  body.woocommerce-checkout .ahv-site-shell {
    max-width: 100% !important;
    width: 100% !important;
  }
  /* Prefer clean 2-col with generous main on tablet if space, else stack */
  body.woocommerce-cart .wp-block-woocommerce-cart-items-block + .wp-block-woocommerce-cart-totals-block,
  body.woocommerce-checkout .wp-block-woocommerce-cart-items-block + .wp-block-woocommerce-cart-totals-block {
    display: grid !important;
    grid-template-columns: 1fr 340px !important;
    gap: 16px !important;
  }
  body.woocommerce-cart .customer-details,
  body.woocommerce-checkout .customer-details,
  body.woocommerce-cart .billing,
  body.woocommerce-checkout .billing,
  body.woocommerce-cart .payment,
  body.woocommerce-checkout .payment,
  body.woocommerce-cart .order-summary,
  body.woocommerce-checkout .order-summary {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Kill any remaining narrow fixed or small containers inside form on <=1024 */
@media (max-width: 1024px) {
  body.woocommerce-cart .wp-block-group,
  body.woocommerce-checkout .wp-block-group,
  body.woocommerce-cart [class*="wp-container"],
  body.woocommerce-checkout [class*="wp-container"] {
    max-width: 100% !important;
  }
  /* Ensure no huge empty right inside the content by expanding all the way */
  body.woocommerce-cart .wp-block-post-content,
  body.woocommerce-checkout .wp-block-post-content,
  body.woocommerce-cart .has-global-padding,
  body.woocommerce-checkout .has-global-padding {
    max-width: 100% !important;
    width: 100% !important;
  }
}
