/**
 * WooCommerce Template Compatibility Styles
 *
 * Fixes layout issues arising from WooCommerce template updates
 * to match WC 10.x structure while preserving the existing visual design.
 *
 * Loaded by Child_Theme to patch both industrial (parent) and Child_Theme overrides.
 */

/* ==========================================================================
   Product Gallery — figure wrapper
   Templates updated: single-product/product-image.php (both themes)
   Both themes already used <figure class="woocommerce-product-gallery__wrapper">
   WC's own CSS targets the class, not the tag, but the gallery JS expects <div>.
   Restore the display behaviour WC gallery scripts expect.
   ========================================================================== */

figure.woocommerce-product-gallery__wrapper {
    display: block;
    margin: 0;
    padding: 0;
}

figure.woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image {
    display: block;
}

/* ==========================================================================
   Product Loop — wc_product_class() replaces post_class()
   Template: content-product.php (Child_Theme)
   wc_product_class() adds instock / outofstock / sale / featured classes.
   Suppress any WC default visibility rules that would hide out-of-stock items
   unexpectedly (WC core hides nothing by default — this is defensive).
   ========================================================================== */

.woocommerce ul.products li.product.outofstock {
    opacity: 1; /* ensure nothing hides OOS items unless explicitly styled */
}

/* ==========================================================================
   Product Tabs — tab-content class added to panels
   Template: single-product/tabs/tabs.php (industrial)
   The new template adds class="...tab-content" to each panel div.
   Bootstrap's .tab-content > .active rule could conflict. Override here to
   ensure WC-managed visibility (via JS toggling display) is not disrupted.
   ========================================================================== */

.product-tab-box .woocommerce-Tabs-panel {
    display: none;
}

.product-tab-box .woocommerce-Tabs-panel.active {
    display: block;
}

/* ==========================================================================
   Product Tabs — empty state
   Template: single-product/tabs/tabs.php (industrial)
   <div class="product-tab-box"> now renders even when $product_tabs is empty.
   Prevent the empty wrapper from contributing to layout height.
   ========================================================================== */

