/**
 * WowPlatter Mobile Header - End of File Overrides
 * 
 * This file is loaded LAST to ensure mobile styles override everything else.
 * Specifically targets WooCommerce page conflicts.
 */

/* =========================================
   CRITICAL LOGO FIXES
   ========================================= */
@media (max-width: 768px) {

    /* Target every possible logo selector used by themes and Woo */
    body.woocommerce-page .site-logo,
    body.woocommerce-page .site-logo a,
    body.woocommerce-page .site-logo img,
    body.woocommerce-page .custom-logo,
    body.woocommerce-page .custom-logo-link,
    body.woocommerce-page .custom-logo-link img,
    body.woocommerce-page .wowplatter-logo-img,
    body.woocommerce-page .wowplatter-header-logo img,
    body.woocommerce-page .wowplatter-mobile-logo-img,
    body.woocommerce-page header .logo img,
    body.woocommerce-page .navbar-brand img,
    .woocommerce .site-logo,
    .woocommerce .custom-logo-link img,
    .site-logo,
    .site-logo a,
    .site-logo img,
    .custom-logo,
    .custom-logo-link img,
    .wowplatter-logo-img,
    .wowplatter-mobile-logo-img {
        max-width: 60px !important;
        width: 60px !important;
        height: auto !important;
        max-height: 35px !important;
        min-width: auto !important;
        object-fit: contain !important;
    }
}

/* =========================================
   CRITICAL HAMBURGER MENU FIXES
   Match the /records/ page styling exactly
   ========================================= */
@media (max-width: 768px) {
    .wowplatter-header-desktop {
        display: none !important;
    }

    .wowplatter-header-mobile {
        display: block !important;
        width: 100% !important;
        background: #ffffff !important;
        position: relative !important;
        z-index: 99999 !important;
    }

    /* Blue hamburger button to match records page */
    .wowplatter-mobile-menu-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        visibility: visible !important;
        opacity: 1 !important;
        background: #0073aa !important;
        /* Blue background like records */
        color: #ffffff !important;
        /* White icon */
        border: none !important;
        padding: 0 !important;
        border-radius: 8px !important;
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
        margin: 0 !important;
        cursor: pointer !important;
        box-shadow: none !important;
    }

    .wowplatter-mobile-menu-toggle i,
    .wowplatter-mobile-menu-toggle .fa {
        color: #ffffff !important;
        /* White icon */
        font-size: 22px !important;
        display: block !important;
        visibility: visible !important;
    }

    .wowplatter-mobile-menu-toggle:hover {
        background: #005a87 !important;
        /* Darker blue on hover */
    }

    /* Layout fixes - match records page */
    .wowplatter-header-mobile-top-row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 10px !important;
        width: 100% !important;
        flex-wrap: nowrap !important;
        padding: 8px 10px !important;
    }

    /* Logo should be similar size to records page */
    .wowplatter-header-mobile .site-logo img,
    .wowplatter-header-mobile .custom-logo-link img {
        max-width: 80px !important;
        width: 80px !important;
        height: auto !important;
        max-height: 40px !important;
    }

    /* Cart button styling to match */
    .wowplatter-header-mobile-user .wowplatter-icon-btn,
    .wowplatter-header-mobile .shopping-cart-link {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Fix menu z-index to be above header (Header is 99999) */
    .wowplatter-mobile-menu {
        z-index: 100001 !important;
    }

    .wowplatter-mobile-menu-overlay {
        z-index: 100000 !important;
    }
}

/* =========================================
   WOOCOMMERCE PAGE SPECIFIC FIXES
   ========================================= */
/* Cart, Checkout, Order Received */
body.woocommerce-cart .wowplatter-header,
body.woocommerce-checkout .wowplatter-header,
body.woocommerce-order-received .wowplatter-header {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100000 !important;
}

