/* ═══════════════════════════════════════════════════════════════════════════
   Shop / Archive Product Grid  –  Serigest custom card
   Usa specificità elevata per sopraffare i default WooCommerce
   ═══════════════════════════════════════════════════════════════════════════ */

/* Gruppo contenuto WooCommerce — singolo prodotto (block theme) */
.wp-block-group.woocommerce.product.is-layout-flow.wp-block-group-is-layout-flow {
    margin-top: 50px;
}

/*
 * Categoria / archivio / tag / shop: stesso margine sopra il contenuto.
 * — Twenty Twenty-Five (child): il template usa <main class="wp-block-group"> (niente #primary).
 * — Temi classici WooCommerce: spesso #primary avvolge il contenuto, oppure main#main.
 */
body.woocommerce-shop main.wp-block-group,
body.tax-product_cat main.wp-block-group,
body.tax-product_brand main.wp-block-group,
body.tax-product_tag main.wp-block-group,
body.post-type-archive-product main.wp-block-group {
    margin-top: 50px;
}

/* Wrapper classico (Storefront, temi con wrapper-start): un solo margine */
body.woocommerce-page #primary {
    margin-top: 50px;
}

/* Solo temi classici: il block theme usa main.wp-block-group (regole sopra) */
body.woocommerce-page main#main:not(.wp-block-group) {
    margin-top: 50px;
}

body.woocommerce-page #primary main#main {
    margin-top: 0;
}

/* ── Breadcrumb ─────────────────────────────────────────────────────────────── */

.woocommerce .woocommerce-breadcrumb,
.woocommerce-page .woocommerce-breadcrumb {
    font-size: 12px !important;
    color: #3a3030 !important;
    margin-bottom: 12px !important;
    padding: 0 !important;
    line-height: 1.5 !important;
}

@media (max-width: 767px) {
    .woocommerce .woocommerce-breadcrumb,
    .woocommerce-page .woocommerce-breadcrumb {
        font-size: 10px !important;
    }
}

.woocommerce .woocommerce-breadcrumb a,
.woocommerce-page .woocommerce-breadcrumb a {
    color: #bbb !important;
    text-decoration: none !important;
}

.woocommerce .woocommerce-breadcrumb a:hover,
.woocommerce-page .woocommerce-breadcrumb a:hover {
    color: #888 !important;
    text-decoration: underline !important;
}

/* separatore "/" */
.woocommerce .woocommerce-breadcrumb .woocommerce-breadcrumb__delimiter {
    color: #ccc !important;
}

/* ── Titolo categoria ───────────────────────────────────────────────────────── */

.woocommerce-products-header {
    margin-bottom: 28px !important;
    padding: 0 !important;
    border: none !important;
}

/* Titolo archivio prodotti / categoria — allineato a sinistra */
.woocommerce-products-header__title,
.woocommerce .woocommerce-products-header h1.page-title {
    max-width: 1200px !important;
    margin-top: 0 !important;
    margin-left: 0 !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 24px !important;
    box-sizing: border-box !important;
    font-weight: 800 !important;
}

/* Archivio brand: titolo a sinistra, logo caricato a destra */
body.tax-product_brand .woocommerce-products-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px 28px;
    max-width: 1200px;
    width: 100%;
    box-sizing: border-box;
}

body.tax-product_brand .woocommerce-products-header__title,
body.tax-product_brand .woocommerce .woocommerce-products-header h1.page-title {
    flex: 1 1 auto;
    width: auto !important;
    max-width: none !important;
    margin-right: 0 !important;
    padding-right: 0 !important;
}

.sg-brand-archive-logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    max-width: min(42%, 220px);
}

.sg-brand-archive-logo__img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 64px;
    object-fit: contain;
}

@media (max-width: 767px) {
    .sg-brand-archive-logo {
        max-width: 120px;
    }
    .sg-brand-archive-logo__img {
        max-height: 40px;
    }
}

h1.wp-block-post-title,
.wp-block-post-title,
.wp-block-heading,
.wp-block-separator.has-alpha-channel-opacity {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 24px !important;
    box-sizing: border-box !important;
}

h1.wp-block-post-title,
.wp-block-post-title {
    font-size: clamp(22px, 3vw, 32px) !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px !important;
    color: #111 !important;
    margin-bottom: 4px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 1.2 !important;
    text-transform: none !important;
    border: none !important;
}

