/* =========================================================================
   SIDEBAR CATEGORY ACCORDION  — BEM / Frontend-Design-Pro
   ========================================================================= */

.sb-category-tree {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* "Tutte le categorie" reset link */
.sb-cat-reset {
    display: flex;
    align-items: center;
    padding: 13px 16px;
    background: #f9fafb;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s, color 0.2s;
    gap: 10px;
}
.sb-cat-reset i { color: #9ca3af; font-size: 13px; transition: color 0.2s; }
.sb-cat-reset:hover { background: #f3f4f6; color: #111827; }
.sb-cat-reset:hover i { color: #374151; }
.sb-cat-reset.is-active { background: #ef4444; color: #fff; }
.sb-cat-reset.is-active i { color: #fff; }

/* Expand toggle button */
.sb-cat-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 11px 16px;
    background: #fff;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.sb-cat-toggle:hover { background: #f9fafb; color: #374151; }
.sb-cat-toggle i { font-size: 9px; transition: transform 0.3s; }
.sb-cat-toggle.is-open i { transform: rotate(180deg); }

/* Category list */
.sb-cat-list { list-style: none; padding: 0; margin: 0; }
.sb-cat-item { border-bottom: 1px solid #f3f4f6; }
.sb-cat-item:last-child { border-bottom: none; }

/* Item head row */
.sb-cat-item__head {
    display: flex;
    align-items: stretch;
}
.sb-cat-item__head.is-active .sb-cat-link {
    border-left-color: #ef4444;
    background: #fef2f2;
    color: #ef4444;
    font-weight: 700;
}
.sb-cat-item__head.is-active .sb-cat-count {
    background: #fecaca;
    color: #b91c1c;
}

/* Category link */
.sb-cat-link {
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.sb-cat-link:hover { background: #f9fafb; color: #111827; }

/* Count badge */
.sb-cat-count {
    font-size: 11px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Expand sub-cat button */
.sb-cat-expand {
    flex-shrink: 0;
    background: transparent;
    border: none;
    border-left: 1px solid #f3f4f6;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.sb-cat-expand:hover { background: #f9fafb; color: #ef4444; }
.sb-cat-expand i { font-size: 10px; }

/* Sub-category list */
.sb-cat-sublist {
    list-style: none;
    padding: 4px 0;
    margin: 0;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}
.sb-cat-subitem { border-bottom: 1px solid #f3f4f6; }
.sb-cat-subitem:last-child { border-bottom: none; }

/* Sub-category link */
.sb-cat-sublink {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding: 10px 14px 10px 32px;
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.sb-cat-sublink::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #d1d5db;
    transition: background 0.2s, width 0.2s, height 0.2s;
}
.sb-cat-sublink:hover { color: #ef4444; background: #fff; }
.sb-cat-sublink:hover::before { background: #ef4444; }
.sb-cat-sublink.is-active { color: #ef4444; font-weight: 600; }
.sb-cat-sublink.is-active::before { background: #ef4444; width: 7px; height: 7px; border-radius: 2px; }

/* =========================================================================
   POPULAR CATEGORIES PAGE  — Spark Automotive inspired grid
   ========================================================================= */

.sf-category-showcase {
    background-color: #f5f5f5;
    padding: 60px 0 90px;
}

.sf-category-showcase__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.sf-category-showcase__title {
    font-size: 22px;
    font-weight: 900;
    color: #111827;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 0;
    padding: 0;
    position: relative;
}
.sf-category-showcase__title::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: #ef4444;
    margin-top: 8px;
    border-radius: 2px;
}

/* Grid shell — white BG with outer border */
.sf-cat-grid {
    display: grid;
    grid-template-columns: 1fr;
    background: #fff;
    border-top:   1px solid #e5e7eb;
    border-left:  1px solid #e5e7eb;
}
@media (min-width: 640px) {
    .sf-cat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
    .sf-cat-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Grid cell */
.sf-cat-cell {
    display: flex;
    align-items: flex-start;
    padding: 36px 28px;
    gap: 24px;
    border-right:  1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    transition: background 0.35s ease;
    overflow: hidden;
}
.sf-cat-cell:hover { background: #fafafa; }

/* Category image — left 40% */
.sf-cat-cell__image-wrapper {
    flex: 0 0 42%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
}
.sf-cat-cell__image {
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.sf-cat-cell:hover .sf-cat-cell__image { transform: scale(1.07); }

/* Placeholder icon when no image */
.sf-cat-cell__image-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #d1d5db;
}

/* Content — right 58% */
.sf-cat-cell__content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sf-cat-cell__heading { margin: 0 0 12px 0; }
.sf-cat-cell__heading a {
    font-size: 14px;
    font-weight: 800;
    color: #111827;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-decoration: none;
    transition: color 0.2s;
}
.sf-cat-cell__heading a:hover { color: #ef4444; }

/* Subcategory list */
.sf-cat-cell__sublist {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}
.sf-cat-cell__sublist li { margin-bottom: 10px; }
.sf-cat-cell__sublist a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: #6b7280;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}
.sf-cat-cell__sublist a i {
    font-size: 9px;
    color: #d1d5db;
    transition: transform 0.2s, color 0.2s;
}
.sf-cat-cell__sublist a:hover { color: #111827; }
.sf-cat-cell__sublist a:hover i { transform: translateX(3px); color: #ef4444; }

/* "View all" CTA */
.sf-cat-cell__view-all {
    align-self: flex-start;
    font-size: 13px;
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 1px;
    transition: color 0.2s, border-color 0.2s;
}
.sf-cat-cell__view-all:hover {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
}
