
/*
 * KG Code – Product Catalog
 */


/* =========================================
   CATALOG TOOLBAR
========================================= */

.kgcode-catalog {
    width: 100%;
}

.kgcode-catalog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 42px;
}

.kgcode-catalog-navigation {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}


/* =========================================
   FILTER OPEN BUTTON
========================================= */

.kgcode-catalog-filter-open {
    min-height: 42px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;

    background: #fff;
    border: 3px solid #328572;
    border-radius: 30px;

    color: #328572;
    font-size: 14px;
    font-weight: 700;

    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.kgcode-catalog-filter-open:hover {
    background: #328572;
    color: #fff;
}

.kgcode-catalog-filter-open img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.kgcode-catalog-filter-open:hover img {
    filter: brightness(0) invert(1);
}


/* =========================================
   CATEGORY BUTTONS
========================================= */

.kgcode-catalog-category-button,
.kgcode-catalog-filter-button {
    min-height: 40px;
    padding: 0 18px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: #fff;
    border: 1px solid #ccc;
    border-radius: 30px;

    color: #222;
    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
    transition: all 0.2s;
}

.kgcode-catalog-category-button:hover,
.kgcode-catalog-filter-button:hover {
    border-color: #328572;
    color: #328572;
}

.kgcode-catalog-category-button.is-active,
.kgcode-catalog-filter-button.is-active {
    background: #328572;
    border-color: #328572;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}


/* =========================================
   SORTING
========================================= */

.kgcode-catalog-sorting {
    flex: 0 0 auto;
}

.kgcode-catalog-sort {
    min-height: 40px;
    padding: 0 38px 0 16px;

    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 30px;

    color: #333;
    font-size: 14px;

    cursor: pointer;
}


/* =========================================
   CATEGORY SECTIONS
========================================= */

.kgcode-catalog-category {
    width: 100%;
    margin-bottom: 40px;
}

.kgcode-catalog-category-heading {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 16px;
}

.kgcode-catalog-category-heading h2 {
    margin: 0;
    padding: 0;

    color: #222;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
}

.kgcode-catalog-category-heading span {
    color: #777;
    font-size: 14px;
}


/* =========================================
   PRODUCT GRID
========================================= */

.kgcode-catalog .row {
    row-gap: 24px;
}

.kgcode-catalog .kgcode-bestseller-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.kgcode-catalog .kgcode-bestseller-image {
    width: 100%;
    aspect-ratio: 1 / 1;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 24px;
    overflow: hidden;

    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.20);

    margin-bottom: 12px;
}

.kgcode-catalog .kgcode-bestseller-image img {
    width: 100%;
    height: 100%;

    object-fit: contain;
    padding: 12px;

    margin: 0 !important;
}

.kgcode-catalog .kgcode-bestseller-name {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 5px;
}

.kgcode-catalog .kgcode-bestseller-details {
    font-size: 14px;
    line-height: 1.5;
    color: #777;
    margin-bottom: 10px;
}

.kgcode-catalog .kgcode-bestseller-price {
    display: flex;
    align-items: baseline;
    gap: 8px;

    margin-bottom: 16px;

    font-size: 16px;
    line-height: 1.3;
}

.kgcode-catalog .kgcode-bestseller-price strong {
    font-size: 16px;
    font-weight: 700;
    color: #000;
}

.kgcode-catalog .kgcode-bestseller-price span {
    font-size: 13px;
    color: #777;
}

.kgcode-catalog .kgcode-bestseller-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.kgcode-catalog .kgcode-bestseller-cart {
    flex: 1;
    min-width: 0;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    background: #328572;
    color: #fff !important;

    border: none;
    border-radius: 30px;

    font-size: 14px;
    font-weight: 700;
    text-decoration: none !important;

    cursor: pointer;
    transition: background 0.2s;
}

.kgcode-catalog .kgcode-bestseller-cart:hover {
    background: #246e5e;
    color: #fff !important;
}

.kgcode-catalog .kgcode-bestseller-cart img {
    width: 20px;
    height: 20px;

    filter: brightness(0) invert(1);
    object-fit: contain;
}

.kgcode-catalog .kgcode-quickview-button {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #ccc;
    border-radius: 50%;

    background: #fff;

    cursor: pointer;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.15);
}

.kgcode-catalog .kgcode-quickview-button img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.kgcode-catalog .kgcode-quickview-button:hover {
    background: #f5f5f5;
}


/* =========================================
   PROMOTIONAL PLACEHOLDER
========================================= */

.kgcode-catalog-promo-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.kgcode-catalog-promo-column {
    min-width: 0;
}

.kgcode-catalog-promo {
    width: 100%;
    height: 100%;
    min-height: 450px;

    background: #328572;
    border-radius: 24px;
}

/* When a category is selected. */
.kgcode-catalog-results > .kgcode-catalog-promo-column {
    width: calc((100% - 72px) / 4);
    max-width: calc((100% - 72px) / 4);
    margin-bottom: 40px;
}


/* =========================================
   EMPTY RESULTS
========================================= */

.kgcode-catalog-empty {
    padding: 30px 0;
    color: #777;
    font-size: 15px;
}


/* =========================================
   AJAX LOADING
========================================= */

.kgcode-catalog-products {
    position: relative;
    min-height: 100px;
    transition: opacity 0.2s;
}