@media (max-width: 767px) {
    .woocommerce-products-header__title,
    .woocommerce .woocommerce-products-header h1.page-title,
    h1.wp-block-post-title,
    .wp-block-post-title,
    .wp-block-heading,
    .wp-block-separator.has-alpha-channel-opacity {
        padding-left: 0 !important;
        padding-right: 16px !important;
    }
}

/* sottolineatura accent sottile sotto il titolo */
.woocommerce-products-header__title::after,
.woocommerce .woocommerce-products-header h1.page-title::after,
h1.wp-block-post-title::after,
.wp-block-post-title::after {
    content: '';
    display: block;
    width: 36px;
    height: 3px;
    background: #111;
    border-radius: 2px;
    margin-top: 8px;
}

/* descrizione categoria (se presente) */
.woocommerce .term-description,
.woocommerce-page .term-description {
    font-size: 13px !important;
    color: #777 !important;
    margin-top: 8px !important;
    margin-bottom: 0 !important;
}

/* Brand Woo: niente box float in testa — stesso layout della categoria */
body.tax-product_brand .brand-description {
    display: none !important;
}

/* ── Genere filter pills ────────────────────────────────────────────────────── */

.sg-genere-filter {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    margin: 0 0 20px;
    align-items: center;
}

.sg-genere-filter__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.sg-genere-filter .woocommerce-ordering {
    margin: 0 0 0 auto !important;
    flex-shrink: 0;
}

.sg-genere-filter .woocommerce-ordering select,
.sg-genere-filter .woocommerce-ordering select.orderby {
    height: 34px !important;
    border-radius: 999px !important;
    min-width: 0 !important;
}

body:has(.sg-genere-filter .woocommerce-ordering) .ssf-toolbar {
    display: none;
}

.sg-filtri-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 14px;
    background: #fff;
    border: 1.5px solid #e4e7ec;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    text-transform: uppercase;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}

.sg-filtri-pill:hover {
    background: #f5f6f8;
    border-color: #c8cdd6;
}

body:has(.sg-filtri-pill) .ssf-wrap {
    display: none;
}

body:has(.sg-filtri-pill) .ssf-toolbar {
    justify-content: flex-end;
    margin-bottom: 16px;
}

.sg-subcat-filter + .sg-genere-filter {
    margin-top: -8px;
}

.sg-subcat-filter {
    gap: 16px;
    align-items: stretch;
}

.sg-subcat-bar {
    display: flex;
    align-items: stretch;
    flex: 1;
    min-width: 0;
    gap: 0;
    border-bottom: 1px solid #e8eaed;
}

.sg-subcat-bar .woocommerce-ordering {
    margin: 0 0 8px auto !important;
    align-self: flex-end;
    flex-shrink: 0;
    padding-left: 12px;
}

.sg-subcat-bar .woocommerce-ordering select,
.sg-subcat-bar .woocommerce-ordering select.orderby {
    height: 32px !important;
    border-radius: 8px !important;
    border-color: #e8eaed !important;
    background-color: #fff !important;
}

.sg-subcat-filter .sg-filtri-pill {
    height: auto;
    align-self: stretch;
    padding: 0 16px 0 0;
    margin: 0 8px 0 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    border-right: 1px solid #e8eaed;
    box-shadow: none;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    font-weight: 600;
    color: #111111;
}

.sg-subcat-filter .sg-filtri-pill:hover {
    background: transparent;
    border-right-color: #e8eaed;
    color: #111111;
}

.sg-subcat-nav-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding-top: 6px;
}

.sg-subcat-kicker {
    display: block;
    padding: 0 16px 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9ca3af;
    line-height: 1;
}

.sg-subcat-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    align-items: stretch;
    flex: 1;
    min-width: 0;
}

.sg-subcat-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: auto;
    padding: 6px 16px 12px;
    background: none;
    border: 0;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: #6b7280;
    text-decoration: none;
    text-transform: none;
    line-height: 1.2;
    white-space: nowrap;
    transition: color .15s;
}

.sg-subcat-link:hover {
    background: none;
    border: 0;
    color: #111111;
    text-decoration: none;
}

.sg-subcat-link.is-active {
    background: none;
    border: 0;
    color: #111111;
    font-weight: 650;
}

