/*
 * ===================================================================
 * CRITICAL STYLES - EXCLUDED FROM WP ROCKET OPTIMIZATION
 * ===================================================================
 */

/* --- GLOBAL STYLES --- */
/*
 * Function: Sets the default link color for main content areas.
 * This selector targets links inside the main content (#main-content .entry-content)
 * but excludes links that are also styled as Divi buttons (.et_pb_button).
 */
#main-content .entry-content a:not(.et_pb_button) {
    color: #762681; /* Your purple color */
    text-decoration: underline;
}

#main-content .entry-content a:not(.et_pb_button):hover {
    text-decoration: none;
}

/* --- CUSTOM 'ADD TO CART' POPUP --- */

/* * Function: The full-screen overlay container for our custom popup.
 */
#custom-popup-wrapper {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
}

#custom-popup-wrapper.is-visible {
    display: flex;
}

/* * Function: Styles the Divi Section when it's acting as the modal box.
 */
#custom-popup-wrapper .et_pb_section {
    max-width: 600px;
    width: 100%;
    margin: auto;
    max-height: 90vh;
    position: relative;
    padding: 0 2em 2em 2em !important;
    border-radius: 30px;
}

/* * Function: Styles the first row containing the notification and upsells.
 */
#custom-popup-wrapper .et_pb_row_1_tb_body {
    padding-bottom: 0 !important;
}

/* * Function: Styles the column inside the second row that holds the buttons.
 */
#custom-popup-wrapper .et_pb_column_8_tb_body {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    align-items: center;
}

/* * Function: General styling for buttons inside the popup.
 */
#custom-popup-wrapper .et_pb_button {
    padding: 10px 20px !important;
    font-size: 13px !important;
    margin: 0 !important;
    border-radius: 50px !important;
    /* font-weight: 700 !important;
    letter-spacing: 0.16em !important; */
    transition: all 0.3s ease;
}

/* * Function: Hides any potential icon Divi adds on hover.
 */
#custom-popup-wrapper .et_pb_button::after {
    display: none !important;
}

/* * Function: Styles the "Continue Shopping" button.
 */
#custom-popup-wrapper .et_pb_button_3_tb_body {
    color: #8410EA !important;
    background-color: #ffffff !important;
    border: 2px solid #8410EA !important;
}
#custom-popup-wrapper .et_pb_button_3_tb_body:hover {
    color: #F9F9F9 !important;
    background-color: #8410EA !important;
}

/* * Function: Styles the "Go to Cart" button.
 */
#custom-popup-wrapper .et_pb_button_4_tb_body {
    color: #F9F9F9 !important;
    background-color: #8410EA !important;
    border: 2px solid #8410EA !important;
}
#custom-popup-wrapper .et_pb_button_4_tb_body:hover {
    color: #8410EA !important;
    background-color: #F9F9F9 !important;
}

/* * Function: Responsive styles for the buttons column on mobile.
 */
@media all and (max-width: 767px) { /* Phone */
    #custom-popup-wrapper .et_pb_column_8_tb_body {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    #custom-popup-wrapper .et_pb_button {
       text-align: center;
    }
}

/* * Function: Styles the close button.
 */
#custom-popup-wrapper .popup-close-button {
    cursor: pointer !important;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

/*
 * ===================================================================
 * AREA: HOMEPAGE STYLES
 * ===================================================================
 */

/* --- SLIDER BASE STYLES --- */
.home .et_pb_shop .products {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 10px;
    white-space: nowrap;
    padding: 10px 0;
    -ms-overflow-style: none; /* Hide scrollbar in IE/Edge */
    scrollbar-width: none;    /* Hide scrollbar in Firefox */
}

.home .et_pb_shop .products::-webkit-scrollbar {
    display: none; /* Hide scrollbar in WebKit browsers */
}

/* Prevent products from wrapping */
.home .et_pb_shop .products li.product {
    flex: 0 0 auto;
    margin: 0;
}

/* Limit max height of product cards in homepage slider */
.home #homepage-slider .woocommerce-LoopProduct-link.woocommerce-loop-product__link {
    max-height: 450px !important;
}


/* --- SLIDER ARROWS --- */
.home .slider-prev,
.home .slider-next {
    background-color: #840fea;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Position arrows outside slider on desktop */
.home .slider-prev {
    position: absolute;
    top: 50%;
    left: -50px;
    transform: translateY(-50%);
}
.home .slider-next {
    position: absolute;
    top: 50%;
    right: -50px;
    transform: translateY(-50%);
}

/* Arrow hover effect */
.home .slider-prev:hover,
.home .slider-next:hover {
    background-color: #6c0fba;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.3);
}


/* --- PAGINATION --- */
/* Hide dots if you don’t use pagination visually */
.home .slider-pagination {
    display: none !important;
}


/* --- RESPONSIVE BEHAVIOR --- */
@media (max-width: 980px) {
    .home #homepage-slider {
        margin-bottom: 0 !important;
    }
    .home .slider-controls-mobile {
        display: flex;
        justify-content: center;
        margin-bottom: 30px;
        margin-top: 30px;
        gap: 10px;
    }
    .home .slider-prev,
    .home .slider-next {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        transform: none;
        margin: 0 !important;
        z-index: 1;
    }
}


/* --- RESPONSIVE COLUMNS CONFIGURATION --- */

