/* ============================================================
 * WEF Product Grid — Comprehensive Styles
 * Supports all Elementor customization controls
 * ============================================================ */

.wef-grid-wrap {
    width: 100%;
    position: relative;
}

.wef-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    column-gap: 32px;
    row-gap: 64px;
    width: 100%;
}

/* ============================================================
 * Product Item / Card
 * ============================================================ */
.wef-product {
    display: flex;
    flex-direction: column;
    position: relative;
    text-align: left;
    transition: all 300ms ease;
}

.wef-product__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* ============================================================
 * Image Container — KEY: aspect-ratio + bottom-aligned
 * ============================================================ */
.wef-product__image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #ffffff;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
}

.wef-product__image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    transition: all 400ms ease;
}

/* Primary/Secondary image stacking for hover swap */
.wef-has-secondary-img .wef-product__image-wrap {
    position: relative;
}

.wef-has-secondary-img .wef-product__image--primary,
.wef-has-secondary-img .wef-product__image--secondary {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
}

.wef-has-secondary-img .wef-product__image--secondary {
    opacity: 0;
    z-index: 1;
}

.wef-has-secondary-img .wef-product__image--primary {
    opacity: 1;
    z-index: 2;
}

.wef-has-secondary-img .wef-product:hover .wef-product__image--primary {
    opacity: 0;
}

.wef-has-secondary-img .wef-product:hover .wef-product__image--secondary {
    opacity: 1;
}

/* ============================================================
 * Image Hover Effects (controlled by prefix_class)
 * Default styles - intensities are set by Elementor selectors
 * ============================================================ */
.wef-img-hover-zoom .wef-product__image {
    transform-origin: center;
}

.wef-img-hover-zoom-out .wef-product__image {
    transform-origin: center;
}

.wef-img-hover-rotate .wef-product__image {
    transform-origin: center;
}

/* ============================================================
 * Badges (Sale / OOS / Featured)
 * Sale + Featured stack on the LEFT, OOS sits on the RIGHT.
 * Using flex column stacking so user-controlled `top` offset
 * applies once and second badge auto-positions below.
 * ============================================================ */
.wef-product__badges-left {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    pointer-events: none;
}

.wef-product__badges-right {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    pointer-events: none;
}

.wef-product__badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: #ffffff;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.wef-product__badge--sale {
    background-color: #cc0000;
}

.wef-product__badge--oos {
    background-color: #7a7a7a;
}

.wef-product__badge--featured {
    background-color: #fcd669;
    color: #3a3a3a;
}

/* ============================================================
 * Categories
 * ============================================================ */
.wef-product__categories {
    font-size: 12px;
    color: #7a7a7a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 16px;
    line-height: 1.4;
}

.wef-product__categories a {
    color: inherit;
    text-decoration: none;
}

.wef-product__categories a:hover {
    color: #3a3a3a;
}

/* ============================================================
 * Rating Stars
 * ============================================================ */
.wef-product__rating {
    margin-top: 8px;
    line-height: 1;
}

.wef-product__rating .star-rating {
    font-size: 12px;
    width: 5.4em;
    height: 1em;
    overflow: hidden;
    position: relative;
    line-height: 1;
    font-family: star;
    display: inline-block;
}

.wef-product__rating .star-rating::before {
    content: "\53\53\53\53\53";
    color: #cdcdcd;
    float: left;
    top: 0;
    left: 0;
    position: absolute;
}

.wef-product__rating .star-rating span {
    overflow: hidden;
    float: left;
    top: 0;
    left: 0;
    position: absolute;
    padding-top: 1.5em;
}

.wef-product__rating .star-rating span::before {
    content: "\53\53\53\53\53";
    top: 0;
    position: absolute;
    left: 0;
    color: #fcd669;
}

/* ============================================================
 * Title
 * ============================================================ */
.wef-product__title {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: #3a3a3a;
    margin: 24px 0 16px;
    -webkit-line-clamp: 3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* When fixed-height toggle is YES (default), reserve space so prices align */
.wef-title-fixed-height-yes .wef-product__title {
    min-height: calc(1.5em * 3);
}

.wef-title-fixed-height-no .wef-product__title {
    min-height: 0;
}

.wef-product__title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.wef-product__title a:hover {
    color: #000000;
}

/* ============================================================
 * Price
 * ============================================================ */
.wef-product__price {
    font-size: 14px;
    font-weight: 400;
    color: #3a3a3a;
    line-height: 1.4;
}

.wef-product__price .price {
    display: inline;
}

.wef-product__price del {
    color: #9a9a9a;
    text-decoration: line-through;
    margin-right: 6px;
}

.wef-product__price ins {
    text-decoration: none;
}

.wef-product__price ins .amount {
    color: #cc0000;
    font-weight: 500;
}

/* ============================================================
 * Add to Cart Button
 * ============================================================ */
.wef-product__cart {
    margin-top: 12px;
}

.wef-product__cart .button,
.wef-product__cart .added_to_cart {
    display: inline-block;
    padding: 8px 16px;
    background: #3a3a3a;
    color: #ffffff;
    border: 0;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wef-product__cart .button:hover {
    background: #000000;
    color: #ffffff;
}

.wef-product__cart .added_to_cart {
    display: block;
    margin-top: 4px;
    color: #3a3a3a;
    background: transparent;
    padding: 4px 0;
    font-size: 12px;
}

/* ============================================================
 * Pagination (Standalone)
 * ============================================================ */
.wef-pagination--standalone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 48px;
}

.wef-pagination--standalone .wef-pagination__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #cdcdcd;
    border-radius: 4px;
    background: #ffffff;
    color: #3a3a3a;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.wef-pagination--standalone .wef-pagination__item:hover {
    border-color: #3a3a3a;
}

.wef-pagination--standalone .wef-pagination__item.is-current {
    background: #3a3a3a;
    color: #ffffff;
    border-color: #3a3a3a;
    cursor: default;
}

.wef-pagination--standalone .wef-pagination__dots {
    color: #7a7a7a;
    padding: 0 4px;
}

/* Standalone pagination is auto-hidden by JS when a Filter Bar
   targets the same grid (see initStandaloneGrid in filter-bar.js).
   Inline style.display = 'none' is applied; no body-class needed. */

/* ============================================================
 * Empty State
 * ============================================================ */
.wef-no-products {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: #7a7a7a;
    font-size: 16px;
}

/* ============================================================
 * Responsive
 * ============================================================ */
@media (max-width: 1024px) {
    .wef-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        column-gap: 24px;
        row-gap: 48px;
    }
}

@media (max-width: 768px) {
    .wef-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 16px;
        row-gap: 32px;
    }
    .wef-product__title {
        font-size: 13px;
        margin-top: 12px;
    }
    .wef-product__price {
        font-size: 13px;
    }
    .wef-product__badge {
        font-size: 10px;
        padding: 3px 8px;
        top: 8px;
    }
    .wef-product__badge--sale,
    .wef-product__badge--featured {
        left: 8px;
    }
    .wef-product__badge--oos {
        right: 8px;
    }
    .wef-product__badge--featured {
        top: 36px;
    }
    .wef-pagination--standalone .wef-pagination__item {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 13px;
    }
}
