/**
 * Oshen Theme — UNIFIED Filters & Categories
 * Identical design on desktop & mobile. All proportions consistent.
 * Brand: #7A9E7E | Border: #eee | Divider: #f5f5f5
 */

/* ============================================
   1. SHARED BLOCK WRAPPER
   ============================================ */
#search-filters.search-filters,
.ps-categorytree.category-tree.left-block {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 0;
    margin-bottom: 1.5rem;
}

/* ============================================
   2. UNIFIED TITLE ("Kategorijos" / "Filtruoti pagal")
   ============================================ */
.category-tree .left-block__title,
#search-filters .left-block__title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1rem 0.75rem;
    margin: 0;
    border-bottom: 1px solid #eee;
    color: #222;
}

.category-tree .left-block__title-link {
    color: #222;
    text-decoration: none;
}
.category-tree .left-block__title-link:hover { color: #7A9E7E; }

/* "Išvalyti viską" link */
.search-filters__clear {
    padding: 0.4rem 1rem;
    border-bottom: 1px solid #eee;
}
.search-filters__clear .btn {
    font-size: 0.75rem;
    color: #999;
    padding: 0;
    background: none;
    border: none;
    text-transform: none;
    letter-spacing: 0;
}
.search-filters__clear .btn:hover { color: #000; }

/* ============================================
   3. UNIFIED ROW — same height, weight, padding, border for:
      - Category links
      - Filter group headers (accordion buttons)
      - Filter option labels
   ============================================ */

/* 3a. CATEGORY TREE — minimalist, readable, comfortable */
.category-tree__list { list-style: none; margin: 0; padding: 0; }

.category-tree__item { margin: 0; }

.category-tree__item-header {
    display: flex; align-items: center; width: 100%;
}

.category-tree__item-link {
    flex: 1;
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.875rem; font-weight: 400;
    color: #444; text-decoration: none;
    border-left: 3px solid transparent;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.category-tree__item-link:hover {
    color: #222;
    background: #f8f8f8;
    border-left-color: #ddd;
}

.category-tree__item-link.active {
    color: #7A9E7E;
    font-weight: 500;
    background: #f6faf7;
    border-left-color: #7A9E7E;
}

.category-tree__active-dot { display: none; }

/* Subcategories — subtle indent, slightly smaller */
.category-tree__list[data-depth="1"] .category-tree__item-link { padding-left: 2rem; font-size: 0.85rem; }
.category-tree__list[data-depth="2"] .category-tree__item-link { padding-left: 2.75rem; font-size: 0.825rem; }
.category-tree__list[data-depth="3"] .category-tree__item-link { padding-left: 3.5rem; font-size: 0.8rem; }

.category-tree__list[data-depth="1"] { padding-top: 0.15rem; padding-bottom: 0.15rem; }

.category-tree__collapse { overflow: hidden; }

/* 3b. FILTER GROUP HEADER (accordion button) — matches category link */
.search-filters .accordion {
    --bs-accordion-border-color: transparent; --bs-accordion-border-radius: 0;
    --bs-accordion-bg: transparent; --bs-accordion-active-bg: transparent;
    --bs-accordion-btn-bg: transparent; --bs-accordion-btn-active-bg: transparent;
    --bs-accordion-btn-focus-box-shadow: none;
    --bs-accordion-btn-padding-x: 0; --bs-accordion-btn-padding-y: 0;
}
.search-filters .accordion-item { border: none; border-radius: 0; }

.search-filters .accordion-button {
    font-size: 0.85rem; font-weight: 400;
    text-transform: none; letter-spacing: 0;
    color: #444;
    padding: 0.55rem 1rem;
    background: transparent !important;
    box-shadow: none !important;
    border-bottom: 1px solid #f5f5f5 !important;
    border-radius: 0 !important;
    gap: 0.5rem;
}
.search-filters .accordion-item:last-child .accordion-button { border-bottom: none !important; }
.search-filters .accordion-button:not(.collapsed) {
    color: #7A9E7E; font-weight: 500;
    border-bottom-color: #f5f5f5 !important;
    background: transparent !important;
}

/* 3c. FILTER OPTIONS — matches category link */
.search-filters .accordion-body {
    padding: 0.75rem 1rem 0.5rem !important;
    list-style: none;
    margin: 0;
}

.search-filters__item { padding: 0; }

.search-filters__form-label {
    font-size: 0.85rem; font-weight: 400;
    color: #444; cursor: pointer;
    display: flex; align-items: center; gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #f5f5f5;
}
.search-filters__item:last-child .search-filters__form-label { border-bottom: none; }

.facet-label.active .search-filters__form-label { color: #7A9E7E; font-weight: 500; }

.search-filters__link {
    flex: 1; text-decoration: none; color: inherit;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.85rem; font-weight: 400;
}
.search-filters__link:hover { color: #000; }

/* Checkbox */
.search-filters__form-check .form-check-input {
    width: 18px; height: 18px; margin-top: 0;
    border: 1.5px solid #ccc; border-radius: 3px; cursor: pointer;
}
.search-filters__form-check .form-check-input:checked { background-color: #7A9E7E; border-color: #7A9E7E; }
.search-filters__form-check .form-check-input:focus { box-shadow: 0 0 0 2px rgba(122,158,126,0.2); border-color: #7A9E7E; }

/* ============================================
   4. UNIFIED CHEVRON
   ============================================ */
.search-filters .accordion-button::after {
    width: 0.65rem !important;
    height: 0.65rem !important;
    background-size: 0.65rem !important;
    opacity: 0.2 !important;
    transition: transform 0.2s ease;
}
.search-filters .accordion-button:not(.collapsed)::after { opacity: 0.35 !important; }

/* Category toggle — match filter chevron visually */
.category-tree__toggle {
    flex-shrink: 0;
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none;
    color: #999; cursor: pointer; padding: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.35;
}
.category-tree__toggle:hover { opacity: 0.6; }
.category-tree__toggle:not(.collapsed) { transform: rotate(90deg); opacity: 0.5; }
.category-tree__toggle .material-icons { font-size: 1.1rem !important; }

/* ============================================
   5. MAGNITUDE / COLOR SWATCHES / DROPDOWN
   ============================================ */
.search-filters__magnitude {
    font-size: 0.7rem; color: #999; background: #f5f5f5;
    padding: 0.1rem 0.45rem; border-radius: 50rem; margin-left: auto;
}
.search-filters .color.color-sm {
    display: inline-block; width: 20px; height: 20px; min-width: 20px;
    border-radius: 3px; border: 1px solid rgba(0,0,0,0.12); cursor: pointer;
}
.search-filters .color.color-sm.active { outline: 2px solid #7A9E7E; outline-offset: 2px; }
.search-filters__color-label { flex: 1; font-size: 0.85rem; color: #444; }
.search-filters__dropdown-toggle { font-size: 0.8rem; padding: 0.4rem 0.75rem; border-color: #ddd; width: 100%; text-align: left; }

/* ============================================
   6. ACTIVE FILTER CHIPS
   ============================================ */
#js-active-search-filters { margin-bottom: 1rem; }
.active-filters__list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
}
.active-filters__item:first-child .active-filters__title {
    font-size: 0.75rem; font-weight: 600; color: #666;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.active-filters__link.btn {
    font-size: 0.75rem !important; padding: 0.3rem 0.7rem !important;
    text-transform: none !important; letter-spacing: 0 !important; font-weight: 400 !important;
    background-color: #7A9E7E !important; border-color: #7A9E7E !important; color: #fff !important;
    display: inline-flex !important; align-items: center; gap: 0.25rem;
}
.active-filters__link.btn:hover { background-color: #000 !important; border-color: #000 !important; color: #fff !important; }
.active-filters__link .material-icons { font-size: 1rem; }

/* ============================================
   7. MOBILE
   ============================================ */
@media (max-width: 768px) {
    #left-column { display: none; }

    .mobile-filters-toggle {
        display: flex !important; align-items: center; justify-content: center; gap: 0.5rem;
        width: 100%; padding: 0.65rem 1rem; margin-bottom: 1rem;
        font-size: 0.85rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em;
        background: #fff; border: 1px solid #ddd; border-radius: 4px; color: #333; cursor: pointer;
    }
    .mobile-filters-toggle:hover { border-color: #7A9E7E; color: #7A9E7E; }
    .mobile-filters-toggle .material-icons { font-size: 1.15rem; }
    .mobile-filters-toggle__count {
        display: inline-flex; align-items: center; justify-content: center;
        min-width: 20px; height: 20px; padding: 0 5px;
        font-size: 0.65rem; font-weight: 700;
        background: #7A9E7E; color: #fff; border-radius: 50rem;
    }

    .mobile-filters-panel {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        z-index: 9999; background: #fff;
        transform: translateX(-100%); transition: transform 0.3s ease;
        display: flex; flex-direction: column;
    }
    .mobile-filters-panel.is-open { transform: translateX(0); }

    .mobile-filters-panel__header {
        display: flex; align-items: center; justify-content: space-between;
        padding: 1rem; border-bottom: 1px solid #eee;
        position: sticky; top: 0; background: #fff; z-index: 2;
    }
    .mobile-filters-panel__title { font-size: 1rem; font-weight: 600; color: #222; }
    .mobile-filters-panel__close {
        width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
        background: none; border: none; font-size: 1.5rem; color: #333; cursor: pointer;
        font-family: 'Material Icons'; line-height: 1;
    }

    .mobile-filters-panel__body { flex: 1; overflow-y: auto; padding: 1rem; }
    .mobile-filters-panel__body > *:first-child { margin-top: 0; }

    .mobile-filters-panel__body #search-filters,
    .mobile-filters-panel__body .search-filters,
    .mobile-filters-panel__body .ps-categorytree.category-tree {
        border: 1px solid #eee; border-radius: 4px; margin-bottom: 1rem;
    }

    .mobile-filters-panel__footer {
        padding: 1rem; border-top: 1px solid #eee; display: flex; gap: 0.75rem;
        position: sticky; bottom: 0; background: #fff;
    }
    .mobile-filters-panel__footer .btn { flex: 1; font-size: 0.8rem !important; padding: 0.65rem 1rem !important; }
    .mobile-filters-panel__footer .btn-outline-primary { border-color: #000 !important; color: #000 !important; background: #fff !important; }
    .mobile-filters-panel__footer .btn-outline-primary:hover { background: #000 !important; color: #fff !important; }

    .mobile-filters-overlay {
        position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 9998;
        opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
    }
    .mobile-filters-overlay.is-visible { opacity: 1; pointer-events: auto; }
}

.mobile-filters-toggle { display: none; }
