/**
 * Post-upgrade layout fixes (category / cart / overlays)
 * Loaded via Magento_Theme default_head_blocks.xml
 */

/* 1) Category description — full width (Page Builder was left-aligned/narrow) */
.catalog-category-view .category-view,
.catalog-category-view .category-description {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 20px !important;
    float: none !important;
    clear: both !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    text-align: left !important;
    box-sizing: border-box !important;
}

.catalog-category-view .category-description [data-content-type="row"],
.catalog-category-view .category-description [data-content-type="row"] > [data-element="inner"],
.catalog-category-view .category-description [data-content-type="text"],
.catalog-category-view .category-description [data-content-type="html"],
.catalog-category-view .category-description [data-content-type="html"] > * {
    width: 100% !important;
    max-width: 100% !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
}

.catalog-category-view .category-description [data-content-type="row"][data-appearance="contained"],
.catalog-category-view .category-description [data-content-type="row"][data-appearance="contained"] > [data-element="inner"] {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.catalog-category-view .product-view-bannertop-category .category-description {
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    max-width: 100% !important;
    margin: 0 0 20px !important;
}

/* Ensure columns.top category view spans full content width */
.catalog-category-view .columns .column.main,
.catalog-category-view .category-view {
    width: 100% !important;
    max-width: 100% !important;
}

/* 4) Cart rows — full-width separator under each item (not only under product name) */
.checkout-cart-index.fpp-cart-page #shopping-cart-table .product-item-name,
.checkout-cart-index.fpp-cart-page #shopping-cart-table .product-item-name a {
    border-bottom: none !important;
    text-decoration: none !important;
    box-shadow: none !important;
    background-image: none !important;
}

.checkout-cart-index.fpp-cart-page #shopping-cart-table.fpp-cart-table .cart.item > tr.item-info > td,
.checkout-cart-index.fpp-cart-page #shopping-cart-table .cart.item > tr.item-info > td {
    border-bottom: 1px solid #084A84 !important;
    border-top: none !important;
}

.checkout-cart-index.fpp-cart-page #shopping-cart-table.fpp-cart-table .cart.item:last-child > tr.item-info > td,
.checkout-cart-index.fpp-cart-page #shopping-cart-table .cart.item:last-child > tr.item-info > td {
    border-bottom: 1px solid #084A84 !important;
}

/* Half-line under product title often came from link underline / short block width */
.checkout-cart-index.fpp-cart-page #shopping-cart-table .product-item-details {
    width: 100% !important;
    max-width: 100% !important;
}

/* 5) Ensure cart totals area is visible once Knockout renders */
.checkout-cart-index.fpp-cart-page .cart-summary #cart-totals,
.checkout-cart-index.fpp-cart-page .cart-summary .cart-totals {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 48px;
}

/* 9) Stuck modal overlay blocks minicart / login clicks after closed dialogs */
.modals-overlay:not([style*="display: block"]):empty,
body:not(._has-modal) > .modals-wrapper > .modals-overlay {
    display: none !important;
    pointer-events: none !important;
}

body:not(._has-modal) .modals-overlay {
    display: none !important;
    pointer-events: none !important;
}

/* 7) Login page — ensure main Sign In controls stay visible (auth popup uses unique ids) */
.customer-account-login #login-form #password,
.customer-account-login #login-form #email,
.customer-account-login #login-form button.action.login {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.customer-account-login #login-form button.action.login {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

/* Mantis 0050740 — mobile search must accept keyboard input */
@media (max-width: 991px) {
    body.nec-hmm-active .nec-hmm__search .block-search input,
    body.nec-hmm-active .nec-hmm__search #search-input-autocomplate {
        position: static !important;
        left: auto !important;
        pointer-events: auto !important;
        -webkit-user-select: text !important;
        user-select: text !important;
        font-size: 16px !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    body.nec-hmm-active .nec-hmm__search .block-search .label {
        display: none !important;
        pointer-events: none !important;
    }
}

/* Mantis 0050745 — iPad cart Subtotal / Action columns */
@media (min-width: 768px) and (max-width: 1024px) {
    .checkout-cart-index .cart.table-wrapper,
    .checkout-cart-index .fpp-cart-table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .checkout-cart-index .cart.table-wrapper thead .col:not(.item),
    .checkout-cart-index #shopping-cart-table thead th.col.subtotal,
    .checkout-cart-index #shopping-cart-table thead th.col.actions,
    .checkout-cart-index #shopping-cart-table tbody td.col.subtotal,
    .checkout-cart-index #shopping-cart-table tbody td.col.actions {
        display: table-cell !important;
        visibility: visible !important;
        float: none !important;
    }
}
