/**
 * Category Filters - Stiluri pentru filtrele È™i layout-ul paginii de categorie
 * Design similar cu cardurile de produse (.biomag-product-card)
 */

/* =====================================================
   FILTER SIDEBAR CONTAINER
   ===================================================== */
.filter-sidebar {
    padding: 0;
}

.filter-sidebar-wrapper {
    margin-left: calc(-1 * var(--bs-gutter-x) * .5);
}

/* =====================================================
   FILTER CARD - Container generic pentru fiecare filtru
   ===================================================== */
.filter-card {
    border-radius: var(--bm-radius);
    border: none;
    background: #fff;
    padding: var(--bm-padding-y) var(--bm-padding-x);
    margin-bottom: var(
    --bm-margin-x);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.filter-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.filter-card-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
    color: #333;
    text-transform: capitalize;
}

.filter-card-content {
    padding: 0;
}

/* Collapsed state pentru filtre cu multe opÈ›iuni */
.filter-card-content.filtcolapse {
    max-height: 210px; /* ~6 items x 35px */
    overflow: hidden;
    position: relative;
}

.filter-card-content.filtcolapse::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
    pointer-events: none;
}

.filter-card-content.filtcolapse.expanded {
    max-height: none;
}

.filter-card-content.filtcolapse.expanded::after {
    display: none;
}

/* =====================================================
   FILTER ITEMS - Elemente individuale din liste
   ===================================================== */
.filter-card-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.18s ease;
    text-decoration: none;
    color: #444;
    font-size: 13px;
    background: transparent;
}

.filter-card-item:hover {
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    transform: translateX(2px);
}