/* Up to 680px: 1.5 products visible */
@media (max-width: 680px) {
    .home.woocommerce-page ul.products li.product:nth-child(n) {
        flex: 0 0 calc(100% / 1.5) !important;
        max-width: calc(100% / 1.5) !important;
        margin: 0 !important;
    }
}

/* From 681px to 770px: 2 products */
@media (min-width: 681px) and (max-width: 770px) {
    .home.woocommerce-page ul.products li.product:nth-child(n) {
        flex: 0 0 calc(50% - 12px) !important;
        max-width: calc(50% - 12px) !important;
        margin: 0 !important;
    }
}

/* From 771px to 980px: 3 products */
@media (min-width: 771px) and (max-width: 980px) {
    .home.woocommerce-page ul.products li.product:nth-child(n) {
        flex: 0 0 calc(33.333% - 10px) !important;
        max-width: calc(33.333% - 10px) !important;
        margin: 0 !important;
        min-height: fit-content;
    }
}

/* From 981px to 1480px: 4 products */
@media (min-width: 981px) and (max-width: 1480px) {
    .home.woocommerce-page ul.products li.product:nth-child(n) {
        flex: 0 0 calc(25% - 10px) !important;
        max-width: calc(25% - 10px) !important;
        margin: 0 !important;
    }
    /* PATCH: prima era h2, ora agganciato alla classe del titolo */
     .home .et_pb_shop_0.et_pb_shop li.product h3 {
        min-height: 40px !important;
		    padding: 10px 20px 10px 20px !important;
    }
}

/* From 1481px to 1980px: 5 products */
@media (min-width: 1481px) and (max-width: 1980px) {
    .home.woocommerce-page ul.products li.product:nth-child(n) {
        flex: 0 0 calc(20% - 10px) !important;
        max-width: calc(20% - 10px) !important;
        margin: 0 !important;
    }
}

/* Over 1981px: 6 products */
@media (min-width: 1981px) {
    .home.woocommerce-page ul.products li.product:nth-child(n) {
        flex: 0 0 calc(16.666% - 10px) !important;
        max-width: calc(16.666% - 10px) !important;
        margin: 0 !important;
    }
}
.et_pb_shop_0.et_pb_shop .woocommerce ul.products li.product h3 { min-height: 40px !important;
		    padding: 10px 20px 10px 20px !important;}

/* --- WRAPPING RULES --- */

/* Allow product titles and prices to wrap naturally */
.home .woocommerce-loop-product__title,
.home .price {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Min-height constraint for specific slider layout */
.home .cat-page-in-slide .et_pb_module_inner {
    min-height: 300px !important;
}

/* ===================================================================
   PRICE BLOCK + FOX + STILI PREZZI
   =================================================================== */

/* Contenitore price – margine verticale uniforme per TUTTI i prodotti */
.home .price {
    display: flex !important;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
    margin-top: 20px;   /* spaziatura unica sopra */
    margin-bottom: 10px;/* e sotto */
}

/* Wrapper FOX, tieni row-reverse per avere bubble a destra */
.home .price .woocs_price_code {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 20px;
}

/* Mantieni le pillole dei prezzi pulite */
.home .price .woocommerce-Price-amount {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

/* Ordine: prezzo finale (ins) prima, originale (del) dopo */
.home .price ins {
    order: 1;
}

.home .price del {
    order: 2;
}

/* ---------- PREZZO FINALE (bubble viola) ---------- */

/* Sale: prezzo finale dentro <ins> */
.home .price ins .woocommerce-Price-amount.amount,
/* Prezzo singolo non scontato, senza FOX */
.home .price > .woocommerce-Price-amount.amount,
/* Prezzo singolo non scontato, con FOX */
.home .price .woocs_price_code > .woocommerce-Price-amount.amount,
/* Prezzo dentro Starting at */
.home .fl-starting-at-label .woocommerce-Price-amount.amount {
    background-color: #7f1d85;
    color: #ffffff !important;
    padding: 8px 24px;
    border-radius: 40px;
    font-weight: 700;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
}

.home .price ins .woocommerce-Price-amount.amount .woocommerce-Price-currencySymbol,
.home .price > .woocommerce-Price-amount.amount .woocommerce-Price-currencySymbol,
.home .price .woocs_price_code > .woocommerce-Price-amount.amount .woocommerce-Price-currencySymbol,
.home .fl-starting-at-label .woocommerce-Price-amount.amount .woocommerce-Price-currencySymbol {
    margin-left: 2px;
}

/* niente sottolineatura sull’ins */
.home .price ins {
    text-decoration: none !important;
}

/* ---------- PREZZO PIENO BARRATO (come screenshot) ---------- */

.home .et_pb_shop_0.et_pb_shop .woocommerce ul.products li.product .price del span.amount,
.home .price del .woocommerce-Price-amount.amount {
    background-color: transparent !important;
    color: #7c7c7c !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-decoration: line-through !important;
    border-radius: 16px !important;
    padding: 5px 15px !important;
    /* SOLO margini orizzontali: niente contributo all’altezza totale */
    margin: 0 -15px 0 20px !important;
    display: inline-flex !important;
    align-items: center;
}

/* ---------- STARTING AT (prefisso vicino al prezzo) ---------- */

.home .fl-starting-at-label {
    font-weight: 500;
    font-size: 16px;
    color: #711e7e;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    line-height: 1.1;
    padding: 0;
}

/* Screen-reader text di FOX fuori dal layout */
.home .price .woocs_price_code .screen-reader-text {
    display: none;
}

