/*
 Theme Name:   Royal Elementor Kit Child
 Template:     royal-elementor-kit
*/

.wpr-quantity-wrapper,
.woocommerce-result-count,
.woocommerce-ordering {
    display: none !important;
}

/* KONTENER GŁÓWNY */
.custom-shop-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    max-width: 1600px;
    margin: 130px auto 40px;
    padding: 0 20px;
}

.custom-shop-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.custom-shop-content {
    flex-grow: 1;
    width: calc(100% - 310px);
}

.custom-shop-sidebar .sidebar-inner {
    background: #f4f4f4;
    padding: 20px;
    border-radius: 15px;
    position: sticky;
    top: 100px;
}

.filters-heading {
    font-size: 14px;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 20px;
    font-weight: 600;
}

/* SIATKA PRODUKTÓW - SZTYWNE 3 KOLUMNY */
.custom-shop-content ul.products,
.woocommerce ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important; /* Zawsze 3 kolumny */
    grid-auto-rows: minmax(350px, auto) !important;
    gap: 20px !important;
    padding: 0 !important;
    margin: 0 !important;
    column-count: auto !important;
}

.custom-shop-content ul.products li.product,
.woocommerce ul.products li.product {
    width: 100% !important;
    margin-bottom: 0 !important;
    float: none !important;
    display: flex !important;
    flex-direction: column;
}

/* --- LOGIKA DUŻEGO PRODUKTU (5. ELEMENT) --- */
@media (min-width: 769px) {
    /* 1. Ustawienie siatki dla 5. elementu (2x2) */
    .custom-shop-content ul.products li.product:nth-child(5) {
        grid-column: 2 / 4 !important;
        grid-row: span 2 !important;
    }

    /* 2. Rozciągnięcie głównego wrappera karty na pełną wysokość komórki */
    .custom-shop-content ul.products li.product:nth-child(5) .royal-custom-card-wrapper {
        height: 100% !important;
    }

    /* 3. POPRAWKA: Kontener zdjęcia ma zajmować WOLNĄ przestrzeń (flex-grow), a nie 100% sztywno */
    .custom-shop-content ul.products li.product:nth-child(5) .royal-card-image {
        height: 87.7%;
        flex-grow: 1 !important; /* To klucz do sukcesu - zdjęcie rośnie, ale nie wypycha opisu */
        min-height: 0 !important;
    }

    /* 4. Sam obrazek w środku - pozycjonowanie absolutne, żeby wypełnił kontener flexa */
    .custom-shop-content ul.products li.product:nth-child(5) .royal-card-image img {
        height: 100% !important;
        width: 100% !important;
        object-fit: cover !important;
        position: absolute;
        top: 0;
        left: 0;
    }
}

/* Stylizacja linków i kart */
.woocommerce-loop-product__link {
    text-decoration: none !important;
    color: inherit !important;
    display: block;
    height: 100%;
    position: relative;
}

.royal-custom-card-wrapper {
    border-radius: 16px;
    overflow: hidden;
    background-color: transparent;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.royal-custom-card-wrapper:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}

.royal-card-image {
    position: relative;
    margin: 0 !important;
    padding: 0 !important;
    flex-grow: 1; /* Domyślnie też niech wypełnia */
    overflow: hidden;
    min-height: 250px; 
}

.royal-card-image img {
    width: 100%;
    height: 100% !important;
    display: block;
    border: none !important;
    object-fit: cover;
    margin: 0 0 0em !important;
}

.royal-card-details {
    background-color: #EAEAEA;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    z-index: 2;
    position: relative;
    min-height: 138px;
}

.royal-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1;
}

.meta-static-text {
    text-transform: uppercase;
    color: #333;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.meta-size-value {
    color: #78A206;
    font-weight: 700;
    text-transform: uppercase;
}

h2.woocommerce-loop-product__title {
    font-size: 15px !important;
    margin: 0 0 12px 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
    color: #1A1A1A !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.title-main {
    font-weight: 500;
    color: #1A1A1A;
}

.title-suffix {
    font-weight: 400;
    color: #888888;
}

.royal-card-price {
   margin-top: 4px;
}

.royal-card-price .price {
    color: #78A206 !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    display: block;
    line-height: 1;
}

.royal-card-price .price del {
    color: #999 !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    margin-right: 8px;
    opacity: 1 !important;
}

.royal-card-price .price ins {
    text-decoration: none;
    font-weight: 700;
}

/* Ukrywanie zbędnych elementów przed/po liście produktów */
.woocommerce .products ul::after, 
.woocommerce .products ul::before, 
.woocommerce ul.products::after, 
.woocommerce ul.products::before {
    display: none !important;
}

.wpc-filter-visible-term-names{
    background-color: #fff;
    padding: 14px;
    padding-top: 26px !important;
}

a {
  background-color: transparent;
  color: #000;
}

.widget .wpc-term-count-0:not(.wpc-has-not-empty-children) a, .widget-area .widget .wpc-term-count-0:not(.wpc-has-not-empty-children) a, .widget-area .wpc-filters-labels li.wpc-term-count-0:not(.wpc-has-not-empty-children) label, .widget-area .wpc-filters-labels li.wpc-term-count-0:not(.wpc-has-not-empty-children) label span.wpc-filter-label-wrapper, .wpc-filters-labels li.wpc-term-count-0:not(.wpc-has-not-empty-children) label, .wpc-filters-labels li.wpc-term-count-0:not(.wpc-has-not-empty-children) label span.wpc-filter-label-wrapper, .wpc-term-count-0:not(.wpc-has-not-empty-children), .wpc-term-count-0:not(.wpc-has-not-empty-children) a, body .wpc-filters-main-wrap li.wpc-term-count-0:not(.wpc-has-not-empty-children) label, body .wpc-filters-main-wrap li.wpc-term-count-0:not(.wpc-has-not-empty-children) label a {
  opacity: 1 !important;
}

.page-id-509 .page-title{
    display: none;
}

.post-511 .page-title{
    display: none;
}

.post-511 .post-content{
    max-width: 1600px;
    margin: auto;
    margin-top: auto;
    margin-top: 97px;
}

@media (max-width: 1024px) {
    .custom-shop-container {
        flex-direction: column;
        margin-top: 40px;
    }
    .custom-shop-sidebar, .custom-shop-content {
        width: 100%;
    }
    .custom-shop-sidebar .sidebar-inner {
        position: static;
    }
    
    .custom-shop-content ul.products,
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Na tablecie 5. element resetujemy do normalnego rozmiaru */
    .custom-shop-content ul.products li.product:nth-child(5) {
        grid-column: auto !important;
        grid-row: auto !important;
    }
    
    /* Reset wysokości dla normalnego widoku */
    .custom-shop-content ul.products li.product:nth-child(5) .royal-card-image {
        flex-grow: 1 !important;
        height: auto !important;
    }
    .custom-shop-content ul.products li.product:nth-child(5) .royal-card-image img {
        position: relative !important;
    }
}

/* Poniżej 600px - 1 kolumna */
@media (max-width: 600px) {
    .custom-shop-content ul.products,
    .woocommerce ul.products {
        grid-template-columns: 1fr !important;
    }
}