/* ════════════════════════════════════════════════════════
   Serigest Category Bar – Frontend styles
   ════════════════════════════════════════════════════════ */

.scb-bar {
    width: 100%;
    background: #ffffff;
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 100;
    /* box-shadow: 0 1px 4px rgba(0, 0, 0, .06); */
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Con admin bar WordPress attiva */
.admin-bar .scb-bar {
    top: 32px;
    margin-top: 0 !important;
    padding-top: 0 !important;
}
@media screen and (max-width: 782px) {
    .admin-bar .scb-bar {
        top: 46px;
    }
}
/* A ≤600px l'admin bar è nascosta (display:none) ma la classe .admin-bar
   rimane sull'html: reset esplicito a 0 per evitare spazio vuoto */
@media screen and (max-width: 600px) {
    .admin-bar .scb-bar {
        top: 0;
    }
}

.scb-bar__inner {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 2px;
    box-sizing: border-box;
    position: relative;
}

/* ── Track ──────────────────────────────────────────── */

.scb-bar__track {
    display: flex;
    align-items: stretch;
    justify-content: space-evenly;
    flex: 1;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 0;
}
.scb-bar__track::-webkit-scrollbar { display: none; }

/* ── Item ───────────────────────────────────────────── */

.scb-bar__item {
    flex: 0 0 auto;
}

.scb-bar__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 12px 9px;
    text-decoration: none !important;
    color: #555;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.3;
    white-space: nowrap;
    border-bottom: none;
    transition: color .2s;
    position: relative;
}

.scb-bar__link:hover {
    color: #111;
    text-decoration: none !important;
}

.scb-bar__item.is-active .scb-bar__link {
    color: #111;
    font-weight: 600;
}

/* Cerchio pulsante dietro l'icona all'hover */
.scb-bar__icon::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0, 0, 0, .07);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity .25s, transform .25s;
}

.scb-bar__link:hover .scb-bar__icon::before {
    opacity: 1;
    transform: scale(1.08);
    animation: scb-ripple .5s ease-out;
}

.scb-bar__item.is-active .scb-bar__icon::before {
    opacity: 1;
    transform: scale(1.08);
    background: rgba(0, 0, 0, .09);
}

@keyframes scb-ripple {
    0%   { transform: scale(0.85); opacity: 0; }
    40%  { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1.08); opacity: 1; }
}

/* ── Icon ───────────────────────────────────────────── */

.scb-bar__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: visible;
    position: relative;
}

.scb-bar__icon img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    display: block;
    border-radius: 50%;
    filter: none;
    position: relative;
    z-index: 1;
    transition: transform .2s;
}

.scb-bar__link:hover .scb-bar__icon img {
    transform: scale(1.05);
}

.scb-bar__item.is-active .scb-bar__icon img {
    filter: none;
}

.scb-bar__letter {
    font-size: 15px;
    font-weight: 700;
    color: #aaa;
    line-height: 1;
}

/* ── Name ───────────────────────────────────────────── */

.scb-bar__name {
    display: block;
    font-size: 10.5px;
    font-weight: 900;
    text-align: center;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Arrows (shown only when overflow) ─────────────── */

.scb-bar__arrow {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: none; /* shown via JS only when needed */
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 0;
    transition: color .12s;
}
.scb-bar__arrow.is-visible { display: flex; }
.scb-bar__arrow:hover { color: #111; }
.scb-bar__arrow:disabled { opacity: .3; cursor: default; }
.scb-bar__arrow svg { width: 8px; height: 14px; stroke: currentColor; }

/* ── Variante bottom (single product) ───────────────── */

.scb-bar--bottom {
    position: static;
    border-top: 1px solid #e8e8e8;
    border-bottom: none;
    box-shadow: 0 -1px 4px rgba(0,0,0,.05);
    margin-top: 48px;
}

/* ── Responsive: scroll on small screens ────────────── */
@media ( max-width: 768px ) {
    .scb-bar__track {
        justify-content: flex-start;
    }
    .scb-bar__link {
        padding: 9px 12px 8px;
        font-size: 10px;
    }
    .scb-bar__icon {
        width: 70px;
        height: 70px;
    }
    .scb-bar__icon img {
        width: 70px;
        height: 70px;
    }
    .scb-bar__name {
        max-width: 60px;
        font-size: 9.5px;
    }
}

/* ── Product category: icone grigie, attiva e hover a colori ── */

body.tax-product_cat .scb-bar__icon img,
body.single-product .scb-bar__icon img {
    filter: grayscale(100%) opacity(60%);
}

body.tax-product_cat .scb-bar__link:hover .scb-bar__icon img,
body.tax-product_cat .scb-bar__item.is-active .scb-bar__icon img,
body.single-product .scb-bar__link:hover .scb-bar__icon img,
body.single-product .scb-bar__item.is-active .scb-bar__icon img {
    filter: grayscale(0%) opacity(100%);
}

/* ── Sticky: icone ridotte con transizione fluida ───────── */

.scb-bar__icon,
.scb-bar__icon img {
    transition: width .3s ease, height .3s ease;
}

.scb-bar.is-sticky {
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
    transition: box-shadow .3s ease;
}

.scb-bar.is-sticky .scb-bar__icon {
    width: 48px;
    height: 48px;
}

.scb-bar.is-sticky .scb-bar__icon img {
    width: 48px;
    height: 48px;
    filter: grayscale(100%) opacity(60%);
    transition: filter .2s ease, width .3s ease, height .3s ease;
}

.scb-bar.is-sticky .scb-bar__link:hover .scb-bar__icon img,
.scb-bar.is-sticky .scb-bar__item.is-active .scb-bar__icon img {
    filter: grayscale(0%) opacity(100%);
}

.scb-bar.is-sticky .scb-bar__icon::before {
    width: 100%;
    height: 100%;
}

@media (max-width: 768px) {
    .scb-bar.is-sticky .scb-bar__icon,
    .scb-bar.is-sticky .scb-bar__icon img {
        width: 36px;
        height: 36px;
    }
}
