/**
 * =========================================================
 * PRODUCT LIVE FILTER
 * =========================================================
 */


/* =========================================================
   1. GLOBAL
   ========================================================= */

.plf {
    width: 100%;
    position: relative;
}

.plf *,
.plf *::before,
.plf *::after {
    box-sizing: border-box;
}


/* =========================================================
   2. FILTER BAR
   ========================================================= */

/* Prevent theme wrappers from clipping sticky elements */
#plf-product-filter,
.site-content,
.entry-content,
.main-content {
    overflow: visible !important;
}

/**
 * =========================================================
 * CONTAINER-BOUND STICKY FILTER BAR
 * =========================================================
 */

/* 1. Prevent theme containers from clipping sticky elements */
#plf-product-filter,
.site-content,
.entry-content,
.main-content,
.ast-container,      /* Astra theme wrapper */
.elementor-section   /* Elementor section wrapper */ {
    overflow: visible !important;
}

/**
 * =========================================================
 * PRODUCT LIVE FILTER - COMBINED STICKY & FLEXBOX CSS
 * =========================================================
 */

/* 1. Prevent theme containers from clipping sticky elements */
#plf-product-filter,
.site-content,
.entry-content,
.main-content,
.ast-container,
.elementor-section {
    overflow: visible !important;
}

/* 2. Main Filter Container (Sticky + Flexbox combined) */
.plf__filters {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 80px !important; /* Distance below your theme header/navbar */
    z-index: 99 !important;
    
    
    /* Flexbox layout */
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
    align-items: center !important;
    
    /* Box sizing & spacing */
    width: 100% !important;
    box-sizing: border-box !important;
    /* padding: 16px 20px !important; */
    margin-bottom: 24px !important;
    
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04); /* Subtle shadow when sticky */
}

/* 3. Search Bar - Flexes to fill remaining space */
.plf__search {
    position: relative;
    flex: 1 1 300px !important;
    display: flex;
    align-items: center;
}

.plf__search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.plf__search-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.plf__search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #6b7280;
    pointer-events: none;
}

/* 4. Dropdown Wrappers - Fixed flexible widths */
.plf__select-wrap {
    flex: 0 1 220px !important;
    min-width: 180px;
}

.plf__select {
    width: 100%;
    padding: 10px 16px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    cursor: pointer;
    outline: none;
}

/* 5. Account for WordPress Admin Bar (Logged-in users) */
body.logged-in .plf__filters {
    top: 112px !important; /* 80px navbar + 32px admin bar */
}

/* 6. Mobile Responsiveness */
@media screen and (max-width: 782px) {
    body.logged-in .plf__filters {
        top: 126px !important; /* 80px navbar + 46px mobile admin bar */
    }

    .plf__filters {
        flex-direction: column;
        align-items: stretch;
    }

    .plf__search,
    .plf__select-wrap {
        flex: 1 1 100% !important;
        width: 100% !important;
    }
}

/* =========================================================
   3. SEARCH
   ========================================================= */

.plf__search {
    position: relative;
    flex: 1 1 300px; /* Grow to fill space, shrink if needed, min-width 300px */
    display: flex;
    align-items: center;
}

.plf__search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #6b7280;
    pointer-events: none;
}

.plf__search-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.plf__search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.plf__search-input::placeholder {
    color: #929292;
}

.plf__search-input:hover {
    border-color: #bdbdbd;
}

.plf__search-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}


/* =========================================================
   4. DROPDOWNS
   ========================================================= */

.plf__select-wrap {
    flex: 0 1 220px; /* Fixed target width of 220px, shrinks on smaller screens */
    min-width: 180px;
}

.plf__select {
    width: 100%;
    padding: 10px 16px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    cursor: pointer;
    outline: none;
}

.plf__select:hover {
    border-color: #bdbdbd;
}

.plf__select:focus {
    border-color: #789c6a;

    box-shadow:
        0 0 0 3px rgba(120, 156, 106, 0.12);
}

.plf__select:disabled {
    opacity: 0.55;
    cursor: wait;
}


/* =========================================================
   5. PRODUCT COUNT
   ========================================================= */

