/* Category Page Fixes v3.2
   1. Descriere categorie: full width cu padding interior confortabil
   2. "Mai mult": text simplu verde
   3. Card produs: imagine full width, 3px jur imprejur, 4 pe linie desktop
   4. Buton centrat pe mijloc
   5. Fix buton "Anunță-mă" — full width + centrat
   6. Mobil: tema gestioneaza cu m-grid-2 (nu suprascrie)
   7. Fix paginatie + sortare + SHOW FILTERS overflow pe mobil
*/

/* =========================================
   DESCRIERE CATEGORIE
   ========================================= */

body.tax-product_cat .term-description {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
}

body.tax-product_cat .term-description button.read-link,
body.tax-product_cat button.read-link {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-top: 8px !important;
    display: inline !important;
    font-size: inherit !important;
    color: #62ab00 !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

body.tax-product_cat .term-description button.read-link:hover,
body.tax-product_cat button.read-link:hover {
    text-decoration: underline !important;
    color: #4d8a00 !important;
}

/* =========================================
   CARD PRODUS
   ========================================= */

body.tax-product_cat ul.products {
    gap: 10px !important;
}

body.tax-product_cat ul.products li.product {
    padding: 3px !important;
    border-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    margin-bottom: 0 !important;
}

@media (min-width: 769px) {
    body.tax-product_cat ul.products li.product {
        width: calc(25% - 8px) !important;
        flex-basis: calc(25% - 8px) !important;
    }
}

body.tax-product_cat ul.products li.product:hover,
body.tax-product_cat ul.products li.product:focus-within {
    border-width: 0 !important;
}

body.tax-product_cat ul.products li.product .woocommerce-image__wrapper {
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 13px 13px 0 0 !important;
    overflow: hidden !important;
}

body.tax-product_cat ul.products li.product .woocommerce-image__wrapper img {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
}

body.tax-product_cat ul.products li.product .woocommerce-card__header {
    padding: 10px !important;
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
    align-items: center !important;
    text-align: center !important;
}

body.tax-product_cat ul.products li.product .woocommerce-card__header .price {
    margin-bottom: 10px !important;
}

body.tax-product_cat ul.products li.product .woocommerce-card__header .add_to_cart_button,
body.tax-product_cat ul.products li.product .woocommerce-card__header .button {
    position: static !important;
    margin-top: auto !important;
    align-self: center !important;
    text-align: center !important;
}

/* =========================================
   FIX: Buton "Anunță-mă când revine în stoc"
   ========================================= */

body.tax-product_cat ul.products li.product a.button:not(.add_to_cart_button) {
    width: 100% !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    padding: 10px 8px !important;
}

/* =========================================
   FIX: Sortare + Paginatie + SHOW FILTERS overflow pe mobil
   ========================================= */

@media (max-width: 992px) {
    /* Container global — nimic nu depaseste ecranul */
    body.tax-product_cat,
    body.tax-product_cat .site-content,
    body.tax-product_cat .content-area,
    body.tax-product_cat .col-full,
    body.tax-product_cat .site-main {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* SHOW FILTERS button — flex cu icon + text aliniate */
    .mobile-filter.shoptimizer-mobile-toggle {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 10px 14px !important;
        font-size: 13px !important;
    }

    /* SVG icon in SHOW FILTERS — dimensiune fixa, nu se suprapune */
    .mobile-filter.shoptimizer-mobile-toggle svg {
        width: 20px !important;
        min-width: 20px !important;
        height: 20px !important;
        flex-shrink: 0 !important;
    }

    .shoptimizer-sorting {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .shoptimizer-sorting .woocommerce-ordering {
        max-width: 100% !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .shoptimizer-sorting .woocommerce-ordering select {
        max-width: 100% !important;
        width: 100% !important;
        text-overflow: ellipsis !important;
    }

    .shoptimizer-sorting .woocommerce-result-count {
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .shoptimizer-sorting .woocommerce-pagination {
        grid-column: span 2 !important;
        max-width: 100% !important;
    }

    .woocommerce-pagination ul.page-numbers {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 3px !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .woocommerce-pagination ul.page-numbers li {
        margin: 0 !important;
        padding: 0 !important;
    }
}

@media (max-width: 768px) {
    /* Sorting + result count: font 11px */
    .shoptimizer-sorting .woocommerce-ordering select {
        font-size: 11px !important;
        padding-right: 14px !important;
    }

    .shoptimizer-sorting .woocommerce-result-count {
        font-size: 11px !important;
    }

    /* Paginatie butoane 30x30 — mai vizibile */
    .woocommerce-pagination ul.page-numbers li a,
    .woocommerce-pagination ul.page-numbers li span {
        min-width: 30px !important;
        height: 30px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 12px !important;
        padding: 0 2px !important;
        margin: 0 !important;
        border-width: 1px !important;
    }

    .woocommerce-pagination ul.page-numbers li a.prev,
    .woocommerce-pagination ul.page-numbers li a.next {
        min-width: 30px !important;
        padding: 0 3px !important;
    }

    .woocommerce-pagination ul.page-numbers li span.page-numbers.dots {
        min-width: 16px !important;
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
    }
}
