/* Układ 2 kolumn z sidebar i produktami */
.wcf-container {
    display: flex !important;
    gap: 30px !important;
    margin-top: 20px !important;
    align-items: flex-start !important;
    position: relative;
}

/* Przycisk toggle filtrów na mobile */
.wcf-filters-toggle {
    display: none;
    background: #d87f00;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-weight: 700;
    font-size: 16px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 15px;
}

/* Sidebar filtrów */
.wcf-filters-column {
    width: 300px !important;
    flex-shrink: 0 !important;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    max-height: 10000px;
    opacity: 1;
}

/* Ukryj sidebar na mobile domyślnie */
@media (max-width: 768px) {
    .wcf-filters-toggle {
        display: block;
    }
    .wcf-filters-column {
        max-height: 0;
        opacity: 0;
        pointer-events: none;
        margin-bottom: 15px;
    }
    .wcf-filters-column.active {
        max-height: 10000px;
        opacity: 1;
        pointer-events: auto;
    }
}

/* Kolumna produktów */
.wcf-products-column {
    flex-grow: 1 !important;
}

/* Kontener aktywnych filtrów i sortowania - w jednej linii */
.wcf-filters-sorting-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
    z-index: 10;
    background: #fff;
    padding: 10px 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Aktywne filtry */
.wcf-active-filters {
    font-size: 14px;
    flex-grow: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wcf-active-filters .active-filter {
    background: #378936;
    color: #fff;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

/* Sortowanie */
.wcf-sorting-form {
    margin: 0;
    flex-shrink: 0;
}

.wcf-sorting-form label {
    margin-right: 10px;
    font-weight: 600;
}

.wcf-sorting-form select {
    padding: 5px 10px;
    font-size: 14px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

/* Lista kategorii hierarchiczna */
.wcf-cat-list {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0 0 20px 0 !important;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    background: #fafafa;
}

.wcf-cat-list.level-0 > li {
    padding-left: 0;
}

.wcf-cat-list.level-1 > li {
    padding-left: 20px;
}

.wcf-cat-list.level-2 > li {
    padding-left: 40px;
}

.wcf-cat-list.level-3 > li {
    padding-left: 60px;
}

.wcf-cat-item {
    position: relative;
    margin-bottom: 4px;
}

.wcf-cat-item label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
}

/* Przycisk rozwijania podkategorii */
.wcf-toggle-children {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: url('data:image/svg+xml;utf8,<svg fill="%23333" height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg"><path d="M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6z"/></svg>') no-repeat center center;
    background-size: contain;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.wcf-cat-item.has-children > ul {
    display: none;
}

.wcf-cat-item.has-children.expanded > ul {
    display: block;
}

.wcf-cat-item.has-children.expanded > .wcf-toggle-children {
    transform: translateY(-50%) rotate(90deg);
    opacity: 1;
}

/* Checkbox list */
.wcf-checkbox-list {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0 !important;
}

.wcf-checkbox-list li {
    padding: 8px 12px;
    border-bottom: 1px solid #f3f3f3;
    margin: 0 !important;
}

.wcf-checkbox-list li:last-child {
    border-bottom: none;
}

.wcf-checkbox-list label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
    font-size: 14px;
}

.wcf-checkbox-list input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 18px;
}

/* Price slider */
#price-slider {
    margin: 8px 0 12px;
}

.price-values {
    font-weight: 600;
    color: #444;
    font-size: 13px;
}

/* Buttons */
.wcf-filter-buttons {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.wcf-btn {
    padding: 10px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
}

.wcf-btn-primary {
    background: #378936;
    color: #fff;
}

.wcf-btn-primary:hover {
    opacity: 0.95;
}

.wcf-btn-secondary {
    background: #f5f5f5;
    color: #333;
}

/* Produkty grid */
.wcf-products-column .products,
.wcf-products-column .products ul.products,
.wcf-products-column ul.products,
.wcf-products-column .woocommerce ul.products {
    width: 100% !important;
    display: block;
}

.wcf-products-column .products ul.products,
.wcf-products-column ul.products,
.wcf-products-column .woocommerce ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 22px !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    box-sizing: border-box;
}

.wcf-products-column .products ul.products li.product,
.wcf-products-column ul.products li.product,
.wcf-products-column .products li.product {
    width: auto !important;
    float: none !important;
    margin: 0 !important;
    box-sizing: border-box;
}

.wcf-products-column .products ul.products li.product > * {
    box-sizing: border-box;
}

.wcf-products-column .product, 
.wcf-products-column .products .product {
    box-sizing: border-box;
}

/* Paginacja */
.wcf-pagination {
    margin-top: 28px;
    text-align: center;
}
.wcf-pagination ul {
    display: inline-flex;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.wcf-pagination ul li a,
.wcf-pagination ul li span {
    display: block;
    padding: 8px 12px;
    border: 1px solid #eee;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    font-weight: 700;
}
.wcf-pagination ul li a:hover {
    background: #a3df02;
    color: #000;
}
.wcf-pagination ul li .current {
    background: #a3df02;
    color: #000;
    border-color: #378936;
}

/* Loader */
#wcf-products.wcf-loading {
  opacity: 0.6;
  position: relative;
}
#wcf-products.wcf-loading::after {
  content: '';
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid rgba(0,0,0,0.08);
  border-top-color: #a3df02;
  animation: wcf-spin 1s linear infinite;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
@keyframes wcf-spin { to { transform: rotate(360deg); } }

/* Responsywność */
@media (max-width: 1200px) {
    .wcf-products-column .products ul.products { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 1024px) {
    .wcf-container { flex-direction: column; }
    .wcf-filters-column { width: 100%; margin-bottom: 18px; }
    .wcf-products-column .products ul.products { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 768px) {
    .wcf-filters-toggle {
        display: block;
    }
    .wcf-filters-column {
        max-height: 0;
        opacity: 0;
        pointer-events: none;
        margin-bottom: 15px;
    }
    .wcf-filters-column.active {
        max-height: 10000px;
        opacity: 1;
        pointer-events: auto;
    }
}
@media (max-width: 600px) {
    .wcf-products-column .products ul.products { grid-template-columns: 1fr !important; }
}

/* Accessibility / small tweaks */
.wcf-filter-sidebar .wcf-checkbox-list::-webkit-scrollbar { height: 8px; width: 8px; }
.wcf-filter-sidebar .wcf-checkbox-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 4px; }

/* 1. Ukrywamy podlisty domyślnie */
.wcf-cat-sublist {
    display: none;
    list-style: none;
    padding-left: 15px; /* Wcięcie dla podkategorii */
    margin: 5px 0;
}

/* 2. Pokazujemy podlistę, gdy rodzic jest rozwinięty */
.wcf-cat-item.has-children.expanded > .wcf-cat-sublist {
    display: block !important;
}

/* 3. Stylizacja kontenera elementu (relatywna dla strzałki) */
.wcf-cat-item {
    position: relative;
    padding: 5px 0;
}

/* 4. Poprawka strzałki (żeby nie uciekała przy rozwijaniu) */
.wcf-toggle-children {
    position: absolute;
    right: 0;
    top: 14px; /* Stała odległość od góry zamiast 50% */
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

/* 5. Obrót strzałki, gdy rozwinięte */
.wcf-cat-item.expanded > .wcf-toggle-children {
    transform: rotate(180deg);
}

/* 6. Wygląd samej strzałki (ikona) */
.wcf-toggle-children::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #666; /* Kolor strzałki */
}