/* =================================================================
   FOGLIO DI STILE CSS UNIFICATO E GENERICO PER LANDING PRODOTTI
   ================================================================= */

/* -----------------------------------------------------------------
   0. VARIABILI ROOT & RESET BASE
   ----------------------------------------------------------------- */
:root {
    --cs-primary: #4caf50;        
    --cs-primary-dark: #424242;
    --cs-primary-light: #e8f5e9;
    --cs-dark: #666666;
    --cs-dark-hover: #424242;
    --cs-grey-bg: #f5f5f5;
    --cs-border: #e0e0e0;
    --cs-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --cs-radius: 0px;
    --cs-text-color: #666666;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Tipografia unificata con testo descrittivo allineato a sinistra */
p, 
span, 
li, 
div,
.cs-container p,
.cs-hero-content p,
.cs-col-content p {
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    color: var(--cs-text-color);
    text-align: left !important;
}

/* Reset MasterPage & Elementi Legacy */
header .BG,
.contenuti .path { 
    display: none !important; 
} 

.contenuti ul, 
.contenuti ul li { 
    list-style: none !important; 
    padding: 0 !important; 
    margin: 0 !important; 
}

.corpo {
    display: flex;
    align-items: stretch;
    overflow: visible;
}

.tdPrincipale {
    flex-grow: 1;
    min-width: 0;
}

#sidebarSx, #sidebarDx, .colonnasx, .colonnadx {
    height: auto !important;
    min-height: 100%;
}

.footer {
    clear: both;
    position: relative;
    z-index: 10;
}

/* -----------------------------------------------------------------
   1. LAYOUT CONTENITORE & TITOLI
   ----------------------------------------------------------------- */
.cs-container {
    color: var(--cs-text-color);
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 25px 20px 25px !important;
    line-height: 1.6;
    box-sizing: border-box;
    text-align: left !important;
}

.cs-container *, 
.cs-container *::before, 
.cs-container *::after {
    box-sizing: border-box;
}

.cs-section {
    margin-bottom: 25px;
}

.cs-section-title {
    text-align: center !important;
    font-size: 26px;
    font-weight: 700;
    color: var(--cs-dark);
    margin-top: 0;
    margin-bottom: 20px;
    position: relative;
}

.cs-row-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--cs-dark);
    margin-top: 0;
    margin-bottom: 15px;
    text-align: left !important;
}

.separator {
    height: 1px;
    background: linear-gradient(to right, transparent, #ccc, transparent);
    margin: 40px auto;
    width: 80%;
}

.cs-responsive-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* -----------------------------------------------------------------
   2. HERO BLOCK (BLOCCO INTRODUTTIVO)
   ----------------------------------------------------------------- */
.cs-hero-block {
    margin-top: 0;
    margin-bottom: 35px;
    width: 100%;
}

.cs-hero-img-wrapper {
    width: 100%;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--cs-border);
    margin-bottom: 25px;
}

.cs-hero-img-wrapper .cs-responsive-img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

.cs-hero-title {
    font-size: 32px !important;
    text-align: left !important;
}

.cs-hero-content {
    text-align: left !important;
}

.cs-hero-content p,
.cs-col-content p {
    margin-top: 0 !important;
    margin-bottom: 16px !important;
    text-align: left !important;
}

.cs-hero-content p:last-child,
.cs-col-content p:last-child {
    margin-bottom: 16px !important;
}

/* -----------------------------------------------------------------
   3. SEZIONE MEDIA & GALLERIA IMMAGINI HERO
   ----------------------------------------------------------------- */
.cs-gallery-section {
    max-width: 800px !important;
    margin: 25px auto !important;
    width: 100%;
}

.cs-gallery-grid-full {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    max-width: 800px !important;
    margin: 0 auto !important;
}

.cs-media-section {
    margin-top: 35px;
    margin-bottom: 40px;
    width: 100%;
    box-sizing: border-box;
}

.cs-media-grid {
    display: flex;
    gap: 20px;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
}

.cs-media-col-main {
    width: calc(65% - 10px) !important;
    flex: 0 0 calc(65% - 10px) !important;
    display: flex;
    box-sizing: border-box;
}

.cs-media-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 300px;
    background-color: #ffffff;
    border: 1px solid var(--cs-border);
    box-shadow: var(--cs-shadow);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cs-media-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.cs-media-wrapper img,
.cs-media-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.cs-media-col-side {
    width: calc(35% - 10px) !important;
    flex: 0 0 calc(35% - 10px) !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
}

.cs-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

/* REGOLA AUTOMATICA: Esattamente 3 immagini nella galleria laterale (es. Tavolo Road) */
.cs-gallery-grid:has(> .cs-gallery-item:nth-child(3):last-child) {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
}

.cs-gallery-item {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--cs-border);
    background-color: #ffffff;
    cursor: pointer;
    aspect-ratio: 16 / 9;
}

.cs-gallery-grid:has(> .cs-gallery-item:nth-child(3):last-child) .cs-gallery-item {
    aspect-ratio: 16 / 7 !important;
}