.sg-subcat-link.is-active::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: -1px;
    width: auto;
    height: 2px;
    background: #111;
    border-radius: 0;
}

@media (max-width: 767px) {
    .sg-subcat-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .sg-subcat-nav::-webkit-scrollbar {
        display: none;
    }
    .sg-subcat-filter .sg-filtri-pill {
        padding-right: 12px;
        margin-right: 4px;
        font-size: 12px;
    }
    .sg-subcat-kicker {
        padding-left: 12px;
        padding-right: 12px;
    }
    .sg-subcat-link {
        padding: 6px 12px 12px;
        font-size: 13px;
    }
    .sg-subcat-link.is-active::after {
        left: 12px;
        right: 12px;
    }
}

@media (max-width: 767px) {
    .sg-genere-filter {
        flex-wrap: wrap;
    }
    .sg-genere-filter__pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        flex: 1 1 100%;
        padding-bottom: 4px;
    }
    .sg-genere-filter__pills::-webkit-scrollbar { display: none; }
    .sg-genere-pill { flex-shrink: 0; }
    .sg-genere-filter .woocommerce-ordering {
        flex: 1 1 100%;
        display: flex;
        justify-content: flex-end;
        margin-left: 0 !important;
    }
    .sg-subcat-bar .woocommerce-ordering {
        flex: 0 0 auto;
        margin: 0 0 8px auto !important;
    }
}

.sg-genere-pill {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 16px;
    background: #f5f6f8;
    border: 1.5px solid #e4e7ec;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    text-decoration: none;
    text-transform: uppercase;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}

.sg-genere-pill:hover {
    background: #e8eaf0;
    border-color: #c8cdd6;
    color: #111827;
    text-decoration: none;
}

.sg-genere-pill.is-active {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

@media (max-width: 480px) {
    .sg-genere-pill {
        height: 30px;
        padding: 0 12px;
        font-size: 12px;
    }
    .sg-filtri-pill {
        height: 30px;
        padding: 0 12px;
        font-size: 12px;
    }
}

/* ── Nascondi conteggio risultati ───────────────────────────────────────────── */

.woocommerce-result-count {
    display: none !important;
}

/* ── Reset griglia WooCommerce ─────────────────────────────────────────────── */

/* Rimuove il ::before/::after del vecchio clearfix WC — diventano celle vuote nel grid */
.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce-page ul.products::before,
.woocommerce-page ul.products::after,
body.woocommerce-cart ul.products::before,
body.woocommerce-cart ul.products::after,
.sg-related-slider ul.products::before,
.sg-related-slider ul.products::after {
    display: none !important;
    content: none !important;
}

.woocommerce ul.products,
.woocommerce-page ul.products,
body .woocommerce ul.products,
body.tax-product_brand ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
    padding: 0 !important;
    margin: 0 0 32px !important;
    list-style: none !important;
    float: none !important;
    width: 100% !important;
    clear: both !important;
}

@media (max-width: 1100px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    body.tax-product_brand ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Categoria Promo: 2 colonne larghe max 450px (no “buco” centrale), più spazio tra righe che tra colonne */
body.tax-product_cat.term-promo .woocommerce ul.products,
body.tax-product_cat.term-promo.woocommerce-page ul.products,
body.tax-product_cat.term-promo .woocommerce-page ul.products,
body.tax-product_cat.term-promo body .woocommerce ul.products {
    grid-template-columns: repeat(2, minmax(0, 450px)) !important;
    justify-content: center !important;
    column-gap: 42px !important;
    row-gap: 28px !important;
}

@media (max-width: 680px) {
    body.tax-product_cat.term-promo .woocommerce ul.products,
    body.tax-product_cat.term-promo.woocommerce-page ul.products,
    body.tax-product_cat.term-promo .woocommerce-page ul.products,
    body.tax-product_cat.term-promo body .woocommerce ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        column-gap: 38px !important;
        row-gap: 22px !important;
    }
}

