.filter-toggle-btn {
  position: fixed;
  left: 16px;
  bottom: 70px;
  z-index: 9999;
  background-color: #007bff;
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: 24px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  display: none; /* nascosto su desktop */
}

body.page-template-page-custom-shop .filter-toggle-btn {
  display: inline-block;
}

body:not(.page-template-page-custom-shop) .filter-toggle-btn {
  display: none !important;
}

/* Mostra solo su mobile */
@media (max-width: 767px) {
  .filter-toggle-btn {
    display: inline-block;
  }
}

/* Effetto tap */
.filter-toggle-btn:active {
  transform: scale(0.96);
}


.promo-gift-item .wc-block-cart-item__prices {
    display: none !important;
}
.promo-gift-item .wc-block-cart-item__quantity {
    display: none !important;
}


/* --- BREADCRUMBS STYLE --- */
.ca-custom-breadcrumbs {
    margin-bottom: 25px;
    padding: 10px 0;
}

.ca-breadcrumb-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap; /* Utile su mobile */
    font-size: 14px;
}

.ca-breadcrumb-item {
    display: flex;
    align-items: center;
    white-space: nowrap; /* Evita che si spezzi */
}

.ca-breadcrumb-item a {
    color: #666; /* Colore link non attivo */
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

.ca-breadcrumb-item a:hover {
    color: #000; /* Nero per l'hover */
}

.ca-breadcrumb-item span {
    color: #333; /* Colore testo attivo/non linkato */
}

.ca-breadcrumb-item.current-item span {
    font-weight: 700; /* Grassetto per l'elemento corrente */
}

.ca-breadcrumb-separator {
    margin: 0 8px; /* Spazio intorno al separatore */
    color: #999;
}



/* ======================================= */
/* 1. Wrapper Generale (Posizionamento) */
/* ======================================= */
.woocommerce-pagination.woocommerce-ajax-pagination {
    /* Il contenitore deve essere flex per allineare i link */
    display: flex;
    flex-wrap: wrap; /* Assicura che vada a capo su schermi piccoli */
    justify-content: center; 
    align-items: center;
    clear: both;
    padding: 30px 0 20px 0;
    margin-top: 20px;
    border-top: 1px solid #f0f0f0;
    gap: 8px; /* Applica lo spazio direttamente tra gli elementi figlio */
}

/* ======================================= */
/* 2. Stile di Base dei Pulsanti/Numeri */
/* ======================================= */
/* Applica lo stile direttamente a A e SPAN (che sono i tag generati) */
.woocommerce-pagination.woocommerce-ajax-pagination a,
.woocommerce-pagination.woocommerce-ajax-pagination span {
    /* Regole di base del blocco */
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 40px; 
    height: 40px;
    
    /* Design minimalista */
    border: 1px solid #ccc;
    text-decoration: none;
    color: #333;
    background-color: #fff;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    line-height: 1; /* Rimuovi lo spazio extra */
    font-size: 15px;
    padding: 0; /* Rimuovi padding in eccesso */
}

/* ======================================= */
/* 3. Stato Attivo (Pagina Corrente) */
/* ======================================= */
.woocommerce-pagination.woocommerce-ajax-pagination .current {
    border-color: #000;
    background-color: #000;
    color: #fff;
    font-weight: 600;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* ======================================= */
/* 4. Stato Hover, Frecce e Punti Sospensivi */
/* ======================================= */
.woocommerce-pagination.woocommerce-ajax-pagination a:hover {
    border-color: #000;
    color: #000;
    /*background-color: #f7f7f7;
    transform: translateY(-1px);*/
}

/* Punti Sospensivi */
.woocommerce-pagination.woocommerce-ajax-pagination .dots {
    border: none;
    background: none;
    box-shadow: none;
    color: #999;
    font-weight: bold;
}

/* Stile specifico per frecce (se vuoi un look diverso) */
.woocommerce-pagination.woocommerce-ajax-pagination .prev,
.woocommerce-pagination.woocommerce-ajax-pagination .next {
    font-size: 18px; /* Rendi le frecce un po' più grandi */
    font-weight: bold;
    color: #333;
}


/* ==========================================================================
   1. Stili Base e Desktop (Layout Grid)
   ========================================================================== */

.custom-shop-layout {
    margin-top: 5vw;
    display: grid;
    grid-template-columns: 280px 1fr; /* Sidebar 280px, Contenuto il resto */
    gap: 30px;
    padding: 20px 0;
}

.shop-content-area {
    position: relative;
}

.shop-sidebar {
    padding: 0 0 0 15px;
    /*border-right: 1px solid #eee;*/
    height: fit-content;
    position: sticky;
    top: 50px;
}

/* Stile per l'invito iniziale */
.initial-prompt {
    background: #f7f7f7;
    border-left: 5px solid #0073aa;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 4px;
}
.initial-prompt h2 {
    margin-top: 0;
    font-size: 1.5em;
    color: #333;
}

/* Loader AJAX */
.product-content.loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.product-content.loading::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    /*transform: translate(-50%, -50%);*/
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}
@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Stile Widget Filtro (se necessario) */
.ca-filter-widget .pf-item.cat a {
    display: block;
    padding: 5px 0;
    text-decoration: none;
    color: #444;
}
.ca-filter-widget .pf-item.cat.active-filter > a {
    font-weight: bold;
    color: #0073aa;
}
.ca-filter-widget .pf-item.cat ul li {
    padding: 0;
    text-transform: uppercase;
}
.ca-filter-widget .pf-item.cat ul ul li a {
	padding: 0;
    text-transform: uppercase;
}
.ca-filter-widget .pf-item.cat ul {
    /*margin-left: 15px;*/
}
.pf-item.list.cat ul ul {
    /*padding: 0 0 0 0 !important;*/
}

/* ==========================================================================
   2. Responsive e Mobile (max-width: 767px)
   ========================================================================== */

@media (max-width: 767px) {
    
    .custom-shop-layout {
        grid-template-columns: 1fr; /* Stacked */
        gap: 0;
        padding: 0 25px;
    }
    
    .shop-sidebar {
        /* Sidebar in posizione fissa off-screen */
        position: fixed;
        top: 0;
        left: 0;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        z-index: 100;
        background: #fff;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        overflow-y: auto;
        padding: 20px;
    }

    .shop-sidebar.active {
        transform: translateX(0);
    }
    
    /* Overlay quando il filtro è aperto */
    body.filter-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 90;
        display: block;
    }

    /* Bottone per aprire il filtro */
    .filter-toggle-button {
        display: block;
        text-align: center;
        padding: 10px;
        background: #0073aa;
        color: white;
        font-weight: bold;
        border-radius: 4px;
        cursor: pointer;
        margin-bottom: 20px;
        /* Rendi fisso e sempre visibile sopra il contenuto dello shop */
        position: sticky;
        top: 10px;
        z-index: 50; 
    }

    .shop-sidebar.active .filter-toggle-button {
        display: none; /* Nascondi il bottone quando il filtro è aperto */
    }

    .filter-content-wrapper {
        padding-top: 20px;
        /* Aggiungi qui un'icona di chiusura se necessario */
    }
}