/* Ensure nothing in Woo overrides the header container width on mobile */
@media (max-width: 768px) {

    body.woocommerce-cart .wowplatter-header-container,
    body.woocommerce-checkout .wowplatter-header-container {
        padding-left: 10px !important;
        padding-right: 10px !important;
        width: 100% !important;
    }

    /* NUCLEAR OPTION: Force html and body width constraints on cart page */
    html.woocommerce-cart,
    body.woocommerce-cart {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    htmlbody.woocommerce-cart * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Force table to be responsive */
    body.woocommerce-cart table.shop_table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    body.woocommerce-cart table.shop_table thead,
    body.woocommerce-cart table.shop_table tbody,
    body.woocommerce-cart table.shop_table tr {
        display: block !important;
        width: 100% !important;
    }

    body.woocommerce-cart table.shop_table thead {
        display: none !important;
    }

    body.woocommerce-cart table.shop_table tr {
        margin-bottom: 15px !important;
        border: 1px solid #e9ecef !important;
        border-radius: 8px !important;
        padding: 10px !important;
    }

    body.woocommerce-cart table.shop_table td {
        display: block !important;
        width: 100% !important;
        text-align: left !important;
        padding: 8px 0 !important;
        border: none !important;
    }

    body.woocommerce-cart table.shop_table td::before {
        content: attr(data-title) ": " !important;
        font-weight: bold !important;
        display: inline-block !important;
        margin-right: 10px !important;
    }

    body.woocommerce-cart table.shop_table td.product-remove::before,
    body.woocommerce-cart table.shop_table td.product-thumbnail::before {
        display: none !important;
    }

    body.woocommerce-cart table.shop_table td.product-thumbnail {
        text-align: center !important;
        margin-bottom: 10px !important;
    }

    /* =========================================
       CART PAGE MOBILE FIXES
       ========================================= */

    /* Constrain main content containers */
    body.woocommerce-cart .site-main,
    body.woocommerce-cart #content,
    body.woocommerce-cart main {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .page-content {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .woocommerce {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* Make cart table scrollable on mobile */
    body.woocommerce-cart .woocommerce-cart-form {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .woocommerce-cart-form table.shop_table {
        min-width: 500px !important;
        width: 100% !important;
    }

    /* Make cart items more compact on mobile */
    body.woocommerce-cart .woocommerce-cart-form__cart-item.cart_item td {
        padding: 8px 4px !important;
        font-size: 14px !important;
    }

    body.woocommerce-cart .woocommerce-cart-form__cart-item.cart_item .product-thumbnail {
        width: 60px !important;
        min-width: 60px !important;
    }

    body.woocommerce-cart .woocommerce-cart-form__cart-item.cart_item .product-name {
        min-width: 120px !important;
    }

    /* Fix coupon code section to fit mobile */
    body.woocommerce-cart .coupon {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px 0 !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .coupon input[type="text"],
    body.woocommerce-cart .coupon #coupon_code {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px 12px !important;
        font-size: 14px !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .coupon button,
    body.woocommerce-cart .coupon .button {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px 16px !important;
        font-size: 14px !important;
        box-sizing: border-box !important;
        white-space: normal !important;
        word-wrap: break-word !important;
    }

    /* Fix cart actions (UPDATE CART button) */
    body.woocommerce-cart .actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px 0 !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .actions button,
    body.woocommerce-cart .actions .button {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px 16px !important;
        font-size: 14px !important;
        box-sizing: border-box !important;
    }

    /* Cart totals and collaterals */
    body.woocommerce-cart .cart-collaterals {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .cart_totals {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .cart_totals table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
    }

    body.woocommerce-cart .cart_totals table td,
    body.woocommerce-cart .cart_totals table th {
        padding: 8px !important;
        font-size: 14px !important;
        word-wrap: break-word !important;
    }

    /* Shipping methods */
    body.woocommerce-cart .woocommerce-shipping-methods {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .woocommerce-shipping-methods li {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 8px !important;
        font-size: 13px !important;
        word-wrap: break-word !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .woocommerce-shipping-methods label {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        word-wrap: break-word !important;
        white-space: normal !important;
    }

    /* Shipping destination */
    body.woocommerce-cart .woocommerce-shipping-destination {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 12px !important;
        word-wrap: break-word !important;
        box-sizing: border-box !important;
    }

    /* Shipping calculator */
    body.woocommerce-cart .woocommerce-shipping-calculator {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .shipping-calculator-form {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .shipping-calculator-form input,
    body.woocommerce-cart .shipping-calculator-form select {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Proceed to checkout button */
    body.woocommerce-cart .wc-proceed-to-checkout {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    body.woocommerce-cart .wc-proceed-to-checkout a,
    body.woocommerce-cart .wc-proceed-to-checkout .button {
        width: 100% !important;
        max-width: 100% !important;
        padding: 14px 16px !important;
        font-size: 16px !important;
        box-sizing: border-box !important;
        display: block !important;
        text-align: center !important;
    }

    /* =========================================
       CHECKOUT PAGE MOBILE FIXES
       ========================================= */

    /* Fix "Place order" button text overflow */
    body.woocommerce-checkout #place_order,
    body.woocommerce-checkout button.button.alt {
        width: 100% !important;
        padding: 12px 16px !important;
        font-size: 16px !important;
        line-height: 1.4 !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        min-height: 48px !important;
        height: auto !important;
        text-align: center !important;
        display: block !important;
    }

    /* Ensure checkout form fits mobile viewport */
    body.woocommerce-checkout .woocommerce-checkout {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    body.woocommerce-checkout .woocommerce-billing-fields,
    body.woocommerce-checkout .woocommerce-shipping-fields,
    body.woocommerce-checkout .woocommerce-additional-fields {
        width: 100% !important;
        max-width: 100% !important;
    }
}