/* ===================================================== */
/* === HOMEPAGE CARDS CSS - SOLO WOOCOMMERCE BLOCKS === */
/* === Estratto da custom-product-cards.css === */
/* ===================================================== */

/* === MAPPATURA SELETTORI BLOCKS → TRADIZIONALI === */

/* Card principale - WooCommerce Blocks */
body.woocommerce ul.wc-block-product-template__responsive li.wc-block-product,
body.woocommerce-page ul.wc-block-product-template__responsive li.wc-block-product,
ul.wc-block-product-template__responsive li.wc-block-product {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    justify-content: space-between !important;
    
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 0 !important;
    
    transform: translateY(0);
    will-change: transform, box-shadow;
    
    margin: 0 !important;
    list-style: none !important;
}

/* Hover effects per WooCommerce Blocks - SOLO DESKTOP */
@media (min-width: 922px) {
    ul.wc-block-product-template__responsive li.wc-block-product:hover {
        transform: translateY(-12px) scale(1.02);
        box-shadow: 
            0 20px 40px rgba(20, 141, 70, 0.15),
            0 0 0 1px rgba(20, 141, 70, 0.1);
        background: linear-gradient(145deg, #ffffff 0%, #f0f9f4 100%);
    }
}

/* Effetto glow per WooCommerce Blocks - SOLO DESKTOP */
@media (min-width: 922px) {
    ul.wc-block-product-template__responsive li.wc-block-product::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(45deg, 
            rgba(20, 141, 70, 0.1) 0%,
            rgba(16, 185, 129, 0.1) 50%,
            rgba(34, 197, 94, 0.1) 100%);
        opacity: 0;
        transition: opacity 0.4s ease;
        pointer-events: none;
        z-index: 1;
    }

    ul.wc-block-product-template__responsive li.wc-block-product:hover::before {
        opacity: 1;
    }
}

/* === THUMBNAIL WOOCOMMERCE BLOCKS === */
.wc-block-components-product-image {
    overflow: hidden;
    position: relative;
    background: transparent !important;
    border-radius: 12px 12px 0 0;
    z-index: 2;
    padding: 15px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box;
    cursor: pointer;
    
    /* DIMENSIONI RESPONSIVE FLUIDE */
    width: clamp(110px, 20vw, 180px) !important;
    height: clamp(110px, 20vw, 180px) !important;
    aspect-ratio: 1 / 1 !important;
    margin: 0 auto !important;
}

.wc-block-components-product-image a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    position: relative;
    z-index: 3;
}

.wc-block-components-product-image img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    object-position: center;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0;
    display: block !important;
    background: transparent !important;
    margin: 0 auto !important;
    transform-origin: center center !important;
}

/* MANTIENI ZOOM SOLO SU DESKTOP per WooCommerce Blocks */
@media (min-width: 922px) {
    .wc-block-components-product-image:hover img {
        transform: scale(1.05) !important;
        transform-origin: center center !important;
        filter: brightness(1.1) saturate(1.2);
    }
}

/* === TITOLO WOOCOMMERCE BLOCKS === */
.wp-block-post-title,
h2.wp-block-post-title {
    font-size: clamp(11px, 2.5vw, 16px) !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    margin: 6px auto 8px !important;
    color: #1f2937 !important;
    min-height: 30px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
    text-align: center !important;
    width: 100% !important;
    
    /* Override stili inline */
    line-height: 1.3 !important;
    margin-bottom: 8px !important;
    margin-top: 6px !important;
}

.wp-block-post-title a {
    color: inherit !important;
    text-decoration: none !important;
}

@media (min-width: 922px) {
    .wp-block-post-title:hover,
    .wp-block-post-title a:hover {
        color: #148d46 !important;
        text-shadow: 0 1px 2px rgba(20, 141, 70, 0.1);
    }
}

/* === PREZZO WOOCOMMERCE BLOCKS === */
.wp-block-woocommerce-product-price .wc-block-components-product-price,
.wc-block-components-product-price {
    font-size: clamp(14px, 3.5vw, 20px) !important;
    font-weight: 800 !important;
    color: #148d46 !important;
    margin: 12px auto 16px !important;
    text-shadow: 0 1px 2px rgba(20, 141, 70, 0.2);
    position: relative;
    text-align: center !important;
    display: block !important;
}