/* ==========================================================================
   CARD PRODOTTO CUSTOM (Basato sulla struttura li.custom-product-card)
   ========================================================================== */

/* Layout Generale della Lista Prodotti (4 colonne desktop) */
ul#loop-products.products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Base Card */
.custom-product-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    background: #fff;
}
.custom-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.08);
}

.product-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Immagine */
.product-image-link {
    display: block;
    overflow: hidden;
    position: relative;
    padding-bottom: 100%; /* Rapporto 1:1 */
    /*background: #f8f8f8;*/
}
.product-image-link img {
    position: absolute;
    width: 100%;
    height: 100% !important;
    object-fit: contain;
    transition: transform 0.3s ease;
    align-self: anchor-center;
}
.custom-product-card:hover .product-image-link img {
    transform: scale(1.05);
}

/* Dettagli */
.product-details {
    padding: 15px;
    flex-grow: 1; /* Spinge le azioni in basso */
}
.product-title {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    line-height: 1.3;
}
.product-title a {
    color: #333;
    text-decoration: none;
}
.product-price {
    font-size: 1.2em;
    font-weight: bold;
    color: #0073aa; /* Colore primario */
}
.product-price del {
    font-weight: normal;
    color: #999;
    font-size: 0.8em;
    margin-right: 5px;
}

/* Azioni (Pulsante) */
.product-actions {
    padding: 0 15px 15px 15px;
}
.product-actions .button {
    font-size: 12px;
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
	color: #ffffff !important;
    transition: background-color 0.2s ease;
    cursor: pointer;
}
.product-actions .button:after {
	background-color: #ffffff !important;
}

/* Aggiungi al Carrello */
.ca-add-to-cart {
    background-color: #0073aa;
    color: #ffffff;
    border: none;
}
.ca-add-to-cart:hover {
    background-color: #005a87;
}

/* Non Disponibile */
.product-actions .sold-out {
    background-color: #f1f1f1;
    color: #999;
    cursor: default;
    pointer-events: none; /* Disabilita click */
}


/* ==========================================================================
   RESPONSIVE (Adatta le colonne)
   ========================================================================== */

@media (max-width: 1024px) {
    ul#loop-products.products {
        grid-template-columns: repeat(3, 1fr); /* 3 colonne su tablet grande */
    }
}

@media (max-width: 767px) {
    ul#loop-products.products {
        grid-template-columns: repeat(2, 1fr); /* 2 colonne su mobile */
        gap: 40px;
    }
    .product-details {
        padding: 10px;
    }
    .product-actions {
        padding: 0 10px 10px 10px;
    }
    .product-title {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    ul#loop-products.products {
        grid-template-columns: 1fr; /* 1 colonna su mobile molto stretto */
    }
}


@media only screen and (max-width: 767px) {
    .form.cart:not(.variations_form).sticky .single_add_to_cart_button { 
		line-height: 1rem !important;
    }
}