@media (max-width: 680px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    body.tax-product_brand ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* Riduce il padding laterale globale su mobile per le pagine WooCommerce */
    body.woocommerce-page .has-global-padding,
    body.woocommerce .has-global-padding {
        --wp--style--root--padding-left: 10px !important;
        --wp--style--root--padding-right: 10px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .woocommerce-page .woocommerce,
    body.woocommerce .woocommerce {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* ── Card base ──────────────────────────────────────────────────────────────── */

.woocommerce ul.products li.sgp-card,
.woocommerce-page ul.products li.sgp-card,
body.tax-product_brand ul.products li.sgp-card {
    background: #fff !important;
    border: 4px solid #fafafa !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    max-width: none !important;
    float: none !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    transition: border-color .35s ease, box-shadow .35s ease, transform .35s ease !important;
    box-sizing: border-box !important;
}

.woocommerce ul.products li.sgp-card:hover {
    border-color: #fff !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .14) !important;
    transform: translateY(-4px) !important;
    outline: 4px solid #fff !important;
    background: #fff !important;
}

/* ── Wrapper interno ────────────────────────────────────────────────────────── */

.sgp-card__inner {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
    position: relative !important;  /* serve per l'overlay link */
    font-size: 0 !important; /* nasconde testo anonimo (commenti HTML leakati) */
}

.sgp-card__inner > .sgp-card__thumb,
.sgp-card__inner > .sgp-card__body,
.sgp-card__inner > .sgp-card__footer {
    font-size: 13px !important;
}

/* Overlay invisibile che copre tutta la card per renderla cliccabile */
.sgp-card__overlay {
    position: absolute !important;
    inset: 0 !important;
    z-index: 1 !important;
    display: block !important;
    border-radius: inherit !important;
    font-size: 0 !important;
    line-height: 0 !important;
    overflow: hidden !important;
    color: transparent !important;
    text-indent: -9999px !important;
    white-space: nowrap !important;
}

/* ── Footer: pallini a sinistra, CTA a destra ──────────────────────────────── */

.sgp-card__footer {
    padding: 0 12px 12px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
    position: relative !important;
    z-index: 2 !important; /* sopra l'overlay */
    margin-top: auto !important;
    min-height: 36px !important;
}

.sgp-card__cta {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    color: #111 !important;
    text-decoration: none !important;
    border: 1.5px solid #111 !important;
    border-radius: 20px !important;
    padding: 5px 13px !important;
    line-height: 1.4 !important;
    letter-spacing: 0.2px !important;
    transition: background .18s, color .18s !important;
    white-space: nowrap !important;
    position: relative !important;
    z-index: 2 !important;
}

.sgp-card__cta:hover {
    background: #111 !important;
    color: #fff !important;
    text-decoration: none !important;
}

.sgp-card__cta-icon {
    width: 13px !important;
    height: 13px !important;
    flex-shrink: 0 !important;
    display: block !important;
}

/* ── Immagine ───────────────────────────────────────────────────────────────── */

.sgp-card__thumb {
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
    background: #f5f5f5 !important;
    border-radius: 0 !important;
}

.woocommerce ul.products li.sgp-card:hover .sgp-card__thumb img,
.woocommerce ul.products li.sgp-card:hover .sgp-card__img {
    transform: scale(1.06) !important;
}

/* Override aggressivo: WC imposta width su img nei loop */
.woocommerce ul.products li.sgp-card .sgp-card__thumb img,
.woocommerce ul.products li.sgp-card .sgp-card__img,
.sgp-card__img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: cover !important;
    object-position: center top !important;
    display: block !important;
    margin: 0 !important;
    transition: transform .6s ease !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
}

/* Badge SALDO */
.woocommerce ul.products li.sgp-card .onsale,
.sgp-card__thumb .onsale {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    right: auto !important;
    z-index: 2 !important;
    background: #e53935 !important;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 3px 8px !important;
    border-radius: 4px !important;
    text-transform: uppercase !important;
    letter-spacing: .5px !important;
    z-index: 2 !important;
    min-height: unset !important;
    min-width: unset !important;
    line-height: 1.4 !important;
    margin: 0 !important;
}

/* ── Body testo ─────────────────────────────────────────────────────────────── */

.sgp-card__body {
    padding: 10px 12px 14px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
    flex: 1 !important;
}

/* ── Titolo ─────────────────────────────────────────────────────────────────── */

.woocommerce ul.products li.sgp-card .sgp-card__title,
.sgp-card__title {
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: #1a1a1a !important;
    text-align: left !important;
    text-transform: uppercase !important;
    margin: 0 !important;
    padding: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    min-height: 2.6em !important;
}

/* Tag attributi a sinistra, logo brand a destra */
.sgp-card__meta {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    min-height: 22px !important;
}
.sgp-card__meta .sc-loop-tags {
    margin-top: 0 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}
.sgp-card__brand {
    flex: 0 0 auto !important;
    height: 22px !important;
    width: auto !important;
    max-width: 72px !important;
    object-fit: contain !important;
    object-position: right center !important;
    display: block !important;
    margin-left: auto !important;
}

/* ── Prezzo ─────────────────────────────────────────────────────────────────── */

.sgp-card__price {
    font-size: 11.5px !important;
    color: #666 !important;
    text-align: left !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
}

.sgp-card__price strong {
    color: #111 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
}

.sgp-card__price .woocommerce-Price-amount {
    font-size: inherit !important;
    font-weight: inherit !important;
    color: inherit !important;
}

/* ── Categoria Promo: card più compatte, grafiche intere (5:6, no crop) ───── */
/* Griglia e gap righe/colonne: vedi blocco “Categoria Promo” sopra (minmax 450px). */

body.tax-product_cat.term-promo .woocommerce ul.products li.sgp-card,
body.tax-product_cat.term-promo.woocommerce-page ul.products li.sgp-card {
    border-width: 3px !important;
    border-radius: 11px !important;
    width: 100% !important;
    max-width: none !important;
    justify-self: stretch !important;
}

body.tax-product_cat.term-promo .woocommerce ul.products li.sgp-card:hover {
    box-shadow: 0 6px 22px rgba(0, 0, 0, .11) !important;
    transform: translateY(-3px) !important;
}

/* Le grafiche Promo sono verticali (~5:6). Il 1:1 + cover tagliava il basso. */
body.tax-product_cat.term-promo ul.products li.sgp-card .sgp-card__thumb,
body.tax-product_cat.term-promo.woocommerce-page ul.products li.sgp-card .sgp-card__thumb,
body.tax-product_cat.term-promo .woocommerce ul.products li.sgp-card .sgp-card__thumb,
body.tax-product_cat.term-promo li.sgp-card .sgp-card__thumb {
    aspect-ratio: 5 / 6 !important;
}

body.tax-product_cat.term-promo ul.products li.sgp-card .sgp-card__thumb img,
body.tax-product_cat.term-promo.woocommerce-page ul.products li.sgp-card .sgp-card__img,
body.tax-product_cat.term-promo .woocommerce ul.products li.sgp-card .sgp-card__img,
body.tax-product_cat.term-promo li.sgp-card .sgp-card__img {
    object-fit: contain !important;
    object-position: center center !important;
}

body.tax-product_cat.term-promo ul.products li.sgp-card:hover .sgp-card__thumb img,
body.tax-product_cat.term-promo.woocommerce-page ul.products li.sgp-card:hover .sgp-card__img,
body.tax-product_cat.term-promo ul.products li.sgp-card:hover .sgp-card__img {
    transform: none !important;
}

body.tax-product_cat.term-promo .sgp-card__body {
    padding: 8px 10px 10px !important;
    gap: 4px !important;
}

body.tax-product_cat.term-promo .sgp-card__brand {
    height: 18px !important;
    max-width: 56px !important;
}

body.tax-product_cat.term-promo .woocommerce ul.products li.sgp-card .sgp-card__title,
body.tax-product_cat.term-promo .sgp-card__title {
    font-size: 12px !important;
}

body.tax-product_cat.term-promo .sgp-card__price {
    font-size: 10.5px !important;
}

body.tax-product_cat.term-promo .sgp-card__price strong {
    font-size: 12.5px !important;
}

body.tax-product_cat.term-promo .sgp-card__footer {
    padding: 0 10px 10px !important;
}

body.tax-product_cat.term-promo .sgp-card__cta {
    font-size: 10.5px !important;
    padding: 4px 11px !important;
    border-radius: 16px !important;
}

body.tax-product_cat.term-promo .sgp-card__cta-icon {
    width: 11px !important;
    height: 11px !important;
}

body.tax-product_cat.term-promo .woocommerce ul.products li.sgp-card .onsale,
body.tax-product_cat.term-promo .sgp-card__thumb .onsale {
    font-size: 9px !important;
    padding: 2px 6px !important;
    top: 6px !important;
    left: 6px !important;
}

body.tax-product_cat.term-promo .sgp-card__swatch {
    width: 12px !important;
    height: 12px !important;
}

body.tax-product_cat.term-promo .sgp-card__extra-colors {
    font-size: 10px !important;
}

body.tax-product_cat.term-promo .sgp-card__tags {
    gap: 3px !important;
    margin: 3px 0 2px !important;
}

body.tax-product_cat.term-promo .sgp-card__tag {
    font-size: 9px !important;
    padding: 1px 6px !important;
}

/* ── Pallini colore ──────────────────────────────────────────────────────────── */

/* .sgp-card__tags and .sgp-card__tag replaced by sc-loop-tags / sc-loop-tag
   in serigest-core sc-attr-frontend.css */

.sgp-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 4px 0 2px;
}

.sgp-card__tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #e4e7ec;
    background: #f5f6f8;
    font-size: 10px;
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
    line-height: 1.6;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sgp-card__swatches {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 4px !important;
    margin: 0 !important;
    min-height: 18px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
}

.sgp-card__swatch {
    display: inline-block !important;
    width: 14px !important;
    height: 14px !important;
    border-radius: 50% !important;
    border: 1.5px solid rgba(0,0,0,.15) !important;
    flex-shrink: 0 !important;
}

.sgp-card__swatch--light {
    border-color: rgba(0,0,0,.30) !important;
}

/* Maschera sfumata sul bianco: copre gli ultimi due pallini, il colore resta pieno sotto */
.sgp-card__swatches-fade {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    position: relative !important;
    flex-shrink: 0 !important;
}
.sgp-card__swatches-fade::after {
    content: '';
    position: absolute;
    inset: -2px 0;
    pointer-events: none;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 22%,
        rgba(255, 255, 255, 0.72) 62%,
        #fff 100%
    );
}