.wc-block-components-product-price::before {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 25px;
    height: 2px;
    background: linear-gradient(45deg, #148d46, #10b981);
    border-radius: 1px;
}

/* === PULSANTE WOOCOMMERCE BLOCKS === */
.wp-block-button.wc-block-components-product-button,
.wc-block-components-product-button {
    margin: 0 auto !important;
    width: 100% !important;
}

.wp-block-button__link.wc-block-components-product-button__button,
.wc-block-components-product-button__button {
    background: linear-gradient(45deg, #148d46 0%, #10b981 100%) !important;
    color: white !important;
    border: none !important;
    padding: 14px 20px !important;
    border-radius: 25px !important;
    font-weight: 600 !important;
    font-size: clamp(9px, 2vw, 11px) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 15px rgba(20, 141, 70, 0.4) !important;
    position: relative !important;
    overflow: hidden !important;
    text-decoration: none !important;
    margin: 0 auto !important;
    width: 100% !important;
    text-align: center !important;
    
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    height: auto !important;
    min-height: 44px !important;
}

.wp-block-button__link.wc-block-components-product-button__button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
}

@media (min-width: 922px) {
    .wp-block-button__link.wc-block-components-product-button__button:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 8px 25px rgba(20, 141, 70, 0.6) !important;
        background: linear-gradient(45deg, #0f7b3c 0%, #059669 100%) !important;
    }

    .wp-block-button__link.wc-block-components-product-button__button:hover::before {
        left: 100%;
    }
}

/* === SUPPORTO GRIGLIE WOOCOMMERCE BLOCKS === */
ul.wc-block-product-template__responsive.columns-6:not(.swiper-slide-content) {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 25px !important;
    justify-content: center;
    margin: 0 auto;
    max-width: 1800px;
}

/* ===================================================== */
/* === RESPONSIVE COLUMNS-6 === */
/* ===================================================== */

/* === TABLET (fino a 921px) === */
@media (max-width: 921px) {
    /* Columns-6: 3 colonne su tablet */
    ul.wc-block-product-template__responsive.columns-6:not(.swiper-slide-content) {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 18px !important;
        max-width: 1200px !important;
    }
    
    /* Font sizes tablet per WooCommerce Blocks */
    .wp-block-post-title { 
        font-size: clamp(12px, 2.2vw, 14px) !important;
    }
    .wc-block-components-product-price { 
        font-size: clamp(16px, 3vw, 18px) !important;
    }
    .wp-block-button__link.wc-block-components-product-button__button { 
        font-size: clamp(9px, 1.8vw, 10px) !important;
    }
}

/* === MOBILE (fino a 768px) === */
@media (max-width: 768px) {
    /* Columns-6: 2 colonne su mobile */
    ul.wc-block-product-template__responsive.columns-6:not(.swiper-slide-content) {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    /* Font sizes mobile responsive per WooCommerce Blocks */
    .wp-block-post-title { 
        font-size: clamp(11px, 2.5vw, 14px) !important;
    }
    .wc-block-components-product-price { 
        font-size: clamp(14px, 3.5vw, 17px) !important;
    }
    .wp-block-button__link.wc-block-components-product-button__button { 
        font-size: clamp(10px, 2.2vw, 12px) !important;
    }
}

/* === MOBILE PICCOLO (fino a 480px) === */
@media (max-width: 480px) {
    /* Columns-6: 2 colonne su mobile piccolo */
    ul.wc-block-product-template__responsive.columns-6:not(.swiper-slide-content) {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    /* Font sizes mobile piccolo responsive per WooCommerce Blocks */
    .wp-block-post-title { 
        font-size: clamp(10px, 2.8vw, 12px) !important;
    }
    .wc-block-components-product-price { 
        font-size: clamp(12px, 4vw, 15px) !important;
    }
    .wp-block-button__link.wc-block-components-product-button__button { 
        font-size: clamp(9px, 2.5vw, 11px) !important;
    }
}

/* === MOBILE EXTRA PICCOLO (fino a 320px) === */
@media (max-width: 320px) {
    /* Font sizes mobile extra piccolo */
    .wp-block-post-title { 
        font-size: 10px !important;
    }
    .wc-block-components-product-price { 
        font-size: 12px !important;
    }
    .wp-block-button__link.wc-block-components-product-button__button { 
        font-size: 9px !important;
    }
}

/* ===================================================== */
/* === DISABILITA TUTTI GLI EFFETTI TOUCH/CLICK SU MOBILE === */
/* ===================================================== */

@media (max-width: 921px) {
    
    /* WOOCOMMERCE BLOCKS - tutti gli stati */
    ul.wc-block-product-template__responsive li.wc-block-product:hover,
    ul.wc-block-product-template__responsive li.wc-block-product:active,
    ul.wc-block-product-template__responsive li.wc-block-product:focus,
    ul.wc-block-product-template__responsive li.wc-block-product:focus-within {
        transform: none !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
        background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%) !important;
    }
    
    ul.wc-block-product-template__responsive li.wc-block-product:hover::before,
    ul.wc-block-product-template__responsive li.wc-block-product:active::before,
    ul.wc-block-product-template__responsive li.wc-block-product:focus::before {
        opacity: 0 !important;
    }
    
    .wc-block-components-product-image:hover img,
    .wc-block-components-product-image:active img,
    .wc-block-components-product-image:focus img {
        transform: none !important;
        filter: none !important;
    }
    
    .wc-block-components-product-image a:hover img,
    .wc-block-components-product-image a:active img,
    .wc-block-components-product-image a:focus img {
        transform: none !important;
        filter: none !important;
    }
    
    .wp-block-post-title:hover,
    .wp-block-post-title:active,
    .wp-block-post-title:focus,
    .wp-block-post-title a:hover,
    .wp-block-post-title a:active,
    .wp-block-post-title a:focus {
        color: #1f2937 !important;
        text-shadow: none !important;
    }
    
    .wp-block-button__link.wc-block-components-product-button__button:hover,
    .wp-block-button__link.wc-block-components-product-button__button:active,
    .wp-block-button__link.wc-block-components-product-button__button:focus {
        transform: none !important;
        box-shadow: 0 4px 15px rgba(20, 141, 70, 0.4) !important;
        background: linear-gradient(45deg, #148d46 0%, #10b981 100%) !important;
    }
    
    .wp-block-button__link.wc-block-components-product-button__button:hover::before,
    .wp-block-button__link.wc-block-components-product-button__button:active::before,
    .wp-block-button__link.wc-block-components-product-button__button:focus::before {
        left: -100% !important;
    }
    
    /* === RIMUOVI TUTTI I WEBKIT TOUCH EFFECTS === */
    ul.wc-block-product-template__responsive li.wc-block-product,
    .wc-block-components-product-image,
    .wc-block-components-product-image a,
    .wp-block-post-title,
    .wp-block-post-title a,
    .wp-block-button__link.wc-block-components-product-button__button {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        user-select: none !important;
    }
    
    /* === FORZA STATI NORMALI SEMPRE === */
    ul.wc-block-product-template__responsive li.wc-block-product {
        transform: translateY(0) !important;
        will-change: auto !important;
    }
    
    /* === RIMUOVI TUTTE LE TRANSIZIONI NON ESSENZIALI === */
    ul.wc-block-product-template__responsive li.wc-block-product,
    .wc-block-components-product-image img,
    .wp-block-button__link.wc-block-components-product-button__button {
        transition: none !important;
    }
}

/* === ACCESSIBILITÀ MIGLIORATA === */
@media (prefers-reduced-motion: reduce) {
    ul.wc-block-product-template__responsive li.wc-block-product { 
        transition: none !important; 
    }
    .wc-block-components-product-image img { 
        transition: none !important; 
    }
    
    /* Disabilita hover effects se l'utente preferisce meno movimento */
    ul.wc-block-product-template__responsive li.wc-block-product:hover {
        transform: none !important;
    }
}

/* === HIGH DPI DISPLAYS === */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    ul.wc-block-product-template__responsive li.wc-block-product {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12) !important;
    }
}

/* === TOUCH-FRIENDLY SU MOBILE === */
@media (max-width: 921px) {
    .wp-block-button__link.wc-block-components-product-button__button {
        min-height: 44px !important; /* Touch target standard */
        min-width: 44px !important;
        touch-action: manipulation !important;
    }
    
    /* Migliora performance su mobile */
    ul.wc-block-product-template__responsive li.wc-block-product {
        will-change: auto !important; /* Riduce uso GPU */
    }
    
    .wc-block-components-product-image img {
        will-change: auto !important;
    }
}