/* =========================================================
   HPD STATE PRODUCT GRIDS
   Shared WooCommerce product-card styling for state/category pages

   Reusable Divi Woo Products module class:
   hpd-state-product-grid

   IMPORTANT:
   - This file does NOT style the state H1 or state SEO description.
   - It only styles WooCommerce products placed inside a module
     carrying the class: hpd-state-product-grid
   - The live WooCommerce category stylesheet remains untouched.
   ========================================================= */


/* =========================================================
   01 - WOO PRODUCTS MODULE
   ========================================================= */

.hpd-state-product-grid.et_pb_wc_products,
.hpd-state-product-grid .et_pb_wc_products {
    width: 100%;
    margin: 0 auto;
    padding-top: 10px;
    padding-bottom: 20px;
}

.hpd-state-product-grid .et_pb_module_inner {
    width: 100%;
}


/* =========================================================
   02 - RESULT COUNT + SORTING
   ========================================================= */

.hpd-state-product-grid .woocommerce-result-count {
    margin: 0 0 24px 0 !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
    color: #5f6b76 !important;
}

.hpd-state-product-grid .woocommerce-ordering {
    margin: 0 0 24px 0 !important;
}

.hpd-state-product-grid .woocommerce-ordering select {
    min-width: 190px;
    min-height: 42px;
    padding: 8px 38px 8px 14px;
    background-color: #ffffff;
    color: #263442;
    border: 1px solid #cfd7df;
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    box-shadow: none;
    cursor: pointer;
}

.hpd-state-product-grid .woocommerce-ordering select:hover,
.hpd-state-product-grid .woocommerce-ordering select:focus {
    border-color: #0e2a47;
    outline: none;
}


/* =========================================================
   03 - PRODUCT GRID
   ========================================================= */

.hpd-state-product-grid ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    row-gap: 26px !important;
    column-gap: 18px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.hpd-state-product-grid ul.products::before,
.hpd-state-product-grid ul.products::after {
    display: none !important;
    content: none !important;
}


/* =========================================================
   04 - OUTER PRODUCT CARD
   ========================================================= */

