/* ============================
 * Regioner – drzewko kategorii (Styl Clean/Listowy)
 * ============================ */

.regioner-cat-tree {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

/* --- Wyszukiwarka --- */
.regioner-cat-tree__search {
    position: relative;
    margin-bottom: 20px;
}

.regioner-cat-tree__search-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.regioner-cat-tree__search-input:focus {
    border-color: #aaa;
}

.regioner-cat-tree__search-input::placeholder {
    color: #999;
}

/* Lista podpowiedzi */
.regioner-cat-tree__suggestions {
    display: none;
    z-index: 100;
    top: 100%;
    left: 0;
    right: 0;
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.regioner-cat-tree__suggestions--visible {
    display: block;
}

.regioner-cat-tree__suggestion {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}
.regioner-cat-tree__suggestion:last-child {
    border-bottom: none;
}
.regioner-cat-tree__suggestion:hover {
    background: #f9f9f9;
}

/* --- Drzewo --- */
.regioner-cat-tree__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Ukrywanie itemów przez filtr JS */
.regioner-cat-tree__item--hidden-by-filter {
    display: none !important;
}

/* Wiersz pojedynczego elementu */
.regioner-cat-tree__item-inner {
    display: flex;
    align-items: center;
    padding: 5px 0;
    /* Flex wrap off to keep strict single line */
    flex-wrap: nowrap;
}

/* Link i Nazwa */
.regioner-cat-tree__link {
    text-decoration: none;
    color: inherit;
    flex: 0 1 auto; /* pozwala się kurczyć tekstowi */
    display: flex;
    align-items: center;
    min-width: 0; /* dla ellipsis */
    margin-right: 1px;
}

.regioner-cat-tree__name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

.regioner-cat-tree__link:hover .regioner-cat-tree__name-text {
    text-decoration: underline;
}

/* Licznik: szary, po prawej stronie */
.regioner-cat-tree__count {
    margin-left: auto; /* Pcha licznik maksymalnie w prawo */
    color: #c1c1c1;
    font-size: 11px;
    flex-shrink: 0;
}

/* Ukrywamy licznik "0" lub "(0)" jeśli tak wolisz, 
   na zrzucie są widoczne małe liczby, np (1).
   Tu opcjonalnie: ukryj jeśli pusty */
.regioner-cat-tree__count:empty {
    display: none;
}

/* --- Toggle Button (Strzałka) --- */
.regioner-cat-tree__toggle {
    border: none;
    background: transparent;
    padding: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin-right: 4px; /* odstęp od nazwy */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    /* Kolejność we flexbox jest ustalona w HTML, 
       button jest po linku. */
}

/* Rysowanie strzałki CSS-em (trójkącik) */
.regioner-cat-tree__toggle::before {
    content: '';
    display: inline-block;
    width: 0; 
    height: 0; 
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #666; /* Strzałka w dół (default expanded look?) */
    transition: transform 0.2s;
}

/* Logika strzałek:
   Na zrzucie podkategorie są zwinięte lub rozwinięte.
   Jeśli element jest ZAMKNIĘTY (brak klasy --open), strzałka powinna wskazywać w prawo/lewo?
   Zazwyczaj: 'Right' = collapsed, 'Down' = expanded.
*/

/* Domyślny stan (rozwiń) - strzałka w prawo? 
   W CSS wyżej dałem border-top (w dół). 
   Zróbmy tak: domyślnie strzałka w prawo (collapsed).
*/
.regioner-cat-tree__toggle::before {
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid #666; /* W prawo */
}

/* Jeśli otwarty (--open) -> obrót w dół */
.regioner-cat-tree__item--open > .regioner-cat-tree__item-inner .regioner-cat-tree__toggle::before {
    transform: rotate(90deg);
}

/* --- Style dla Depth 0 (Główne kategorie) --- */
.regioner-cat-tree__item--depth-0 {
    margin-bottom: 15px; /* Odstęp między sekcjami */
}

.regioner-cat-tree__item--depth-0 > .regioner-cat-tree__item-inner {
}

.regioner-cat-tree__item--depth-0 .regioner-cat-tree__name {
    font-weight: 300;
    font-size: 14px;
    color: #2e2e2e;
}

/* Ikona przy głównej kategorii */
.regioner-cat-tree__name-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 2px;
    flex-shrink: 0;
}
.regioner-cat-tree__name-icon img {
    width: 32px;
    height: 32px;
    min-width: 32px;
    object-fit: contain;
    margin-right: 7px;
    transition: opacity 0.15s ease-in;
}
.regioner-cat-tree__name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}



/* --- Style dla Depth 1+ (Podkategorie) --- */

/* Wcięcia */
.regioner-cat-tree__list--depth-1 {
    padding-left: 0; /* Reset */
}
.regioner-cat-tree__list--depth-1 > li > .regioner-cat-tree__item-inner {
    padding-left: 10px;
    padding-top: 0px;
    padding-bottom: 0px;
}
.regioner-cat-tree__list--depth-2 > li > .regioner-cat-tree__item-inner {
    padding-left: 25px;
    padding-top: 0;
    padding-bottom: 0;
}
.regioner-cat-tree__list--depth-3 > li > .regioner-cat-tree__item-inner {
    padding-left: 40px;
}

.regioner-cat-tree__item--depth-1 .regioner-cat-tree__item--current .regioner-cat-tree__name-text {
    font-weight: 700;
    color: #0284c7;
    text-decoration: underline;
}

.regioner-cat-tree__item--depth-0 .regioner-cat-tree__item--current .regioner-cat-tree__name-text {
    font-weight: 700;
    color: #0284c7;
    text-decoration: underline;
}

/* Sub-kategorie tekst zwykły */
.regioner-cat-tree__item--depth-1 .regioner-cat-tree__name, 
.regioner-cat-tree__item--depth-2 .regioner-cat-tree__name {
    font-weight: 300;
    color: #2e2e2e;
    margin-top: 4px;
}

.regioner-cat-tree__list .regioner-cat-tree__list--depth-1 {
    margin-bottom: 41px;
    margin-left: 20px;
    margin-top: 13px!important;
}

.regioner-cat-tree__list .regioner-cat-tree__list--depth-2 {
    margin-top: 13px!important;   
    margin-bottom: 21px;
}

/* --- Mechanizm Zwijania/Rozwijania --- */
.regioner-cat-tree__item--has-children > .regioner-cat-tree__list {
    display: none;
}
.regioner-cat-tree__item--has-children.regioner-cat-tree__item--open > .regioner-cat-tree__list {
    display: block;
    margin-top: 0;
}

.regioner-cat-tree__toggle {
    border: none;
    background: transparent;
    padding: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin-right: 4px; /* odstęp od nazwy */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.regioner-cat-tree__toggle::before {
    content: '';
    display: inline-block;
    width: 0; 
    height: 0; 
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #666; /* Strzałka w dół (default) */
    transition: transform 0.2s;
}

.regioner-cat-tree__item--open > .regioner-cat-tree__item-inner .regioner-cat-tree__toggle::before {
    transform: rotate(90deg);
}


.regioner-cat-tree__toggle {
    border: none;
    background: transparent;
    padding: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin-right: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.regioner-cat-tree__toggle::before {
    content: '';
    display: inline-block;
    width: 0; 
    height: 0; 
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #666; /* lub wersja z border-left: 5px (strzałka w bok) */
    transition: transform 0.2s;
}

.regioner-cat-tree__item--open > .regioner-cat-tree__item-inner .regioner-cat-tree__toggle::before {
    transform: rotate(90deg);
}
