/* === LAYOUT GENERALE === */
.gtc-form-wrapper,
.gtc-catalog-filter,
.price-histogram,
.price-slider {
    width: 100%;
    box-sizing: border-box;
    /* fondamentale! */
}

.catalog-layout-container {
    padding: 2rem;
}

.catalog-layout-wrapper {
    display: grid;
    grid-template-columns: 30% 1fr;
    gap: 2rem;
    padding: 2rem;
    background: #f0f2f5;
    border-radius: 1rem;
    box-shadow: inset -4px -4px 8px #ffffff, inset 4px 4px 8px #aeaec0;
    align-items: start;
    /* importante! */
}

.gtc-form-wrapper {
    display: flex;
    flex-direction: column;
}

.gtc-catalog-cards {
    grid-column: 2 / 3;
}

.gtc-grid-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* === PAGINATION NEUMORPHIC === */
.woocommerce-pagination {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
}

.woocommerce-pagination>ul {
    padding: 0;
    margin: 0;
}

.woocommerce-pagination .prev-icon::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background: url('data:image/svg+xml; utf8,<svg fill="%23083358" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>') no-repeat center;
    background-size: contain;
}

.woocommerce-pagination .next-icon::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background: url('data:image/svg+xml; utf8,<svg fill="%23083358" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"/></svg>') no-repeat center;
    background-size: contain;
}

.woocommerce-pagination .prev-icon,
.woocommerce-pagination .next-icon {
    background: #f0f2f5;
    padding: 0.5rem 0.8rem;
    border-radius: 50px;
    box-shadow: -4px -4px 8px #ffffff, 4px 4px 8px #aeaec0;
    transition: all 0.2s ease;
}

.woocommerce-pagination span.current,
.woocommerce-pagination span:hover,
.woocommerce-pagination a:hover,
.woocommerce-pagination .prev-icon:hover,
.woocommerce-pagination .next-icon:hover {
    transform: scale(0.98) translateY(0);
    box-shadow: inset -4px -4px 8px #ffffff, inset 4px 4px 8px #aeaec0;
}

.woocommerce-pagination li {
    display: inline-flex;
}

.woocommerce-pagination a,
.woocommerce-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
    color: var(--template-fourthcolor);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}


/* === SIDEBAR === */
.gtc-catalog-filter {
    overflow-x: hidden;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: -4px -4px 8px #ffffff, 4px 4px 8px #aeaec0;
    transition: all 0.3s ease;
}

/* === SEZIONI FILTRI === */
.filter-section {
    /*margin-bottom: 2.5rem; */
}

.filter-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    padding: 0.5rem;
    background: #f0f2f5;
    border-radius: 2rem;
    box-shadow: -4px -4px 8px #ffffff,
        4px 4px 8px #aeaec0;
    transition: all 0.2s ease;
}

.filter-icon svg {
    width: 40px;
    height: 100%;
}

.filter-icon {
    padding-right: 1rem;
    position: absolute;
    left: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-title {
    text-align: center;
    color: var(--template-fourthcolor);
    flex: 1;
}

.filter-toggle:hover {
    transform: scale(0.98) translateY(0);
    box-shadow: inset -4px -4px 8px #ffffff, inset 4px 4px 8px #aeaec0;
}

.filter-panel {
    overflow: hidden;
    margin: 1rem 0;
    max-height: 0;
    transition: max-height 0.4s ease;
}

.filter-toggle.active+.filter-panel {
    max-height: 999px;
    /* fallback grande, solo per partenza */
}

/* === LISTA CATEGORIE === */
.gtc-category-list {
    padding: 1rem 0 !important;
    list-style: none;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
    /*scrollbar-width: thin;*/
    /*scrollbar-color: #d1d9e6 #f0f2f5; frecette */
}

.gtc-category-list::-webkit-scrollbar {
    width: 6px;
}

.gtc-category-list::-webkit-scrollbar-track {
    background: transparent;

}

.gtc-category-list::-webkit-scrollbar-thumb {
    border-radius: 2rem;
    box-shadow: inset -4px -4px 8px #d1d9e6,
        inset 4px 4px 8px #d1d9e6;
}




.gtc-category-item {
    display: flex;
    flex-wrap: nowrap;
    padding: 0 0.5rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.gtc-category-item label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1 1 auto;
    padding: 0.5rem 0.5rem;
    border-radius: 50px;
    background: #f0f2f5;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 0;
}

.gtc-category-item:hover label,
.gtc-category-item input[type="radio"]:checked+label {
    box-shadow: inset -4px -4px 8px #ffffff, inset 4px 4px 8px #aeaec0;
}

.gtc-category-item input[type="radio"] {
    display: none;
}

.gtc-category-item .label {
    display: inline-block;
    overflow: hidden;
    margin-left: 1rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 500;
    color: var(--template-fourthcolor);
    max-width: 100%;
}

.gtc-category-item input[type="radio"]:checked+label .label {
    font-weight: 600;
    color: var(--template-maincolor);
}

.gtc-cat-count {
    display: inline-flex;
    margin-left: 1rem;
    border-radius: 1rem;
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
    width: 10%;

    transition: all 0.2s ease;
    justify-content: center;
    align-items: center;
}

.gtc-category-item:hover .gtc-cat-count,
.gtc-category-item input[type="radio"]:checked+label .gtc-cat-count {
    box-shadow: inset -4px -4px 8px #ffffff,
        inset 4px 4px 8px #aeaec0;
}

/* === HISTOGRAM === */
.price-histogram {
    display: flex;
    align-items: flex-end;
    height: 60px;
    margin: 1rem 0;
    transition: all 0.1s ease;
    gap: 0.3rem;
}

.price-histogram .bar.active {
    background: var(--template-maincolor);
}

.price-histogram .bar {
    position: relative;
    flex: 1;
    background: var(--template-fourthcolor);
    border-radius: 8px;
    opacity: 0.8;
    box-shadow: -4px -4px 8px #ffffff,
        4px 4px 8px #aeaec0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.price-histogram .bar:hover {
    box-shadow: inset -4px -4px 6px #ffffff,
        inset 4px 4px 6px #aeaec0;
    opacity: 1;
    filter: brightness(1.2);
}

.price-histogram .bar::before {
    content: '';
    position: absolute;
    top: -8px;
    bottom: -8px;
    left: 0;
    right: 0;
}

.price-histogram .bar.drag-select {
    outline: 2px solid var(--template-maincolor);
}

/* === SLIDER === */
.price-slider {
    position: relative;
    height: 50px;
    margin: 1rem 0;
}

.slider-track {
    position: absolute;
    height: 8px;
    border-radius: 1rem;
    top: 50%;
    box-shadow: inset -4px -4px 8px #ffffff, inset 4px 8px #aeaec0;
    transform: translateY(-50%);
    left: 0;
    right: 0;
}

.slider-track::before {
    content: '';
    position: absolute;
    height: 100%;
    background: var(--template-maincolor);
    border-radius: 4px;
    left: var(--min, 20%);
    right: calc(100% - var(--max, 80%));
}

.price-slider input[type="range"] {
    position: absolute;
    width: 100%;
    height: 0;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    background: none;
}


.price-slider input[type="range"] {
    -webkit-appearance: none;
    /* Rimuove stile default */
    appearance: none;
    background: transparent;
    pointer-events: all;
    /* Mantiene interattività */
}

/* Thumb - Brave/Chrome/Safari */
.price-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    /* Importantissimo per Brave */
    appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 2rem;
    background-color: rgb(174, 174, 192);

    /* Colore custom */
    border-radius: 50%;
    cursor: pointer;
    border: none;
}