.cs-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.cs-gallery-item:hover img {
    transform: scale(1.06);
    opacity: 0.9;
}

/* Lightbox Overlay (Ingrandimento fino a max 800px nitido) */
.cs-lightbox {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 20px;
}

.cs-lightbox-content {
    margin: auto;
    display: block;
    width: auto;
    height: auto;
    max-width: min(800px, 90vw);
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: csZoom 0.25s ease-out;
}

@keyframes csZoom {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* -----------------------------------------------------------------
   4. LAYOUT A DUE COLONNE & RIGHE ALTERNATE
   ----------------------------------------------------------------- */
.cs-two-columns,
.cs-row {
    display: flex;
    gap: 30px;
    align-items: center;
    margin-bottom: 30px;
}

.cs-row-reverse {
    flex-direction: row-reverse;
}

.cs-col-block,
.cs-col-img,
.cs-col-content {
    flex: 1;
    min-width: 0;
    text-align: left !important;
}

/* -----------------------------------------------------------------
   5. SEZIONE VANTAGGI & BANNER SCURO (CARD VANTAGGI CENTRATE)
   ----------------------------------------------------------------- */
.cs-why-us {
    background-color: var(--cs-grey-bg);
    color: var(--cs-dark);
    padding: 2.5rem 1rem 3rem 1rem;
    margin: 1rem auto 20px auto;
    width: 100%;
    box-sizing: border-box;
}

.cs-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
}

.cs-card {
    background-color: #ffffff;
    border: 1px solid var(--cs-border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center !important;
    height: 100%;
    box-sizing: border-box;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cs-card p {
    text-align: center !important;
}

.cs-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--cs-shadow);
}

.cs-card .img-wrapper {
    max-width: 90px;
    margin: 0 auto 12px auto;
}

.cs-card .img-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

.cs-card h4 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--cs-dark);
    font-weight: 700;
    text-align: center !important;
}

/* Banner Punti di Forza (Scuro) */
.cs-strengths-banner {
    background: linear-gradient(135deg, #424242 0%, #212121 100%);
    color: #ffffff;
    padding: 2rem 1.5rem !important;
    width: 100% !important;
    box-sizing: border-box;
    margin: 20px 0 15px 0 !important;
}

.cs-banner-title {
    text-align: center !important;
    color: #ffffff;
    font-size: 26px;
    margin-top: 0;
    margin-bottom: 25px;
}

.cs-strengths-grid {
    display: flex;
    gap: 30px;
    max-width: 1100px;
    margin: 0 auto;
    text-align: left !important;
}

.cs-strengths-col { flex: 1; }

.cs-strength-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.cs-strength-item strong {
    font-size: 1.05rem;
    color: #ffffff;
    display: block;
    margin-bottom: 3px;
    text-align: left !important;
}

.cs-strength-item p {
    color: #cccccc !important;
    text-align: left !important;
}

/* Lista con Checkmark (Distanza uniforme dal testo sopra) */
.cs-check-list,
.cs-checklist-wrapper {
    list-style: none !important;
    padding: 0 !important;
    margin-top: 15px !important;
    margin-bottom: 20px !important;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left !important;
}

.cs-check-list li,
.cs-checklist-item,
.cs-version-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left !important;
}

.cs-check-icon, 
.cs-check-icon-green, 
.cs-check-icon-fixed {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    color: var(--cs-primary);
    flex-shrink: 0 !important;
    margin-top: 3px !important;
}

/* -----------------------------------------------------------------
   6. VETRINA PRODOTTI UNIFICATA (SCHEDE PRODOTTO CENTRATE)
   ----------------------------------------------------------------- */
.cs-products-grid,
.container-accessori,
.cs-grid-5 {
    display: grid !important;
    /* Valore predefinito standard: 3 colonne */
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 15px !important;
    width: 100% !important;
    margin: 20px auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* REGOLA AUTOMATICA: Esattamente 2 prodotti -> 2 COLONNE ADATTATE ALLA LARGHEZZA */
.cs-products-grid:has(> .cs-product-card:nth-child(2):last-child),
.container-accessori:has(> .card-prodotto:nth-child(2):last-child) {
    grid-template-columns: repeat(2, 1fr) !important;
}

/* REGOLA AUTOMATICA: Esattamente 4 prodotti -> 4 COLONNE SU UNA RIGA */
.cs-products-grid:has(> .cs-product-card:nth-child(4):last-child),
.container-accessori:has(> .card-prodotto:nth-child(4):last-child) {
    grid-template-columns: repeat(4, 1fr) !important;
}

/* REGOLA AUTOMATICA: Esattamente 5 elementi -> 5 COLONNE SU UNA RIGA */
.cs-products-grid:has(> .cs-product-card:nth-child(5):last-child),
.container-accessori:has(> .card-prodotto:nth-child(5):last-child),
.cs-grid-5 {
    grid-template-columns: repeat(5, 1fr) !important;
}

/* REGOLA AUTOMATICA: 9 elementi (o 6, 3) -> 3 COLONNE (3 PER RIGA) */
.cs-products-grid:has(> .cs-product-card:nth-child(9)),
.container-accessori:has(> .card-prodotto:nth-child(9)) {
    grid-template-columns: repeat(3, 1fr) !important;
}

.cs-product-card,
.card-prodotto {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    background: #ffffff !important;
    border: 1px solid var(--cs-border) !important;
    padding: 15px !important;
    text-align: center !important;
    box-sizing: border-box !important;
    height: 100% !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.cs-product-card:hover,
.card-prodotto:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12) !important;
}

