/**
 * Products List Styles
 * Shortcode: [mcp_products]
 */

.mcp-products-list {
    /* Container styles - to be implemented */
    container-type: inline-size;
}

.mcp-products-loading {
    padding: 20px;
    text-align: center;
}

.mcp-products-container {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;

    &[data-responsive="0"] {
        @container (width > 500px) {
            grid-template-columns: repeat(2, 1fr);
        }
        @container (width > 800px) {
            grid-template-columns: repeat(3, 1fr);
        }
        @container (width > 1200px) {
            grid-template-columns: repeat(4, 1fr);
        }
    }

    &[data-responsive="1"] {
        @container (width > 500px) {
            grid-template-columns: repeat(2, 1fr);
        }
        @container (width > 1000px) {
            grid-template-columns: repeat(4, 1fr);
        }
    }
    gap: 25px;

    & p {
        padding: 0;
    }

    &.hidden {
        display: none;
    }

    & .product-item {
        display: inline-flex;
        flex-grow: 0;
        flex-direction: column;
        justify-content: flex-end;
        background-color: #fff;
        border-radius: 6px;
        padding: 20px 15px;

        & .product-item-header {
            display: flex;
            align-items: center;
            color: #ed5258;
            font-size: 1.3rem;
            &:not(:empty) {
                margin-bottom: 10px;
            }

            & .product-item-discount {
                margin-left: auto;
                display: none;
            }

            & .product-item-outofstock {
                display: none;
                margin-left: auto;
                background-color: #ed5258;
                color: #fff;
                padding: 2px 5px;
                border-radius: 10px;
                font-size: 0.75rem;
            }
        }

        & .product-item-image {
            width: 100%;
            aspect-ratio: 4/3;
            object-fit: contain;
        }

        & .product-item-short-actions {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 10px;
            margin-top: 10px;

            & > button {
                display: flex;
                align-items: center;
                justify-content: center;
                border-radius: 100vmax;
                width: 40px;
                aspect-ratio: 1/1;
                background-color: #fff;
                border: 1px solid #000;
                color: #000;
                cursor: pointer;
                transition:
                    color 0.2s ease,
                    background-color 0.2s ease,
                    border-color 0.2s ease;

                &:hover,
                &:focus-visible {
                    background-color: #ffbc34;
                    color: #fff;
                    border-color: #ffbc34;
                }

                & > svg {
                    width: 18px;
                }
            }
        }

        & .product-item-title {
            font-size: 1rem;
            font-weight: medium;
            color: #000;
            text-align: center;
            margin-top: 15px;
            /* overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap; */
            overflow: hidden;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }

        & .product-item-price {
            text-align: center;
            margin-top: 5px;

            & .product-item-price-regular {
                color: #ed5258;
                text-decoration: line-through;
            }

            & .product-item-price-sale,
            & .product-item-price-regular:not(:has(+ .product-item-price-sale)) {
                color: #000;
                font-size: 1.1rem;
                font-weight: bold;
                text-decoration: none;
            }
        }

        @container (width < 625px) {
            /* Mobile styles */
        }
    }
}

.mcp-products-pagination {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 15px;
    column-gap: 10px;
    /* grid-template-columns: 1fr 2fr 1fr; */
    align-items: center;
    margin-top: 25px;

    &.hidden {
        display: none !important;
    }

    @container (width < 750px) {
        flex-direction: column;
    }

    & .pagination-results-count {
        font-size: 1.2rem;
        font-weight: bold;
        color: #000;
    }

    & .pagination-buttons {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;

        & .mcp-product-page-btn:not(.active) {
            background-color: #fff;
            border: 1px solid rgba(0, 0, 0, 0.25);
            color: #000;
        }

        & .mcp-product-page-prev:disabled,
        & .mcp-product-page-next:disabled {
            display: none;
        }
        @container (width < 600px) {
            & .mcp-product-page-prev,
            & .mcp-product-page-next {
                display: none;
            }
        }

        & .mcp-product-page-next {
            order: 100;
        }
    }

    & button {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        gap: 5px;
        background-color: #48b4cf;
        color: #fff;
        border: 1px solid #48b4cf;
        border-radius: 4px;
        font-size: 1rem;
        padding-inline: 10px;
        min-width: 40px;
        height: 40px;
        cursor: pointer;

        &:disabled {
            cursor: auto;
        }
    }

    @container (width < 350px) {
        flex-direction: column;
        & button {
            min-width: 35px !important;
            height: 35px !important;
        }
    }
}