.sgp-card__extra-colors {
    font-size: 11px !important;
    color: #1a1a1a !important;
    font-weight: 650 !important;
    white-space: nowrap !important;
    line-height: 1 !important;
}

/* ── Ordinamento prodotti: nascosto, il catalogo è sempre prezzo crescente ── */

.woocommerce-ordering,
.wp-block-woocommerce-catalog-sorting {
    display: none !important;
}

/* ── Nascondi elementi WC non voluti ─────────────────────────────────────────── */

/* Nasconde qualsiasi li che NON è la nostra card personalizzata
   (subcategorie, placeholder, ecc.) */
.woocommerce ul.products li:not(.sgp-card),
.woocommerce-page ul.products li:not(.sgp-card) {
    display: none !important;
}

/* pulsante aggiungi al carrello */
.woocommerce ul.products li.sgp-card a.button,
.woocommerce ul.products li.sgp-card .added_to_cart {
    display: none !important;
}

/* stelle rating */
.woocommerce ul.products li.sgp-card .star-rating,
.sgp-card .star-rating {
    display: none !important;
}

/* prezzo e titolo default WC (li sostituiamo con i nostri) */
.woocommerce ul.products li.sgp-card .price,
.woocommerce ul.products li.sgp-card .woocommerce-loop-product__title {
    display: none !important;
}