/* CONTENITORE IMMAGINI SCHEDA PRODOTTO (QUADRATO PERFECT RESPONSIVE 1:1) */
.cs-product-img-wrapper,
.card-prodotto .img-wrapper {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    max-height: none !important; /* Forza la rimozione di qualsiasi limite di altezza precedente */
    overflow: hidden !important;
    margin-bottom: 12px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 6px !important;
    box-sizing: border-box !important;
}

/* IMMAGINE INTERNA SCHEDA PRODOTTO */
.cs-product-img-wrapper img,
.card-prodotto .img-wrapper img { 
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;  /* Fondamentale: mostra tutta l'immagine senza tagliarla */
    object-position: center !important;
    display: block !important;
    transition: transform 0.3s ease !important;
}

.cs-product-card:hover .cs-product-img-wrapper img,
.card-prodotto:hover .img-wrapper img { 
    transform: scale(1.05) !important; 
}

.cs-product-body,
.card-prodotto .text-content {
    flex-grow: 1 !important;
    text-align: center !important;
    margin-bottom: 12px !important;
}

.cs-product-body h3,
.card-prodotto h3,
.cs-product-body h4,
.card-prodotto h4 { 
    font-size: 1.1rem !important; 
    color: var(--cs-dark) !important; 
    margin: 0 0 8px 0 !important; 
    font-weight: 700 !important;
    text-align: center !important;
}

.cs-product-body p,
.card-prodotto p { 
    margin-bottom: 0 !important; 
    text-align: center !important;
}

/* -----------------------------------------------------------------
   7. BOTTONI & AZIONI
   ----------------------------------------------------------------- */
.cs-btn-wrapper,
.button-wrapper {
    margin-top: 15px !important;
    width: 100%;
}

.cs-btn-primary,
.cs-btn-scopri, 
.btn-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    background-color: var(--cs-primary) !important;
    color: #ffffff !important;
    font-size: 0.92rem !important;
    font-weight: 700;
    padding: 10px 12px;
    text-align: center !important;
    text-decoration: none !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background-color 0.2s ease;
}

.cs-btn-primary:hover,
.cs-btn-scopri:hover, 
.btn-link:hover {
    background-color: var(--cs-primary-dark) !important;
    color: #ffffff !important;
}

/* -----------------------------------------------------------------
   8. MEDIA QUERIES (RESPONSIVE TABLET & MOBILE)
   ----------------------------------------------------------------- */
@media (max-width: 1100px) {
    .cs-products-grid,
    .container-accessori,
    .cs-grid-5,
    .cs-products-grid:has(> .cs-product-card:nth-child(5):last-child) {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 992px) {
    .cs-media-grid {
        flex-direction: column;
    }

    .cs-media-col-main,
    .cs-media-col-side {
        width: 100% !important;
        flex: 0 0 100% !important;
    }

    .cs-two-columns,
    .cs-row,
    .cs-row-reverse {
        flex-direction: column !important;
        gap: 20px !important;
    }

    .cs-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .cs-container {
        padding: 0 16px 16px 16px !important;
    }

    p, span, li, div {
        font-size: 0.9rem !important;
    }

    .cs-hero-title,
    .cs-section-title,
    .cs-banner-title {
        font-size: 20px !important;
    }

    .cs-strengths-grid {
        flex-direction: column;
        gap: 0;
    }

    .cs-gallery-section,
    .cs-gallery-grid-full {
        max-width: 100% !important;
    }

    /* Scorrimento Orizzontale Carte Prodotto su Mobile */
    .cs-products-grid,
    .container-accessori,
    .cs-grid-5 {
        display: flex !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 15px !important;
        padding-bottom: 15px !important;
        margin-bottom: 15px !important;
    }

    .cs-product-card,
    .card-prodotto {
        flex: 0 0 80% !important;
        max-width: 300px !important;
        scroll-snap-align: start !important;
    }

    /* Scrollbar Touch personalizzata */
    .cs-products-grid::-webkit-scrollbar,
    .container-accessori::-webkit-scrollbar {
        height: 5px;
    }

    .cs-products-grid::-webkit-scrollbar-thumb,
    .container-accessori::-webkit-scrollbar-thumb {
        background: var(--cs-primary);
        border-radius: 3px;
    }

    /* Mantiene il box quadrato proporzionato anche nelle card scorrevoli mobile */
    .cs-product-img-wrapper,
    .card-prodotto .img-wrapper {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
        max-height: 200px !important;
        padding: 6px !important;
    }
}

@media (max-width: 480px) {
    .cs-product-card,
    .card-prodotto {
        flex: 0 0 85% !important;
    }
}