.filter-card-item.active {
    background: rgba(0, 166, 81, 0.08);
    color: var(--bs-primary, #00a651);
    font-weight: 500;
}

.filter-card-item.active:hover {
    background: rgba(0, 166, 81, 0.12);
}

.filter-item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-item-count {
    font-size: 12px;
    color: #999;
    margin-left: 8px;
    flex-shrink: 0;
}

.filter-card-item.active .filter-item-count {
    color: var(--bs-primary, #00a651);
    opacity: 0.7;
}

/* =====================================================
   FILTER EXPAND BUTTON
   ===================================================== */
.filter-expand-btn {
    font-size: 12px;
    color: #666;
    cursor: pointer;
    background: #f8f9fa;
    border: none;
    transition: all 0.18s ease;
}

.filter-expand-btn:hover {
    color: var(--bs-primary, #00a651);
    background: rgba(0, 166, 81, 0.08);
}

/* =====================================================
   CHILD CATEGORIES GRID - Boxuri deasupra produselor
   Stiluri similare cu cardurile de produs
   ===================================================== */
.child-category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.child-category-box {
    width: calc(16.66% - 7px); /* 6 pe rÃ¢nd desktop */
    max-width: 160px;
    border-radius: 12px;
    border: none;
    background: #fff;
    padding: 0;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.18s ease-in-out,
                transform 0.18s ease-in-out;
}

.child-category-box:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
    text-decoration: none;
    color: inherit;
}

.child-category-box:hover .child-category-name {
    color: var(--bs-primary, #00a651);
}

.child-category-box img {
    width: 100%;
    height: 100px;
    object-fit: contain;
    padding: 8px;
    background: #fff;
}

.child-category-placeholder {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    color: #ddd;
}

.child-category-placeholder svg {
    width: 36px;
    height: 36px;
}

.child-category-info {
    padding: 8px 10px 10px;
    background: #fff;
}

.child-category-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.child-category-count {
    font-size: 11px;
    color: #888;
}

/* Responsive - Child Categories Grid */
@media (max-width: 1200px) {
    .child-category-box {
        width: calc(20% - 7px); /* 5 pe rÃ¢nd */
    }
}

@media (max-width: 992px) {
    .child-category-box {
        width: calc(25% - 6px); /* 4 pe rÃ¢nd tablet */
    }

    .child-category-box img {
        height: 90px;
    }

    .child-category-placeholder {
        height: 90px;
    }
}

@media (max-width: 768px) {
    .child-category-box {
        width: calc(33.33% - 6px); /* 3 pe rÃ¢nd mobil */
    }
}

@media (max-width: 480px) {
    .child-category-box {
        width: calc(50% - 4px); /* 2 pe rÃ¢nd mobil mic */
    }

    .child-category-box img {
        height: 80px;
        padding: 6px;
    }

    .child-category-placeholder {
        height: 80px;
    }

    .child-category-name {
        font-size: 12px;
    }

    .child-category-info {
        padding: 6px 8px 8px;
    }
}

/* =====================================================
   CATEGORY HEADER - Structured header with SEO elements
   ===================================================== */
.category-header {
    /* padding-bottom: 16px; */
    margin-bottom: var(--bm-margin-y);;
    /* border-bottom: 1px solid #eee; */
}

.category-header__title {
    /* font-size: 1.4rem; */
    /* font-weight: 600; */
    color: var(--bs-primary, #00a651) !important;
    margin-bottom: 4px;
}

.category-header__stats {
    font-size: 0.9rem;
    font-weight: 400;
    color: #444;
    margin-bottom: 4px;
}

.category-header__seo-h2 {
    font-size: 0.85rem;
    font-weight: 400;
    color: #666;
    margin-bottom: 2px;
}

.category-header__seo-h3 {
    font-size: 0.82rem;
    font-weight: 400;
    color: #999;
    margin-bottom: 8px;
}

/* Description collapsible */
.category-header__description {
    font-size: 0.82rem;
    color: #777;
    line-height: 1.6;
    position: relative;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category-header__description.collapsed {
    max-height: 5.2em;
}

.category-header__description.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3em;
    background: linear-gradient(to bottom, transparent 0%, var(--bm-green-soft, #f0faf4) 100%);
    pointer-events: none;
}

.category-header__description:not(.collapsed)::after {
    display: none;
}

.category-header__description-toggle {
    background: none;
    border: none;
    color: #999;
    font-size: 0.78rem;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.18s ease;
}

.category-header__description-toggle:hover {
    color: var(--bs-primary, #00a651);
}

/* Legacy compatibility */
.category-title-section {
    margin-bottom: 16px;
}

.category-title {
    margin-bottom: 4px;
    color: #222;
}

.category-subtitle {
    color: #666;
    margin-bottom: 8px;
}

.category-product-count {
    font-size: 13px;
    color: #888;
}

/* =====================================================
   FILTER PRICE - Filtru preÈ›
   ===================================================== */
.filter-card .pretmin,
.filter-card .pretmax {
    max-width: 80px;
    text-align: center;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    padding: 6px 8px;
    font-size: 13px;
    transition: border-color 0.18s ease;
}

.filter-card .pretmin:focus,
.filter-card .pretmax:focus {
    border-color: var(--bs-primary, #00a651);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

.filter-card .filtpret {
    flex-shrink: 0;
}

/* =====================================================
   FILTER CHECKBOXES - Stilizare checkbox-uri
   ===================================================== */
.filter-card .form-check {
    padding: 6px 8px;
    padding-left: 1.75em;
    margin-bottom: 2px;
    border-radius: 6px;
    transition: background 0.18s ease;
}

.filter-card .form-check.small {
    padding: 3px 8px;
    padding-left: 1.75rem;
}

.filter-card .form-check:hover {
    background: #f8f9fa;
}

.filter-card .form-check-input {
    border-radius: 4px;
    border: 1.5px solid #ccc;
    transition: all 0.18s ease;
    cursor: pointer;
    margin-top: 0.2em;
}

.filter-card .form-check-input:checked {
    background-color: var(--bs-primary, #00a651);
    border-color: var(--bs-primary, #00a651);
}

.filter-card .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.15);
}

.filter-card .form-check-label {
    color: #444;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.18s ease;
    text-decoration: none;
}

.filter-card .form-check:hover .form-check-label {
    color: #333;
}

.filter-card .form-check-input:checked + .form-check-label {
    color: var(--bs-primary, #00a651);
    font-weight: 500;
}

/* =====================================================
   FILTER TREE - Stiluri pentru categorii tip arbore
   ===================================================== */
.filter-tree-item {
    display: flex;
    align-items: center;
    padding: 8px 4px;
    text-decoration: none;
    color: #555;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.18s ease;
    cursor: pointer;
}

.filter-tree-item:hover {
    color: #333;
    text-decoration: none;
    background: #f8f9fa;
}

.filter-tree-item.active {
    color: var(--bs-primary, #00a651);
    font-weight: 500;
}

.filter-tree-item.active:hover {
    background: rgba(0, 166, 81, 0.06);
}

.filter-tree-arrow {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    flex-shrink: 0;
    color: #999;
    transition: transform 0.2s ease, color 0.18s ease;
}

.filter-tree-item:hover .filter-tree-arrow {
    color: #666;
}

.filter-tree-item.active .filter-tree-arrow {
    color: var(--bs-primary, #00a651);
}

.filter-tree-arrow.rotated {
    transform: rotate(90deg);
}

.filter-tree-name {
    flex: 1;
}

/* Leaf items (L3) - no arrow, indented */
.filter-tree-leaf {
    padding-left: 28px;
}

.filter-tree-leaf .filter-tree-name {
    font-size: 13px;
}

/* Nested card styling */
.filter-card-nested {
    margin-top: -8px;
    padding-top: 0;
    border-top: none;
    box-shadow: none;
}

.filter-card-nested .filter-card-title {
    display: none;
}

/* =====================================================
   CATEGORY PAGE LAYOUT
   ===================================================== */

.sorting-bar-wrapper {
    /* width: calc(100% + var(--bs-gutter-x)); */
    clear: both;
    width: 100%;
    /* border-bottom: 1px solid #eee; */
    /* margin-left: calc(-1 * var(--bs-gutter-x) * .5); */
}

/* =====================================================
   MOBILE SORTING BAR - compact design
   ===================================================== */
@media (max-width: 991.98px) {
    /* Override theme.css fixed bottom positioning */
    .sortare {
        position: static !important;
        box-shadow: none !important;
        z-index: auto !important;
        width: auto !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        background-color: transparent !important;
    }
}

/* =====================================================
   FLOATING FILTER BUTTON - appears when sorting bar scrolls out
   Design matches "Adaugă în coș" button from product cards
   ===================================================== */
.mf-floating-btn {
    position: fixed;
    right: 16px;
    top: 70px; /* fallback, JS overrides with header height */
    z-index: 1060;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #e4f6e4;
    color: #0b7e33;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s ease;
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
}

.mf-floating-btn.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.mf-floating-btn:hover {
    background: #d4ebd4;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.mf-floating-btn:active {
    transform: scale(0.95);
}

.mf-floating-btn svg {
    flex-shrink: 0;
}

.category-page .products-grid {
    display: flex;
    flex-wrap: wrap;
    /* margin: 0  calc(-1 * var(--bs-gutter-x) * .5); */
}

/* =====================================================
   MOBILE FILTER MODAL IMPROVEMENTS
   ===================================================== */
.model-filtre .filter-sidebar {
    padding: 16px;
}

.model-filtre .filter-card {
    margin-bottom: 16px;
}

/* =====================================================
   RESET FILTERS BUTTON
   ===================================================== */
.filter-sidebar .btn-outline-secondary {
    border-radius: 8px;
    font-size: 13px;
    padding: 8px 16px;
    transition: all 0.18s ease;
}

.filter-sidebar .btn-outline-secondary:hover {
    background: #f8f9fa;
    border-color: #ddd;
}

/* =====================================================
   ACTIVE FILTERS CARD - Filtrele selectate
   ===================================================== */
.filter-card-active {
    background: #fafafa;
}

.filter-active-group {
    margin-bottom: 10px;
}

.filter-active-group:last-child {
    margin-bottom: 0;
}

.filter-active-type {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px 4px 10px;
    background: var(--bs-primary, #00a651);
    color: #fff;
    border-radius: 20px;
    font-size: 12px;
    line-height: 1.3;
    text-decoration: none;
    transition: background 0.18s ease;
    max-width: 100%;
}

.filter-chip:hover {
    background: #333;
    color: #fff;
    text-decoration: none;
}

.filter-chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-chip-x {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.7;
}

.filter-chip:hover .filter-chip-x {
    opacity: 1;
}

.filter-chip--clear {
    margin-top: 10px;
    background: transparent;
    color: #888;
    border: 1px dashed #ccc;
    padding: 4px 10px;
    font-size: 12px;
}

.filter-chip--clear .filter-chip-x {
    stroke: #888;
}

.filter-chip--clear:hover {
    background: #f5f5f5;
    color: #333;
    border-color: #999;
}

.filter-chip--clear:hover .filter-chip-x {
    stroke: #333;
}

/* =====================================================
   FILTER CARD TITLE WITH BADGE
   ===================================================== */
.filter-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.filter-card-header .filter-card-title {
    margin-bottom: 0;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--bs-primary, #00a651);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
}

.filter-badge:empty {
    display: none;
}

/* =====================================================
   FILTER CATEGORIES TREE - Arbore ierarhic L1 → L2 → L3
   ===================================================== */
.filter-card .form-check.filter-tree__l1,
.filter-card .form-check.filter-tree__l2,
.filter-card .form-check.filter-tree__l3 {
    padding: 3px 8px;
    gap: 6px;
}

.filter-card .form-check.filter-tree__l1 {
    padding-left: 8px;
}

.filter-card .form-check.filter-tree__l2 {
    padding-left: 28px;
}

.filter-card .form-check.filter-tree__l3 {
    padding-left: 48px;
}

/* Checkbox-ul nu mai e absolut în modul flex */
.filter-card .form-check.filter-tree__l1 .form-check-input,
.filter-card .form-check.filter-tree__l2 .form-check-input,
.filter-card .form-check.filter-tree__l3 .form-check-input {
    position: static;
    margin: 0;
    flex-shrink: 0;
}

.filter-tree-path {
    color: var(--bs-primary, #00a651) !important;
    font-weight: 500;
}

.filter-tree-count {
    font-size: 12px;
}

.filter-tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    cursor: pointer;
    color: #999;
    flex-shrink: 0;
    border-radius: 4px;
    transition: color 0.18s ease, background 0.18s ease;
}

.filter-tree-toggle:hover {
    color: #666;
    background: rgba(0, 0, 0, 0.04);
}

.filter-tree-chevron {
    transition: transform 0.2s ease;
}

.filter-tree-chevron.open {
    transform: rotate(90deg);
}

.filter-card .form-check-input:checked ~ .filter-tree-toggle {
    color: var(--bs-primary, #00a651);
}

.filter-tree-path ~ .filter-tree-toggle {
    color: var(--bs-primary, #00a651);
}

/* Implicit checked (copii ai categoriei curente) - bifa gri vizuala */
.filter-card .form-check-input.filter-tree-checkbox--implicit {
    background-color: #ccc;
    border-color: #ccc;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Când userul bifează un implicit, devine verde normal */
.filter-card .form-check-input.filter-tree-checkbox--implicit:checked {
    background-color: var(--bs-primary, #00a651);
    border-color: var(--bs-primary, #00a651);
}
