/* Main wrapper */
.products-wrapper {
    position: relative;
    max-width: 100%;
}

/* Desktop and Mobile Tabs Bar - Single instance */
.products-tabs-bar {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 24px);
    z-index: 20;
    padding: 8px;
    display: flex;
    gap: 2px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.95);
    transition: background 0.3s ease, backdrop-filter 0.3s ease;
    box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}




@media (min-width: 901px) {
    .products-tabs-bar.has-scroll {
        background: transparent;
        backdrop-filter: none;
        padding: 0px 12px;
        border-radius: 0;
        max-width: 100%;
        box-shadow: none;
    }
    .products-tabs-bar.has-scroll .tab-button {
        background-color: #fff;
    }
}
.products-tabs-bar::-webkit-scrollbar {
    height: 4px;
}

.products-tabs-bar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.products-tabs-bar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.tab-button {
    flex: 1;
    padding: 8px 12px 8px 8px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.6s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    position: relative;
    background-color: transparent;
}


.tab-button:hover {
    background-color: var(--tab-color, #CADEED); /* Usa variabile o fallback */
}

.tab-button.active {
    background-color: var(--tab-color, #CADEED); /* Usa variabile o fallback */
}


.tab-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.tab-icon.vergella { background: #66AEE0; }
.tab-icon.edilizia { background: #00358E; }
.tab-icon.strade { background: #1A1A1A; }
.tab-icon.saldatura { background: #FE5000; }
.tab-icon.trafilati { background: #00ACA0; }
.tab-icon.automotive { background: #8B4513; }
.tab-icon.energia { background: #FFD700; }

.tab-button[data-product="vergella"] { --tab-color: #66AEE0; }
.tab-button[data-product="edilizia"] { --tab-color: #00358E; }
.tab-button[data-product="strade"] { --tab-color: #1A1A1A; }
.tab-button[data-product="saldatura"] { --tab-color: #FE5000; }
.tab-button[data-product="trafilati"] { --tab-color: #00ACA0; }
.tab-button[data-product="automotive"] { --tab-color: #8B4513; }
.tab-button[data-product="energia"] { --tab-color: #FFD700; }

.tab-text {
    text-align: left;
    flex: 1;
    min-width: 0;

}

.tab-name {
    color: var(--grey, #475569);
    text-align: center;
    font-family: 'Univers', "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 20px; /* 125% */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.6s ease;
}

.tab-summary {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Product Preview Area */
.product-previews-container {
    position: relative;
    width: 100%;
    aspect-ratio: 2.6;
    min-height: 400px;
    background-color: #000;
}

.product-preview {
    max-width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    aspect-ratio: 2.6;
    min-height: 400px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    pointer-events: none;
    z-index: 1;
}

.product-preview.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 2;
}



.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.00) 30.66%, rgba(0, 0, 0, 0.45) 66.35%, rgba(0, 0, 0, 0.63) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 50px;
    color: white;
    max-width: 100%;
}

.color-filter {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    mix-blend-mode: multiply;
    opacity: 0.3;
    transition: opacity 0.6s ease;
}

.color-filter.vergella {
    background: linear-gradient(135deg, #66AEE0 0%, #66AEE0D9 50%, #66AEE04D 100%);
}

.color-filter.edilizia {
    background: linear-gradient(135deg, #00358E 0%, #00358ED9 50%, #00358E4D 100%);
}

.color-filter.strade {
    background: linear-gradient(135deg, #1A1A1A 0%, #1A1A1AD9 50%, #FFFFFF4D 100%);
}

.color-filter.saldatura {
    background: linear-gradient(135deg, #FE5000 0%, #FE5000D9 50%, #FE50004D 100%);
}

.color-filter.trafilati {
    background: linear-gradient(135deg, #00ACA0 0%, #00ACA0D9 50%, #00ACA04D 100%);
}

.color-filter.automotive {
    background: linear-gradient(135deg, #8B4513 0%, #8B4513D9 50%, #8B45134D 100%);
}

.color-filter.energia {
    background: linear-gradient(135deg, #FFD700 0%, #FFD700D9 50%, #FFD7004D 100%);
}

.preview-content {
    position: relative;
    margin: 0 auto;
    width: 100%;
    max-width: 1328px;
    z-index: 10;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease 0.2s, transform 0.6s ease 0.2s;
}
.product-preview.active .preview-content {
    opacity: 1;
    transform: translateY(0);
}

.preview-title {
    font-size: 4rem;
    font-weight: 300;
    letter-spacing: -2px;
    margin-bottom: 25px;
    line-height: 0.9;
}

.preview-details {
    display: block;
    margin: 0 auto;
}

.preview-feature {
    display: flex;
    flex-direction: column;
}

.preview-feature-title {
    color: #FFF;
    font-size: 24px;
    font-style: normal;
    font-weight: 700;
    line-height: 24px;
    margin: 0 0 8px;
}

.preview-feature-text {
    color: #FFF;
    font-size: 20px;
    font-style: normal;
    font-weight: 400;
    line-height: 28px; 
    margin: 0 0 24px;
}


a.preview-cta {
    display: inline-block;
    padding: 16px;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border-radius: 16px;
    background: var(--white, #FFF);
    color: var(--grey, #475569);
    font-size: 16px;
    font-style: normal;
    font-weight: 700;
    line-height: 24px; 
    text-decoration: none;
}

.mobile-products-toggle {
    display: none;
}

/* Desktop hover behavior */
@media (min-width: 901px) {
    .tab-button:hover:not(.active) {
        /* Trigger preview on hover */
    }
    
    /* Auto-show preview on hover */
    .tab-button:hover ~ .products-previews-container .product-preview[data-product] {
        display: none;
    }
}

/* Mobile Dropdown - Hidden by default on desktop */
.mobile-dropdown {
    display: none;
}

/* Mobile Styles */
@media (max-width: 900px) {
    .container {
        padding: 20px 15px;
    }
    .mobile-products-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: absolute;
        gap: 4px;
        top: 16px;
        left: 16px;
        z-index: 21;
        padding: 7px 16px;
        background: #fff;
        border: none;
        border-radius: 16px;
        color: #475569;
        font-size: 12px;
        font-style: normal;
        font-weight: 700;
        line-height: 16px; /* 133.333% */
        cursor: pointer;
    }

    .toggle-text {
        flex: 1;
        text-align: left;
    }

    .toggle-arrow {
        width: 10px;
        height: 6px;
        background-image: url(../img/arrow-down-grigia.svg);
        background-repeat: no-repeat;
        background-size: 10px 6px;
        background-position: center;
        transition: transform 0.3s ease;
        transform: rotate(0deg); /* Aperto di default */
    }

    /* Quando chiuso, ruota la freccia */
    .mobile-products-toggle:not(.open) .toggle-arrow {
        transform: rotate(180deg);
    }


    .products-tabs-bar {
        top: 51px;
        left: 16px;
        width: auto;
        flex-direction: column;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);
        padding: 4px;
        gap: 4px;
        max-height: 500px; /* Open by default */
        transition: max-height 0.4s ease, opacity 0.3s ease;
        overflow: hidden;
        transform: none;
    }

    .products-tabs-bar:not(.open) {
        max-height: 0;
        opacity: 0;
        pointer-events: none;
    }
     .tab-button {
        padding: 4px 8px 4px 4px;
        color: var(--grey, #475569);
        font-size: 12px;
        font-style: normal;
        font-weight: 400;
        line-height: 16px;
        text-align: left;
        gap: 8px;
        border-radius: 8px;
        transition: background-color 0.6 ease-in-out;
     }
    /* First tab becomes toggle button on mobile with "Prodotti" label */
    .tab-button:first-child {
        background: transparent;
        color: white;
        min-width: unset;
        position: relative;
    }

    

    /*.tab-button:first-child::after {
        content: '▼';
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%) rotate(180deg); 
        transition: transform 0.3s ease;
        font-size: 14px;
    }

    .products-tabs-bar:not(.open) .tab-button:first-child::after {
        transform: translateY(-50%) rotate(0deg); 
    }*/

    

    /* Other tabs */
    

    

    

    


    .tab-button .tab-icon {
        width: 32px;
        height: 32px;
    }
    .tab-button .tab-name {
        text-align: left;
        color: var(--grey, #475569);
        font-size: 12px;
        font-style: normal;
        font-weight: 400;
        line-height: 16px; /* 133.333% */
    }


    .product-preview,
    .product-previews-container {
        min-height: 500px;
    }

    .preview-overlay {
        padding: 120px 20px 30px 20px;
    }

    .preview-feature-title {
        color: #FFF;
        font-size: 24px;
        font-style: normal;
        font-weight: 700;
        line-height: 28px; /* 116.667% */
    }

    .preview-feature-text {
        color: #FFF;
        font-size: 16px;
        font-style: normal;
        font-weight: 400;
        line-height: 20px; /* 125% */
    }

    .preview-cta {
        padding: 15px 25px;
        font-size: 0.9rem;
    }
}



/* Tablet breakpoint */
@media (max-width: 1220px) and (min-width: 901px) {

    .tab-name {
        font-size: 14px;
    }

    .tab-summary {
        font-size: 11px;
    }

    .preview-title {
        font-size: 3rem;
    }

    .preview-details {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .preview-divider {
        display: none;
    }
}