.price-values {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    align-content: center;
    align-items: center;
    flex-direction: row;
}

.price-values input {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    border: none;
    width: 30%;
    outline: none;
    border-radius: 1rem;
    padding: 0.3rem 0.8rem;
    font-size: 1rem;
    font-weight: 600;
    background: #f0f2f5;
    box-shadow: inset -4px -4px 8px #ffffff, inset 4px 4px 8px #aeaec0;
    color: var(--template-tirdcolor);
}

.price-values input::-webkit-outer-spin-button,
.price-values input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.price-values input:focus {
    outline: none;
}

.price-values input[type="number"] {
    -moz-appearance: textfield;
}

/* === BOTTONE FILTRA – NEUMORPHIC === */
#reset-filters {
    margin-top: 1rem;
    display: block;
    width: 100%;
    padding: 0.5rem;
    border: none;
    border-radius: 50px;
    background: #f0f2f5;
    font-weight: 600;
    cursor: pointer;
    box-shadow: -4px -4px 8px #ffffff,
        4px 4px 8px #aeaec0;
    transition: all 0.2s ease;
    color: var(--template-fourthcolor);
}

#reset-filters:hover,
#reset-filters:active {
    transform: scale(0.98) translateY(0);
    box-shadow: inset -4px -4px 6px #ffffff,
        inset 4px 4px 6px #aeaec0;
    color: var(--template-maincolor);
}

/* === GRIGLIA CATALOG === */
.gtc-product-catalog {
    height: 100%;
    display: grid;
    padding: 0;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 0;
    box-shadow: none;
    list-style: none;
}

@media (max-width: 1280px) {
    .catalog-layout-wrapper {
        grid-template-columns: 1fr;
        /* stack colonna */
        grid-template-rows: auto auto auto;
        /* sidebar, griglia, pagination */
        width: 100% !important;
    }

    .gtc-form-wrapper {
        order: 1;
        width: 100%;
        margin-bottom: 2rem;
    }

    .gtc-catalog-filter {
        width: 100%;
    }

    .gtc-grid-wrapper {
        order: 2;
        width: 100%;
    }

    .woocommerce-pagination {
        order: 3;
        width: 100%;
    }
}

@media (max-width: 768px) {

    .gtc-catalog-filter,
    .catalog-layout-container {
        padding: 1rem;
    }

    .gtc-category-item label {
        padding-left: 0;
    }

    .filter-panel {
        max-height: none !important;
        overflow: visible;
    }

    .filter-toggle {
        pointer-events: none;
        /* disabilita toggle se non serve */
    }

    .catalog-layout-wrapper {
        display: flex;
        flex-direction: column;

    }
}

@media (max-width: 568px) {

    .gtc-product-template,
    .catalog-layout-wrapper {
        box-shadow: none !important;
        padding: 0 !important;
    }

    .price-values {
        flex-direction: column;
    }

    .price-values input {
        width: 100%;
    }

    .price-histogram {
        margin: 2rem 0;
    }
}