.plf__result-info {
    display: flex;
    align-items: center;

    min-height: 25px;

    margin-bottom: 15px;
}

.plf__count {
    color: #777777;

    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
}


/* =========================================================
   6. PRODUCT GRID
   ========================================================= */

.plf__grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 24px;

    width: 100%;
}


/* =========================================================
   7. PRODUCT CARD
   ========================================================= */

.plf__card {
    position: relative;

    min-width: 0;
    width: 100%;

    background: #ffffff;

    border: 1px solid #eeeeee;
    border-radius: 20px;

    overflow: hidden;

    box-shadow:
        0 3px 15px rgba(0, 0, 0, 0.035);

    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease,
        border-color 0.3s ease;
}

.plf__card:hover {
    transform: translateY(-5px);

    border-color: #e1e1e1;

    box-shadow:
        0 14px 35px rgba(0, 0, 0, 0.09);
}


/* =========================================================
   8. CARD LINK
   ========================================================= */

.plf__card-link {
    display: flex;
    flex-direction: column;

    width: 100%;
    height: 100%;

    color: inherit;

    text-decoration: none !important;
}

.plf__card-link:hover,
.plf__card-link:focus {
    color: inherit;
    text-decoration: none !important;
}


/* =========================================================
   9. PRODUCT IMAGE
   ========================================================= */

.plf__image-wrap {
    position: relative;

    width: 100%;

    aspect-ratio: 1 / 0.93;

    overflow: hidden;

    background: #f4f4f1;
    height: 200px;
}

.plf__image {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;

    transform: scale(1);

    transition:
        transform 0.5s ease;
}

.plf__card:hover .plf__image {
    transform: scale(1.035);
}


/* Image fallback */

.plf__image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;

    padding: 30px;

    color: #999999;

    font-size: 13px;
    text-align: center;
}


/* =========================================================
   10. CARD CONTENT
   ========================================================= */

.plf__card-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    flex: 1;

    padding: 22px 21px 23px;
}


/* =========================================================
   11. PRODUCT TITLE
   ========================================================= */

.plf__card-title {
    margin: 0;

    color: #202020;

    font-family: inherit;

    font-size: 19px;
    font-weight: 600;
    line-height: 1.3;

    letter-spacing: -0.2px;
}


/* =========================================================
   12. BOTANICAL NAME
   ========================================================= */

.plf__botanical-name {
    margin: 6px 0 0;

    color: #777777;

    font-family: inherit;

    font-size: 13px;
    font-weight: 400;
    font-style: italic;

    line-height: 1.45;
}


/* =========================================================
   13. CATEGORY PILL
   ========================================================= */

.plf__category-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: auto;
    max-width: 100%;

    margin-top: 14px;

    padding: 5px 12px;

    background: #edf4e9;

    border: 1px solid #dce9d5;
    border-radius: 50px;

    color: #638456;

    font-family: inherit;

    font-size: 11px;
    font-weight: 500;
    line-height: 1.25;

    white-space: normal;
}


/* =========================================================
   14. EXCERPT
   ========================================================= */

.plf__excerpt {
    margin: 15px 0 0;

    color: #777777;

    font-family: inherit;

    font-size: 13px;
    font-weight: 400;

    line-height: 1.65;

    /*
     * PHP already limits this to 20 words.
     * This prevents unusually long content from
     * breaking the card height.
     */
    display: -webkit-box;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;

    overflow: hidden;
}


/* =========================================================
   15. INITIAL LOADER
   ========================================================= */

.plf__loader {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 10px;

    width: 100%;

    padding: 60px 20px;

    color: #777777;

    font-size: 14px;
}


/* =========================================================
   16. INFINITE SCROLL LOADER
   ========================================================= */

.plf__load-more {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 10px;

    width: 100%;

    padding: 35px 20px 20px;

    color: #777777;

    font-size: 13px;
}


/* =========================================================
   17. SPINNER
   ========================================================= */

.plf__spinner {
    display: inline-block;

    width: 22px;
    height: 22px;

    flex: 0 0 22px;

    border: 2px solid #e1e1e1;
    border-top-color: #719164;
    border-radius: 50%;

    animation:
        plf-spinner 0.7s linear infinite;
}