.hpd-state-product-grid ul.products li.product {
    position: relative;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: #ffffff;
    border: 1px solid #dfe5eb;
    border-radius: 7px;
    box-shadow: 0 2px 7px rgba(14, 42, 71, 0.05);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.hpd-state-product-grid ul.products li.product:hover {
    transform: translateY(-2px);
    border-color: #c7d1da;
    box-shadow: 0 7px 18px rgba(14, 42, 71, 0.10);
}


/* =========================================================
   05 - PRODUCT LINK WRAPPER
   ========================================================= */

.hpd-state-product-grid ul.products li.product > a {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    text-decoration: none !important;
}


/* =========================================================
   06 - IMAGE AREA
   ZERO PADDING
   ========================================================= */

.hpd-state-product-grid ul.products li.product > a > img {
    display: block !important;
    width: 100% !important;
    height: 220px !important;
    margin: 0 !important;
    padding: 0 !important;
    object-fit: contain;
    object-position: center;
    background-color: #ffffff;
    border-radius: 6px 6px 0 0 !important;
    opacity: 1 !important;
    filter: none !important;
    transition: opacity 0.18s ease, transform 0.18s ease !important;
}


/* =========================================================
   07 - FIX DIVI / WOO IMAGE HOVER
   ========================================================= */

.hpd-state-product-grid ul.products li.product:hover img,
.hpd-state-product-grid ul.products li.product a:hover img,
.hpd-state-product-grid li.product:hover img,
.hpd-state-product-grid li.product a:hover img {
    opacity: 1 !important;
    filter: none !important;
    -webkit-filter: none !important;
    visibility: visible !important;
}

.hpd-state-product-grid ul.products li.product .et_overlay,
.hpd-state-product-grid li.product .et_overlay {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    background: transparent !important;
    pointer-events: none !important;
}

.hpd-state-product-grid ul.products li.product:hover .et_overlay,
.hpd-state-product-grid li.product:hover .et_overlay {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}


/* =========================================================
   08 - PRODUCT TITLE
   ========================================================= */

.hpd-state-product-grid ul.products li.product .woocommerce-loop-product__title {
    min-height: 72px;
    margin: 0 !important;
    padding: 14px 14px 7px 14px !important;
    background-color: #ffffff;
    color: #17202a !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
    font-weight: 400 !important;

    /* HPD title rule: maximum 3 lines, then ellipsis */
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.hpd-state-product-grid ul.products li.product:hover .woocommerce-loop-product__title {
    color: #0e2a47 !important;
}


/* =========================================================
   09 - PRODUCT SKU
   CSS is ready for SKU output.
   ========================================================= */

.hpd-state-product-grid ul.products li.product .hpd-loop-sku {
    display: block;
    margin: 0 !important;
    padding: 0 14px 6px 14px !important;
    background-color: #ffffff;
    color: #68737d !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    font-weight: 400 !important;
}

.hpd-state-product-grid ul.products li.product .hpd-loop-sku strong {
    color: #0e2a47 !important;
    font-weight: 600 !important;
}


/* =========================================================
   10 - PRODUCT RATING
   ========================================================= */

.hpd-state-product-grid ul.products li.product .star-rating {
    margin: 0 14px 7px 14px !important;
    color: #ff8a00 !important;
    font-size: 13px !important;
}

.hpd-state-product-grid ul.products li.product .star-rating::before {
    color: #d6dce2 !important;
}


/* =========================================================
   11 - PRICE
   ========================================================= */

.hpd-state-product-grid ul.products li.product .price {
    display: block;
    margin: 0 !important;
    padding: 0 14px 16px 14px !important;
    background-color: #ffffff;
    color: #1f5ebe !important;
    font-size: 15px !important;
    line-height: 1.3 !important;
    font-weight: 700 !important;
}

.hpd-state-product-grid ul.products li.product .price .woocommerce-Price-amount {
    color: #1f5ebe !important;
    font-weight: 700 !important;
}

.hpd-state-product-grid ul.products li.product .price del {
    color: #7b858e !important;
    font-weight: 400 !important;
    opacity: 0.7;
}

.hpd-state-product-grid ul.products li.product .price ins {
    color: #1f5ebe !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}


/* =========================================================
   12 - SALE BADGE
   ========================================================= */

.hpd-state-product-grid span.onsale {
    top: 10px !important;
    left: 10px !important;
    min-width: auto !important;
    min-height: auto !important;
    padding: 6px 9px !important;
    background-color: #ff8a00 !important;
    color: #ffffff !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}


/* =========================================================
   13 - REMOVE DEFAULT PRODUCT BUTTONS
   ========================================================= */

.hpd-state-product-grid ul.products li.product .button {
    display: none !important;
}


/* =========================================================
   14 - PAGINATION
   ========================================================= */

.hpd-state-product-grid nav.woocommerce-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 40px 0 12px 0 !important;
}

.hpd-state-product-grid nav.woocommerce-pagination ul {
    display: flex !important;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    list-style: none !important;
}

.hpd-state-product-grid nav.woocommerce-pagination ul li {
    margin: 0 !important;
    border: 0 !important;
}

.hpd-state-product-grid nav.woocommerce-pagination ul li a,
.hpd-state-product-grid nav.woocommerce-pagination ul li span {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px !important;
    background-color: #ffffff !important;
    color: #0e2a47 !important;
    border: 1px solid #cfd7df !important;
    border-radius: 4px;
    font-size: 14px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hpd-state-product-grid nav.woocommerce-pagination ul li a:hover {
    background-color: #0e2a47 !important;
    color: #ffffff !important;
    border-color: #0e2a47 !important;
}

.hpd-state-product-grid nav.woocommerce-pagination ul li span.current {
    background-color: #ff8a00 !important;
    color: #ffffff !important;
    border-color: #ff8a00 !important;
}


/* =========================================================
   14A - VIEW ALL + PAGINATION ALIGNMENT
   Keeps View All and 1 / 2 / Next on one horizontal line.
   The JS places both controls inside this centered wrapper.
   ========================================================= */

.hpd-state-product-grid .hpd-pagination-row {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 40px 0 12px 0 !important;
    padding: 0 !important;
}


.hpd-state-product-grid .hpd-view-all-controls {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
    width: auto !important;
    margin: 0 !important;
    gap: 0 !important;
}

.hpd-state-product-grid .hpd-view-all-button {
    min-height: 38px !important;
    height: 38px !important;
    padding: 0 18px !important;
    white-space: nowrap !important;
}

.hpd-state-product-grid .hpd-view-all-status {
    display: none !important;
}

.hpd-state-product-grid nav.woocommerce-pagination {
    display: inline-flex !important;
    vertical-align: middle !important;
    width: auto !important;
    margin: 0 !important;
}


/* =========================================================
   15 - EMPTY PRODUCT MESSAGE
   ========================================================= */

.hpd-state-product-grid .woocommerce-info {
    margin: 20px 0 !important;
    padding: 18px 20px !important;
    background-color: #f8fafc;
    color: #263442;
    border: 1px solid #d9e0e7;
    border-top: 3px solid #ff8a00;
    border-radius: 5px;
}


/* =========================================================
   16 - TABLET
   ========================================================= */

@media only screen and (min-width: 768px) and (max-width: 980px) {

    .hpd-state-product-grid ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        row-gap: 22px !important;
        column-gap: 16px !important;
    }

    .hpd-state-product-grid ul.products li.product > a > img {
        height: 230px !important;
    }

    .hpd-state-product-grid ul.products li.product .woocommerce-loop-product__title {
        min-height: 66px;
        padding: 13px 13px 7px 13px !important;
    }

    .hpd-state-product-grid ul.products li.product .hpd-loop-sku {
        padding: 0 13px 6px 13px !important;
    }

    .hpd-state-product-grid ul.products li.product .price {
        margin: 0 !important;
        padding: 0 13px 15px 13px !important;
    }

    .hpd-state-product-grid .hpd-pagination-row {
        margin-top: 30px !important;
    }
}


/* =========================================================
   17 - MOBILE
   ========================================================= */

@media only screen and (max-width: 767px) {

    .hpd-state-product-grid,
    .hpd-state-product-grid .et_pb_module_inner {
        width: 100% !important;
        max-width: 100% !important;
    }

    .hpd-state-product-grid .woocommerce-result-count {
        float: none !important;
        width: 100%;
        margin-bottom: 10px !important;
    }

    .hpd-state-product-grid .woocommerce-ordering {
        float: none !important;
        width: 100%;
        margin-bottom: 20px !important;
    }

    .hpd-state-product-grid .woocommerce-ordering select {
        width: 100%;
        min-width: 0;
    }

    /* Mobile: one true full-width product column */
    .hpd-state-product-grid ul.products {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        width: 100% !important;
        max-width: 100% !important;
        row-gap: 16px !important;
        column-gap: 0 !important;
    }

    /*
     * Strong Divi/WooCommerce mobile override.
     * Divi can apply its own responsive 2-column width to product cards.
     * These selectors intentionally outrank those rules so HPD uses
     * one true full-width product card on phones.
     */
    .hpd-state-product-grid ul.products li.product,
    .hpd-state-product-grid ul.products.columns-2 li.product,
    .hpd-state-product-grid ul.products.columns-3 li.product,
    .hpd-state-product-grid ul.products.columns-4 li.product,
    .hpd-state-product-grid.et_pb_wc_products ul.products li.product,
    .hpd-state-product-grid.et_pb_wc_products ul.products.columns-4 li.product,
    .hpd-state-product-grid .et_pb_wc_products ul.products li.product,
    .hpd-state-product-grid .et_pb_wc_products ul.products.columns-4 li.product {
        float: none !important;
        clear: both !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .hpd-state-product-grid ul.products li.product > a {
        width: 100% !important;
        max-width: 100% !important;
    }

    .hpd-state-product-grid ul.products li.product > a > img {
        width: 100% !important;
        height: 260px !important;
    }

    .hpd-state-product-grid ul.products li.product .woocommerce-loop-product__title {
        min-height: 0;
        padding: 14px 14px 7px 14px !important;
        font-size: 16px !important;
        font-weight: 400 !important;
    }

    .hpd-state-product-grid ul.products li.product .hpd-loop-sku {
        padding: 0 14px 6px 14px !important;
        font-size: 12px !important;
    }

    .hpd-state-product-grid ul.products li.product .price {
        margin: 0 !important;
        padding: 0 14px 16px 14px !important;
        font-size: 16px !important;
    }

    /* Mobile: View All + pagination stay centered on one line */
    .hpd-state-product-grid .hpd-pagination-row {
        gap: 6px !important;
        margin: 28px 0 12px 0 !important;
    }

    .hpd-state-product-grid .hpd-view-all-controls {
        margin: 0 !important;
    }

    .hpd-state-product-grid .hpd-view-all-button {
        min-height: 35px !important;
        height: 35px !important;
        padding: 0 12px !important;
        font-size: 13px !important;
    }

    .hpd-state-product-grid nav.woocommerce-pagination {
        margin: 0 !important;
    }
}


/* =========================================================
   18 - SMALL MOBILE
   ========================================================= */

@media only screen and (max-width: 480px) {

    .hpd-state-product-grid ul.products li.product > a > img {
        height: 230px !important;
    }

    .hpd-state-product-grid .hpd-view-all-button {
        min-height: 35px !important;
        height: 35px !important;
        padding: 0 10px !important;
        font-size: 12px !important;
    }

    .hpd-state-product-grid nav.woocommerce-pagination ul {
        gap: 4px !important;
    }

    .hpd-state-product-grid nav.woocommerce-pagination ul li a,
    .hpd-state-product-grid nav.woocommerce-pagination ul li span {
        min-width: 35px;
        height: 35px;
        padding: 0 8px !important;
        font-size: 13px !important;
    }
}
