/* =====================================================
   Woo Products Grid for Elementor — Frontend CSS
   Author: Marcin Cija
   ===================================================== */

.wpg-products-grid-wrapper {
    width: 100%;
    position: relative;
}

/* ── Spinner overlay ── */
.wpg-spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 20;
}

.wpg-spinner-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.wpg-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(76, 108, 86, 0.2);
    border-top-color: #4C6C56;
    border-radius: 50%;
    animation: wpg-spin 0.65s linear infinite;
}

@keyframes wpg-spin {
    to { transform: rotate(360deg); }
}

/* ── Filter bar ── */
.wpg-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.wpg-filter-btn {
    display: inline-block;
    cursor: pointer;
    border: none;
    background-color: #f0f0f0;
    color: #333;
    padding: 8px 20px;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.4;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    outline: none;
    white-space: nowrap;
}

.wpg-filter-btn:hover,
.wpg-filter-btn.active {
    background-color: #111;
    color: #fff;
}

/* ── Grid ── */
.wpg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 24px;
    row-gap: 24px;
}

/* ── Product tile ── */
.wpg-product-tile {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.wpg-product-tile.wpg-hidden {
    display: none;
}

/* ── Panele filtrowania (per kategoria) ── */
.wpg-panel {
    width: 100%;
}

.wpg-panel--hidden {
    display: none;
}

.wpg-tile-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.wpg-tile-link:hover {
    text-decoration: none;
    color: inherit;
}

/* ── Badge bar (nad zdjęciem, własny wiersz) ── */
.wpg-badge-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
    margin-bottom: 6px;
}

/* ── Image wrap (relative — dla badge overlay) ── */
.wpg-product-image-wrap {
    position: relative;
    flex-shrink: 0;
}

/* ── Badge ── */
.wpg-badge {
    display: inline-block;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    background-color: #e74c3c;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
}

/* Badge overlay — absolute nad zdjęciem */
.wpg-badge-overlay {
    position: absolute;
    z-index: 10;
    pointer-events: none;
    top: 12px;
    left: 12px;
}

/* ── Product image ── */
.wpg-product-image {
    width: 100%;
    height: 260px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
}

.wpg-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.wpg-product-tile:hover .wpg-product-image img {
    transform: scale(1.04);
}

/* ── Gallery hover swap ── */
.wpg-product-image .wpg-hover-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: 2;
}
.wpg-product-image { position: relative; }
.wpg-product-tile:hover .wpg-hover-img {
    opacity: 1;
}

/* ── Product info ── */
.wpg-product-info {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 0 0;
    flex: 1;
}

.wpg-product-name {
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    word-break: break-word;
    color: #222;
    font-size: 15px;
    font-weight: 500;
}

.wpg-product-price {
    flex-shrink: 0;
    text-align: right;
}

.wpg-product-price .woocommerce-Price-amount,
.wpg-product-price .price {
    white-space: nowrap;
    color: #222;
    font-size: 15px;
    font-weight: 600;
}

.wpg-product-price del,
.wpg-product-price .price del {
    display: block;
    color: #999;
    font-size: 13px;
    font-weight: 400;
}

.wpg-product-price ins,
.wpg-product-price .price ins {
    text-decoration: none;
    display: block;
}

/* ── See all section ── */
.wpg-see-all-section {
    display: flex;
    justify-content: center;
    padding-top: 36px;
}

.wpg-see-all-btn {
    display: inline-block;
    cursor: pointer;
    text-decoration: none;
    background-color: #222;
    color: #fff;
    padding: 14px 44px;
    font-family: inherit;
    font-size: inherit;
    font-weight: 500;
    line-height: 1.4;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    border: none;
    outline: none;
}

.wpg-see-all-btn:hover {
    text-decoration: none;
    color: #fff;
}

/* ── Paginacja ── */
.wpg-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 40px;
    list-style: none;
    padding: 0;
}

.wpg-pagination a,
.wpg-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    background-color: #f0f0f0;
    color: #333;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
    box-sizing: border-box;
    cursor: pointer;
}

.wpg-pagination a:hover {
    background-color: #e0e0e0;
    color: #111;
    text-decoration: none;
}

.wpg-pagination span.current {
    background-color: #111;
    color: #fff;
    cursor: default;
}

.wpg-pagination .dots {
    background: none;
    cursor: default;
    color: #999;
}

/* ── No products ── */
.wpg-no-products {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    padding: 40px 0;
}

/* ── Responsive fallbacks (Elementor nadpisuje przez selectors) ── */
@media (max-width: 1024px) {
    .wpg-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .wpg-grid {
        grid-template-columns: 1fr;
    }
    .wpg-filter-bar {
        flex-wrap: wrap;
    }
}