/* ── Paginazione ─────────────────────────────────────────────────────────────── */

.woocommerce-pagination {
    margin-top: 40px !important;
    margin-bottom: 48px !important;
    text-align: center !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

.woocommerce-pagination ul.page-numbers,
.woocommerce nav.woocommerce-pagination ul {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 4px 2px !important;
    border: none !important;
    flex-wrap: nowrap !important;
}

@media (max-width: 768px) {
    .woocommerce-pagination {
        padding: 0 12px !important;
    }

    .woocommerce-pagination ul.page-numbers li a.page-numbers,
    .woocommerce-pagination ul.page-numbers li span.page-numbers {
        width: 32px !important;
        height: 32px !important;
        font-size: 12px !important;
    }

    .woocommerce-pagination ul.page-numbers li a.page-numbers.prev,
    .woocommerce-pagination ul.page-numbers li a.page-numbers.next {
        padding: 0 8px !important;
        font-size: 11px !important;
    }
}

.woocommerce-pagination ul.page-numbers li,
.woocommerce nav.woocommerce-pagination ul li {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.woocommerce-pagination ul.page-numbers li a.page-numbers,
.woocommerce-pagination ul.page-numbers li span.page-numbers {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    border: 1px solid transparent !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    color: #555 !important;
    text-decoration: none !important;
    transition: background .15s, border-color .15s, color .15s !important;
    background: transparent !important;
}

.woocommerce-pagination ul.page-numbers li a.page-numbers:hover {
    background: #f5f6f8 !important;
    border-color: #e4e7ec !important;
    color: #111 !important;
}

.woocommerce-pagination ul.page-numbers li span.page-numbers.current {
    background: #111 !important;
    border-color: #111 !important;
    color: #fff !important;
    font-weight: 700 !important;
}

/* Prev / Next */
.woocommerce-pagination ul.page-numbers li a.page-numbers.prev,
.woocommerce-pagination ul.page-numbers li a.page-numbers.next {
    width: auto !important;
    padding: 0 12px !important;
    border: 1px solid #e4e7ec !important;
    color: #333 !important;
    background: #fff !important;
    font-size: 12px !important;
}

.woocommerce-pagination ul.page-numbers li a.page-numbers.prev:hover,
.woocommerce-pagination ul.page-numbers li a.page-numbers.next:hover {
    background: #111 !important;
    border-color: #111 !important;
    color: #fff !important;
}

/* Ellipsis */
.woocommerce-pagination ul.page-numbers li span.page-numbers.dots {
    border: none !important;
    background: none !important;
    color: #aaa !important;
    cursor: default !important;
    letter-spacing: .05em !important;
}

/* ── Nessun risultato + suggerimenti ──────────────────────── */
.sg-no-results {
    text-align: center;
    padding: 56px 24px 40px;
}

.sg-no-results__icon {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    color: #ccc;
}

.sg-no-results__title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 10px;
}

.sg-no-results__subtitle {
    font-size: .9rem;
    color: #888;
    margin: 0;
}

.sg-no-results__suggestions {
    margin-top: 48px;
    padding-top: 40px;
    border-top: 1px solid #f0f0f0;
}

.sg-no-results__suggestions-title {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #aaa;
    margin-bottom: 24px;
}

/* ── Carosello recensioni in single product ── */
.sg-product-reviews {
    max-width: 1300px;
    margin: 0 auto;
    padding: 48px 10px 30px;
    box-sizing: border-box;
}

.sg-product-reviews__title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    color: #111;
    margin: 0 0 20px;
    padding: 0;
    letter-spacing: -0.02em;
    padding-bottom: 10px !important;
}

