.hpc-widget,
.hpc-widget * {
    box-sizing: border-box;
}

.hpc-widget {
    width: 100%;
    --hpc-per-view: 4;
    --hpc-gap: 20px;
    --hpc-green: #3a8050;
    --hpc-black: #191919;
    --hpc-muted: #6b7280;
    --hpc-border: #e5e7eb;
    --hpc-soft: #f5f6f5;
}

.hpc-tabs-wrap {
    position: relative;
    width: 100%;
    margin: 0 0 34px;
}

.hpc-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0;
}

.hpc-tab {
    appearance: none;
    border: 1px solid transparent;
    background: #f0f1f2;
    color: #6b7280;
    min-height: 48px;
    padding: 0 34px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.hpc-tab:hover {
    color: var(--hpc-black);
    transform: translateY(-1px);
}

.hpc-tab.is-active {
    background: var(--hpc-green);
    border-color: var(--hpc-green);
    color: #fff;
}

.hpc-carousel {
    position: relative;
    width: 100%;
}

.hpc-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - (var(--hpc-gap) * (var(--hpc-per-view) - 1))) / var(--hpc-per-view));
    gap: var(--hpc-gap);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0 10px;
    scrollbar-width: none;
    justify-content: flex-start;
}

.hpc-track::-webkit-scrollbar {
    display: none;
}

.hpc-card {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: none;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--hpc-border);
    border-radius: 18px;
    box-shadow: none;
    transition: transform .22s ease, border-color .22s ease;
}

.hpc-card:hover {
    transform: translateY(-3px);
    border-color: #d8ded8;
}

.hpc-card.is-hidden {
    display: none !important;
}

.hpc-media {
    display: block;
    width: 100%;
    padding: 12px 12px 0;
    text-decoration: none !important;
}

.hpc-image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    object-fit: contain;
    border-radius: 14px;
    background: #f8faf8;
}

.hpc-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 22px 18px 20px;
}

.hpc-category {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    max-width: 100%;
    min-height: 32px;
    padding: 6px 10px;
    margin: 0 0 14px;
    border-radius: 8px;
    background: #f3f6f3;
    color: var(--hpc-green);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}

.hpc-category svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hpc-title {
    margin: 0 0 14px;
    font-size: 21px;
    font-weight: 650;
    line-height: 1.16;
    letter-spacing: -0.02em;
}

.hpc-title a {
    color: var(--hpc-black);
    text-decoration: none !important;
}

.hpc-title a:hover {
    color: var(--hpc-green);
}

.hpc-excerpt {
    margin: -2px 0 16px;
    color: var(--hpc-muted);
    font-size: 14px;
    line-height: 1.5;
}

.hpc-footer {
    margin-top: auto;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.hpc-price {
    color: var(--hpc-black);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
}

.hpc-price del {
    opacity: .45;
    font-weight: 500;
}

.hpc-price ins {
    text-decoration: none;
}

.hpc-tax {
    font-weight: 500;
}

.hpc-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    white-space: nowrap;
    color: var(--hpc-green);
    border: 1px solid rgba(58, 128, 80, .22);
    background: rgba(58, 128, 80, .08);
    border-radius: 999px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none !important;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.hpc-cta:hover {
    color: #fff;
    background: var(--hpc-green);
    border-color: var(--hpc-green);
    transform: translateY(-1px);
}

.hpc-cta-icon,
.hpc-cta-icon svg,
.hpc-cta-icon i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    font-size: 13px;
    line-height: 1;
}

.hpc-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid var(--hpc-border);
    border-radius: 999px;
    background: #fff;
    color: var(--hpc-black);
    box-shadow: 0 10px 28px rgba(15, 23, 42, .10);
    cursor: pointer;
    transform: translateY(-50%);
    transition: transform .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
}

.hpc-arrow:hover {
    transform: translateY(-50%) scale(1.04);
}

.hpc-arrow:disabled {
    opacity: .35;
    cursor: default;
    pointer-events: none;
}

.hpc-arrow svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hpc-arrow--prev { left: -26px; }
.hpc-arrow--next { right: -26px; }

.hpc-empty {
    padding: 24px;
    border: 1px solid var(--hpc-border);
    border-radius: 14px;
    color: var(--hpc-muted);
    background: #fff;
    text-align: center;
}

@media (max-width: 1024px) {
    .hpc-widget { --hpc-per-view: 2; }
    .hpc-arrow--prev { left: -16px; }
    .hpc-arrow--next { right: -16px; }
}

@media (max-width: 767px) {
    .hpc-widget {
        --hpc-per-view: 1;
        --hpc-gap: 16px;
    }

    .hpc-tabs-wrap {
        overflow: hidden;
        margin-bottom: 22px;
    }

    .hpc-tabs-wrap::before,
    .hpc-tabs-wrap::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        z-index: 2;
        width: 36px;
        pointer-events: none;
    }

    .hpc-tabs-wrap::before {
        left: 0;
        background: linear-gradient(90deg, #fff 0%, rgba(255,255,255,0) 100%);
    }

    .hpc-tabs-wrap::after {
        right: 0;
        background: linear-gradient(270deg, #fff 0%, rgba(255,255,255,0) 100%);
    }

    .hpc-tabs {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 22px 4px 0;
        margin: 0;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .hpc-tabs::-webkit-scrollbar { display: none; }

    .hpc-tab {
        flex: 0 0 auto;
        min-height: 44px;
        padding: 0 22px;
        font-size: 14px;
        border-radius: 12px;
    }

    .hpc-card { border-radius: 16px; }
    .hpc-title { font-size: 20px; }

    .hpc-footer {
        align-items: center;
    }

    .hpc-cta {
        min-height: 34px;
        padding: 0 11px;
    }

    .hpc-arrow {
        width: 44px;
        height: 44px;
    }

    .hpc-arrow--prev { left: 8px; }
    .hpc-arrow--next { right: 8px; }
}


/* v1.2 - Mantiene sempre la larghezza della colonna impostata anche quando una tab mostra un solo prodotto */
.hpc-track[data-hpc-track] {
    width: 100%;
}

.hpc-track[data-hpc-track] > .hpc-card:not(.is-hidden) {
    width: 100% !important;
    max-width: none !important;
}

.hpc-track[data-hpc-track] > .hpc-card.is-hidden {
    display: none !important;
}