.product-tab-box:not(:has(> .woocommerce-tabs)) {
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   Cart Table — column order and remove column
   Template: cart/cart.php (industrial)
   Column order preserved from theme: thumbnail, name, price, qty, subtotal, remove.
   Ensure product-remove at end doesn't lose its styling.
   ========================================================================== */

.woocommerce table.cart .product-remove {
    text-align: right;
}

.woocommerce table.cart .product-remove a.remove {
    display: inline-block;
    margin: 0;
}

/* Without woocommerce-cart-form class on <form>, WC's AJAX cart update JS
   won't intercept submissions — cart uses full-page POST (intentional, matches
   old theme behaviour). No JS workaround needed here. */

/* ==========================================================================
   Cart Empty — Bootstrap wrappers
   Template: cart/cart-empty.php (industrial)
   Wrappers already existed in old theme; preserved. No new CSS needed.
   Defensive: ensure the empty-cart message is visible inside the container.
   ========================================================================== */

.row_inner_wrapper .woocommerce-cart-is-empty,
.row_inner_wrapper p.cart-empty {
    display: block;
    width: 100%;
}

/* ==========================================================================
   Checkout — Bootstrap grid layout
   Template: checkout/form-checkout.php (industrial)
   Layout preserved from theme (left col: billing/shipping, right col: order).
   Deprecated APIs fixed; no structural change to HTML, no CSS fix needed.
   Defensive: ensure right column stacks on mobile.
   ========================================================================== */

@media (max-width: 767px) {
    .left-checkout,
    .right-checkout {
        width: 100%;
        margin-left: 0;
        padding: 0;
    }

    .right-checkout {
        margin-top: 30px;
    }
}

/* ==========================================================================
   Checkout Order Review — <ul>/<li> structure
   Template: checkout/review-order.php (industrial)
   Structure was already <ul>/<li> in old theme; preserved.
   Fix: deprecated get_title() → get_name() is a PHP fix, no CSS impact.
   ========================================================================== */

/* ==========================================================================
   Shop Loop — orderby form label
   Template: loop/orderby.php (industrial)
   WC 9.7+ conditionally adds <label for="woocommerce-orderby-..."> when
   $use_label = true (false by default in standard shop display).
   Style the label so it doesn't break the inline select layout if shown.
   ========================================================================== */

.woocommerce-ordering label {
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px;
    font-size: 14px;
    font-weight: normal;
    line-height: 36px;
}

.woocommerce-ordering select {
    display: inline-block;
    vertical-align: middle;
}

/* ==========================================================================
   Notices — core templates restored (error.php, success.php)
   Templates: notices/error.php, notices/success.php (industrial)
   Core adds role="alert" and wc_get_notice_data_attr() data attributes —
   these are attr-only and don't affect CSS selectors.
   The notice.php customisation (col-lg-12 return-customer) was preserved.
   Defensive: ensure notice containers are visible even with new attributes.
   ========================================================================== */

ul.woocommerce-error[role="alert"] {
    display: block;
}

.woocommerce-message[role="alert"] {
    display: block;
}

/* ==========================================================================
   Block Notices — prevent WC 10.x block-based notice system from
   double-rendering alongside our legacy notice templates.
   WC 10.x registers block notices; legacy templates are kept as overrides.
   ========================================================================== */

.wc-block-components-notices:empty {
    display: none;
}

/* ==========================================================================
   Add to Cart — custom cart-btn
   Template: single-product/add-to-cart/simple.php (industrial)
   Theme uses <button class="cart-btn"> instead of WC default button classes.
   is_purchasable() check now prevents form rendering for non-purchasable
   products — no layout impact, just cleaner HTML.
   ========================================================================== */

/* ==========================================================================
   Quantity Input — custom span.quantity structure
   Template: global/quantity-input.php (industrial)
   Structure preserved from old theme: <span class="quantity">Quantity: <input>
   The hidden div (when min=max) uses class="quantity hidden" — ensure hidden.
   ========================================================================== */

div.quantity.hidden {
    display: none !important;
}

/* ==========================================================================
   Related Products — child theme suppression
   Template: single-product/related.php (Child_Theme)
   Related products are intentionally suppressed. The section wrapper hook
   may still fire and output an empty <section class="related products">.
   Hide any empty related sections.
   ========================================================================== */

.related.products:empty,
.related.products:not(:has(*)) {
    display: none;
}

/* ==========================================================================
   Single Product — meta section suppressed
   Template: single-product/meta.php (industrial)
   SKU, categories, tags intentionally not displayed.
   WC may still render <div class="product_meta"> via hooks — suppress it.
   ========================================================================== */

.product_meta:empty {
    display: none;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   Single Product — content-box replaces .summary.entry-summary
   Template: content-single-product.php (industrial)
   wc_product_class() now applied instead of post_class() — adds proper WC
   classes (.instock, .outofstock, .sale, .product-type-simple etc.).
   The <div class="content-box"> replaces the standard .summary.entry-summary.
   WC's own CSS targets div.summary; ensure .content-box inherits clearfix
   and stacks correctly without the WC default summary rules.
   ========================================================================== */

.woocommerce div.product .content-box {
    display: block;
    width: 100%;
}

.woocommerce div.product .content-box::after {
    content: "";
    display: table;
    clear: both;
}

/* ==========================================================================
   Single Product — short description wrappers
   Template: single-product/short-description.php (industrial)
   Theme wraps description in .content-text > [itemprop="description"] instead
   of .woocommerce-product-details__short-description. WC JS/CSS targets the
   WC class for margin; replicate the spacing on .content-text.
   ========================================================================== */

.woocommerce div.product .content-text {
    margin-bottom: 1.618em;
}

.woocommerce div.product .content-text [itemprop="description"] {
    display: block;
}

/* ==========================================================================
   Cart Totals — <ul>/<li> list structure
   Template: cart/cart-totals.php (industrial)
   Theme uses <ul>/<li> throughout instead of WC's default <table>.
   WC's default CSS targets .cart_totals table — these list styles are
   handled by the industrial theme; ensure list resets don't interfere.
   ========================================================================== */

.cart_totals ul {
    list-style: none;
    margin-left: 0;
    padding-left: 0;
}

.cart_totals ul li {
    list-style: none;
}

/* ==========================================================================
   Checkout — section_header form headings
   Templates: checkout/form-billing.php, checkout/form-shipping.php (industrial)
   Deprecated checkout_fields / enable_signup APIs fixed; structure unchanged.
   The .section_header.color > h2 wrapper is an existing industrial pattern.
   No new structural changes — styles already in industrial theme CSS.
   ========================================================================== */