.kgcode-catalog.is-loading .kgcode-catalog-products {
    opacity: 0.45;
    pointer-events: none;
}

.kgcode-catalog.is-loading .kgcode-catalog-products::after {
    content: '';

    position: absolute;
    top: 80px;
    left: 50%;

    width: 36px;
    height: 36px;

    border: 3px solid #ddd;
    border-top-color: #328572;
    border-radius: 50%;

    animation: kgcode-catalog-spinner 0.7s linear infinite;
}

@keyframes kgcode-catalog-spinner {
    to {
        transform: rotate(360deg);
    }
}


/* =========================================
   ELEMENTOR POPUP FILTERS
========================================= */

.kgcode-catalog-popup-filters {
    width: 100%;
}

.kgcode-catalog-filter-group {
    margin-bottom: 28px;
}

.kgcode-catalog-filter-group h3 {
    margin: 0 0 14px;
    padding: 0;

    color: #222;
    font-size: 20px;
    font-weight: 700;
}

.kgcode-catalog-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.kgcode-catalog-filter-button {
    min-height: 40px;
}

.kgcode-catalog-clear-filters {
    min-height: 40px;
    padding: 0 20px;

    background: transparent;
    border: 1px solid #328572;
    border-radius: 30px;

    color: #328572;
    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
    transition: all 0.2s;
}

.kgcode-catalog-clear-filters:hover {
    background: #328572;
    color: #fff;
}


/* =========================================
   TABLET
========================================= */

@media (max-width: 991px) {

    .kgcode-catalog-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .kgcode-catalog-promo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kgcode-catalog-results > .kgcode-catalog-promo-column {
        width: calc((100% - 24px) / 2);
        max-width: calc((100% - 24px) / 2);
    }

    .kgcode-catalog-category-heading h2 {
        font-size: 24px;
    }

}



/* =========================================
   CONSISTENT PRODUCT GRID
========================================= */

.kgcode-catalog .row.row-cols-1.row-cols-sm-2.row-cols-lg-4 {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));

    width: 100%;
    margin: 0 !important;

    --bs-gutter-x: 0;
    --bs-gutter-y: 0;

    gap: 24px;
    align-items: stretch;
}

.kgcode-catalog .row > .col {
    width: auto !important;
    max-width: none !important;
    min-width: 0;

    flex: none !important;

    padding: 0 !important;
}

.kgcode-catalog .kgcode-bestseller-card {
    width: 100%;
    height: 100%;
    min-width: 0;
}


/* =========================================
   PROMOTIONAL BLOCK
========================================= */

.kgcode-catalog .kgcode-catalog-promo-column {
    display: flex;
    min-width: 0;
    height: 100%;
}

.kgcode-catalog .kgcode-catalog-promo {
    width: 100%;
    height: 100%;
    min-height: 450px;
}


/* =========================================
   FILTER POPUP BUTTONS
========================================= */

.kgcode-catalog-filter-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.kgcode-catalog-clear-filters,
.kgcode-catalog-finish-filters {
    min-height: 42px;
    padding: 0 22px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #328572;
    border-radius: 30px;

    font-size: 14px;
    font-weight: 700;

    cursor: pointer;
    transition: all 0.2s;
}

/* Clear filters */
.kgcode-catalog-clear-filters {
    background: #fff;
    color: #328572;
}

.kgcode-catalog-clear-filters:hover {
    background: #f0f7f5;
    color: #246e5e;
}

/* Finish filtering */
.kgcode-catalog-finish-filters {
    background: #328572;
    color: #fff;
}

.kgcode-catalog-finish-filters:hover {
    background: #246e5e;
    color: #fff;
}


/* =========================================
   RESPONSIVE GRID
========================================= */

@media (max-width: 991px) {

    .kgcode-catalog .row.row-cols-1.row-cols-sm-2.row-cols-lg-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 575px) {

    .kgcode-catalog .row.row-cols-1.row-cols-sm-2.row-cols-lg-4 {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .kgcode-catalog-filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .kgcode-catalog-clear-filters,
    .kgcode-catalog-finish-filters {
        width: 100%;
    }

}





/* =========================================
   MOBILE
========================================= */

@media (max-width: 575px) {

    .kgcode-catalog-toolbar {
        gap: 16px;
        margin-bottom: 28px;
    }

    .kgcode-catalog-navigation {
        gap: 8px;
    }

    .kgcode-catalog-category-button,
    .kgcode-catalog-filter-button {
        min-height: 36px;
        padding: 0 13px;
        font-size: 13px;
    }

    .kgcode-catalog-filter-open {
        min-height: 38px;
        padding: 0 14px;
        font-size: 13px;
    }

    .kgcode-catalog-sorting,
    .kgcode-catalog-sort {
        width: 100%;
    }

    .kgcode-catalog-category-heading h2 {
        font-size: 22px;
    }

    .kgcode-catalog-category-heading span {
        font-size: 13px;
    }

    .kgcode-catalog .row {
        row-gap: 20px;
    }

    .kgcode-catalog-promo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .kgcode-catalog-promo {
        min-height: 280px;
    }

    .kgcode-catalog-results > .kgcode-catalog-promo-column {
        width: calc((100% - 16px) / 2);
        max-width: calc((100% - 16px) / 2);
    }

}