.sg-product-reviews .sr-carousel__summary {
    width: 130px;
}

/* ── FAQ sotto il carousel in single product ── */
.sg-product-faq {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 10px 48px;
    box-sizing: border-box;
}

@media (max-width: 700px) {
    .sg-product-reviews {
        padding: 10px 24px 32px;
    }
    .sg-product-faq {
        padding: 0 10px 32px;
    }
}

/* ── Related products slider ── */
.related.products.sg-related-slider {
    max-width: 1300px;
    margin: 48px auto 0;
    padding: 0 10px 24px;
    box-sizing: border-box;
}

.sg-related-slider__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.sg-related-slider__head h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #111;
    margin: 0;
}

.sg-related-slider__nav {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.sg-related-slider__arrow {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 50%;
    background: #fff;
    color: #111;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.sg-related-slider__arrow:hover:not(:disabled) {
    border-color: #111;
}

.sg-related-slider__arrow:disabled {
    opacity: .28;
    cursor: default;
}

.sg-related-slider__viewport {
    overflow: hidden;
}

body.single-product .wp-block-woocommerce-related-products,
body.single-product .wp-block-woocommerce-product-collection[class*="related"] {
    display: none !important;
}

body.single-product ul.products.sg-related-slider__track,
body.woocommerce ul.products.sg-related-slider__track,
body.woocommerce-page ul.products.sg-related-slider__track,
body.woocommerce-cart ul.products.sg-related-slider__track,
.sg-related-slider ul.products,
.sg-related-slider ul.products.sg-related-slider__track {
    display: flex !important;
    align-items: stretch !important;
    grid-template-columns: none !important;
    grid-auto-flow: column !important;
    flex-wrap: nowrap !important;
    gap: 16px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none !important;
    margin: 0 !important;
    padding: 0 0 8px !important;
    float: none !important;
    width: 100% !important;
}

body.single-product ul.products.sg-related-slider__track::-webkit-scrollbar,
.sg-related-slider ul.products.sg-related-slider__track::-webkit-scrollbar {
    display: none;
}

body.single-product ul.products.sg-related-slider__track > li,
body.woocommerce ul.products.sg-related-slider__track > li,
body.woocommerce-cart ul.products.sg-related-slider__track > li,
.sg-related-slider ul.products > li,
.sg-related-slider ul.products.sg-related-slider__track > li.sgp-card {
    flex: 0 0 280px !important;
    width: 280px !important;
    max-width: 280px !important;
    float: none !important;
    scroll-snap-align: start;
    align-self: stretch !important;
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 100% !important;
}

.sg-related-slider .sgp-card__inner {
    flex: 1 1 auto !important;
    min-height: 100% !important;
}

/* Promo single: related cards use full artwork (same 5:6 + contain as .term-promo). */
body.single-product.sg-single-promo .sg-related-slider.sg-related-slider--promo ul.products li.sgp-card .sgp-card__thumb,
body.single-product.sg-single-promo .sg-related-slider--promo .sgp-card__thumb {
    aspect-ratio: 5 / 6 !important;
    background: #fff !important;
}

body.single-product.sg-single-promo .sg-related-slider.sg-related-slider--promo ul.products li.sgp-card .sgp-card__thumb img,
body.single-product.sg-single-promo .sg-related-slider.sg-related-slider--promo ul.products li.sgp-card .sgp-card__img,
body.single-product.sg-single-promo .sg-related-slider--promo .sgp-card__img {
    object-fit: contain !important;
    object-position: center center !important;
}

body.single-product.sg-single-promo .woocommerce ul.products.sg-related-slider__track li.sgp-card:hover .sgp-card__thumb img,
body.single-product.sg-single-promo .woocommerce ul.products.sg-related-slider__track li.sgp-card:hover .sgp-card__img,
body.single-product.sg-single-promo .sg-related-slider--promo .sgp-card:hover .sgp-card__img {
    transform: none !important;
}

@media (max-width: 700px) {
    .related.products.sg-related-slider {
        margin-top: 32px;
        padding: 0 16px 16px;
    }

    .sg-related-slider__nav {
        display: none;
    }

    body.single-product ul.products.sg-related-slider__track > li,
    .sg-related-slider ul.products.sg-related-slider__track > li.sgp-card {
        flex: 0 0 68vw !important;
        width: 68vw !important;
        max-width: 240px !important;
    }
}

/* ── Testo SEO sotto archivio categoria / brand ───────────────────────────── */

.sg-cat-seo-text {
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    text-align: justify;
    margin-top: 48px;
    padding: 48px 24px;
    background: #f8f9fb;
    box-sizing: border-box;
    font-size: .95rem;
    color: #444;
    line-height: 1.8;
}

.sg-cat-seo-text > * {
    display: block;
    max-width: 860px;
    margin-left: auto !important;
    margin-right: auto !important;
}

.sg-cat-seo-text h2 {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
    line-height: 1.3;
}

.sg-cat-seo-text h3 {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 20px auto 8px;
}

.sg-cat-seo-text p {
    display: block;
    margin-bottom: 12px;
}

.sg-cat-seo-text p:last-child {
    margin-bottom: 0;
}

.sg-cat-seo-text strong {
    color: #1a1a1a;
}

@media (max-width: 600px) {
    .sg-cat-seo-text {
        padding: 32px 16px;
        margin-top: 32px;
        font-size: 12px;
    }
}

/* Skeleton foto card: visibile finché l’immagine non è pronta */
.sgp-card__thumb:not(.is-loaded)::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: #ececec;
    animation: sgp-skel 1.05s ease-in-out infinite alternate;
}

.sgp-card__thumb:not(.is-loaded) .sgp-card__img {
    opacity: 0;
}

.sgp-card__thumb.is-loaded .sgp-card__img {
    opacity: 1;
    transition: opacity .22s ease;
}

@keyframes sgp-skel {
    from { opacity: 0.45; }
    to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .sgp-card__thumb:not(.is-loaded)::after {
        animation: none;
        opacity: 0.7;
    }
    .sgp-card__thumb.is-loaded .sgp-card__img {
        transition: none;
    }
}