@keyframes plf-spinner {

    to {
        transform: rotate(360deg);
    }

}


/* =========================================================
   18. EMPTY STATE
   ========================================================= */

.plf__empty {
    width: 100%;

    padding: 70px 20px;

    text-align: center;
}

.plf__empty-icon {
    display: block;

    width: 48px;
    height: 48px;

    margin: 0 auto 17px;

    color: #aaaaaa;
}

.plf__empty-title {
    margin: 0 0 5px;

    color: #333333;

    font-size: 18px;
    font-weight: 600;
}

.plf__empty-text {
    margin: 0;

    color: #999999;

    font-size: 14px;
}


/* =========================================================
   19. ERROR STATE
   ========================================================= */

.plf__error {
    width: 100%;

    margin: 20px 0;

    padding: 35px 20px;

    background: #fafafa;

    border: 1px solid #eeeeee;
    border-radius: 16px;

    text-align: center;
}

.plf__error p {
    margin: 0 0 15px;

    color: #666666;

    font-size: 14px;
}

.plf__retry {
    min-height: 42px;

    padding: 9px 22px;

    border: 0;
    border-radius: 50px;

    background: #6e9061;
    color: #ffffff;

    font-family: inherit;
    font-size: 14px;
    font-weight: 500;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
}

.plf__retry:hover {
    opacity: 0.9;
}

.plf__retry:active {
    transform: scale(0.97);
}


/* =========================================================
   20. INFINITE SCROLL SENTINEL
   ========================================================= */

.plf__sentinel {
    width: 100%;
    height: 2px;

    pointer-events: none;
}


/* =========================================================
   21. HIDDEN ELEMENTS
   ========================================================= */

.plf [hidden] {
    display: none !important;
}


/* =========================================================
   22. TABLET / SMALL LAPTOP
   ========================================================= */

@media (max-width: 1200px) {

    .plf__filters {
        grid-template-columns:
            minmax(260px, 1fr)
            230px
            230px;
    }

    .plf__grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

}


/* =========================================================
   23. TABLET
   ========================================================= */

@media (max-width: 900px) {

    .plf__filters {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .plf__search {
        grid-column: 1 / -1;
    }

    .plf__grid {
        gap: 20px;
    }

}


/* =========================================================
   24. MOBILE / SMALL TABLET
   ========================================================= */

@media (max-width: 700px) {

    .plf__grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 15px;
    }

    .plf__card {
        border-radius: 16px;
    }

    .plf__card-content {
        padding: 16px;
    }

    .plf__card-title {
        font-size: 17px;
    }

    .plf__excerpt {
        font-size: 12px;
    }

}


/* =========================================================
   25. MOBILE FILTERS
   ========================================================= */

@media (max-width: 560px) {

    .plf__filters {
        grid-template-columns: 1fr;

        gap: 10px;

        margin-bottom: 14px;
    }

    .plf__search {
        grid-column: auto;
    }

    .plf__search-input,
    .plf__select {
        height: 47px;

        font-size: 14px;
    }

    .plf__image{
        height: 100% !important;
    }

}


/* =========================================================
   26. SMALL MOBILE
   ========================================================= */

@media (max-width: 430px) {

    .plf__grid {
        grid-template-columns: 1fr;

        gap: 18px;
    }

    .plf__card {
        max-width: 100%;
    }

    .plf__image-wrap {
        aspect-ratio: 1 / 0.88;
    }

    .plf__card-content {
        padding: 19px;
    }

    .plf__card-title {
        font-size: 18px;
    }

    .plf__botanical-name {
        font-size: 13px;
    }

    .plf__excerpt {
        font-size: 13px;
    }

}


@media (max-width: 640px) {
    .plf__filters {
        flex-direction: column;
        align-items: stretch;
    }

    .plf__search,
    .plf__select-wrap {
        flex: 1 1 100%;
        width: 100%;
    }
}


/* Container for multiple category pills */
.plf__categories-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
    margin-bottom: 8px;
}




