/* ============================================================
   ecommerce-theme.css — Tema E-commerce KeideaCMS
   Caricato globalmente SOLO quando il toggle è attivo (per la search
   centrale dell'header) + sulle pagine catalogo (card/griglia).
   Header SCURO (come tema base) → search = pillola bianca, icone bianche.
   ============================================================ */

/* ─── Header: barra di ricerca prodotti centrale (pillola bianca) ─── */
.ke-shop-search {
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
    border-radius: 9999px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.ke-shop-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 11px 20px;
    font-size: 15px;
    background: transparent;
    color: #111827;
}
.ke-shop-search input::placeholder { color: #9ca3af; }
.ke-shop-search button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    border: 0;
    cursor: pointer;
    color: #fff;
    background: var(--color-primary, #dc2626);
}
.ke-shop-search button:hover { filter: brightness(.93); }

/* ─── Suggest istantaneo (overlay sotto la search) ─── */
.ke-shop-search-wrap {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
}
.ke-shop-search-wrap .ke-shop-search { max-width: none; }
.ke-suggest {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 60;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
    overflow: hidden;
    max-height: 70vh;
    overflow-y: auto;
}
.ke-suggest-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .85rem;
    text-decoration: none;
    color: #111827;
    border-bottom: 1px solid #f3f4f6;
}
.ke-suggest-item.is-active,
.ke-suggest-item:hover { background: #f9fafb; }
.ke-suggest-thumb {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f3f4f6;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ke-suggest-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ke-suggest-body { flex: 1 1 auto; min-width: 0; }
.ke-suggest-cat {
    display: block;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #9ca3af;
}
.ke-suggest-nome {
    display: block;
    font-size: .9rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ke-suggest-price {
    flex: 0 0 auto;
    text-align: right;
    white-space: nowrap;
}
.ke-suggest-cur {
    display: block;
    font-weight: 800;
    color: var(--color-primary, #dc2626);
    font-size: .95rem;
}
.ke-suggest-old {
    display: block;
    font-size: .72rem;
    color: #9ca3af;
    text-decoration: line-through;
}
.ke-suggest-empty {
    padding: 1.1rem .85rem;
    text-align: center;
    color: #6b7280;
    font-size: .9rem;
}
.ke-suggest-all {
    display: block;
    width: 100%;
    padding: .7rem .85rem;
    border: 0;
    border-top: 1px solid #eee;
    background: #fafafa;
    color: var(--color-primary, #dc2626);
    font-weight: 700;
    font-size: .85rem;
    cursor: pointer;
    text-align: center;
}
.ke-suggest-all:hover { background: #f3f4f6; }

/* ─── Card prodotto catalogo ─── */
.ke-cat-card { text-decoration: none; }
.ke-cat-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    padding: .25rem .55rem;
    border-radius: 9999px;
    font-size: .7rem;
    font-weight: 700;
    /* Offerta = rosso semantico (coerente con i badge sconto su card/scheda) */
    background: #d32f2f;
    color: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .15);
}
.ke-cat-noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #d1d5db;
}
.ke-cat-nome {
    display: -webkit-box;
    -webkit-line-clamp: 3;         /* fino a 3 righe, poi ellissi */
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4 !important;   /* batte il line-height di .text-base (Tailwind) */
    min-height: 4.5rem;            /* riserva fino a 3 righe SENZA tagliare (min-height, non height) */
    margin-bottom: 0.5rem;
}
/* Etichetta categoria sopra il titolo: gray-400 di Tailwind è purgato (→ bianco
   su bianco), quindi colore scritto a mano. */
.ke-cat-cat {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: #9ca3af;
    margin-bottom: 0.25rem;
}
.ke-cat-prezzo {
    color: var(--color-cta, #b45309);
    font-weight: 800;
    font-size: 1.05rem;
}
/* Box immagine prodotto: altezza fissa, prodotto INTERO centrato (object-contain),
   sfondo bianco. Usato da card categoria e card blocco Prodotti Shop. */
.ke-cat-imgbox {
    height: 190px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}
.ke-cat-imgbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ke-cat-imgbox svg { color: #d1d5db; }

/* ─── Intestazione pagina categoria ─── */
.ke-cat-head {
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

/* ─── Stato vuoto + paginazione ─── */
.ke-cat-empty {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
}
.ke-cat-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 2rem;
    font-size: .9rem;
    color: #6b7280;
}
.ke-cat-pager a {
    color: var(--color-primary, #dc2626);
    font-weight: 600;
    text-decoration: none;
}
.ke-cat-pager a:hover { text-decoration: underline; }

/* ─── Navigazione a strati: layout categoria (sidebar filtri + griglia) ─── */
.ke-cat-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1.75rem;
    align-items: start;
}
.ke-cat-main { min-width: 0; }

@media (max-width: 860px) {
    .ke-cat-layout { grid-template-columns: 1fr; }
}

.ke-cat-filters {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.1rem 1.15rem;
    position: sticky;
    top: 90px;
}
@media (max-width: 860px) {
    .ke-cat-filters { position: static; }
}

.ke-filter-group { margin-bottom: 1.1rem; }
.ke-filter-title {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #374151;
    margin-bottom: .5rem;
}
.ke-filter-select {
    width: 100%;
    padding: .5rem .6rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: .9rem;
    background: #fff;
    color: #111827;
}
.ke-price-range {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.ke-price-range input {
    width: 100%;
    min-width: 0;
    padding: .5rem .55rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: .9rem;
    color: #111827;
}
.ke-price-sep { color: #9ca3af; flex: 0 0 auto; }

.ke-filter-apply {
    width: 100%;
    margin-top: .25rem;
    padding: .6rem 1rem;
    border: 0;
    border-radius: 9999px;
    background: var(--color-primary, #dc2626);
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    cursor: pointer;
}
.ke-filter-apply:hover { filter: brightness(.93); }
/* Con JS attivo i filtri si applicano da soli → il bottone "Applica" non serve. */
.ke-cat-js .ke-filter-apply { display: none; }

/* ─── Slider prezzo dual-range (solo con JS) ───
   NB: contenitore '.ke-priceslider' (NON '.ke-slider': quel nome è già usato
   dal toggle switch del cookie banner → collisione che metteva lo sfondo grigio). */
.ke-priceslider { display: none; }
.ke-cat-js .ke-priceslider { display: block; position: relative; height: 64px; margin: .25rem 4px 0; }
.ke-cat-js [data-ke-price-inputs] { display: none; }   /* con slider gli input numerici si nascondono */

.ke-slider-track {
    position: absolute;
    top: 30px; left: 9px; right: 9px;
    height: 5px;
    background: #e5e7eb;
    border-radius: 9999px;
}
.ke-slider-fill {
    position: absolute;
    top: 0; bottom: 0;
    background: var(--color-primary, #dc2626);
    border-radius: 9999px;
}
.ke-slider-h,
.ke-slider-h:focus,
.ke-slider-h:focus-visible {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 24px; left: 0;
    width: 100%;
    height: 18px;
    margin: 0;
    /* Niente sfondo/ombra/bordo/outline nativi: il binario lo disegnano i nostri div. */
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
    pointer-events: none;
}
.ke-slider-h::-webkit-slider-runnable-track { background: transparent !important; border: none; box-shadow: none; }
.ke-slider-h::-moz-range-track { background: transparent !important; border: none; box-shadow: none; }
.ke-slider-h:focus::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(0, 0, 0, .08), 0 1px 4px rgba(0, 0, 0, .28); }
.ke-slider-h::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: auto;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--color-primary, #dc2626);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .28);
    cursor: grab;
}
.ke-slider-h::-webkit-slider-thumb:active { cursor: grabbing; }
.ke-slider-h::-moz-range-thumb {
    pointer-events: auto;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--color-primary, #dc2626);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .28);
    cursor: grab;
}

/* Label-tooltip che seguono le maniglie: min sopra, max sotto; tilt sul drag. */
.ke-slider-tip {
    position: absolute;
    transform: translateX(-50%);
    background: var(--color-primary, #dc2626);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    transition: transform .12s ease;
}
.ke-slider-tip::after {
    content: '';
    position: absolute;
    left: 50%;
    margin-left: -5px;
    border: 5px solid transparent;
}
.ke-slider-tip-min { top: 0; }
.ke-slider-tip-min::after { top: 100%; border-top-color: var(--color-primary, #dc2626); }
.ke-slider-tip-max { bottom: 0; }
.ke-slider-tip-max::after { bottom: 100%; border-bottom-color: var(--color-primary, #dc2626); }
.ke-slider-tip-min.is-active { transform: translateX(-50%) translateY(-3px) rotate(-8deg); }
.ke-slider-tip-max.is-active { transform: translateX(-50%) translateY(3px)  rotate(-8deg); }

/* ─── Stato di caricamento durante l'AJAX ─── */
.ke-loading {
    opacity: .45;
    pointer-events: none;
    transition: opacity .15s ease;
}
.ke-filter-reset {
    display: block;
    text-align: center;
    margin-top: .6rem;
    font-size: .82rem;
    color: #6b7280;
    text-decoration: none;
}
.ke-filter-reset:hover { text-decoration: underline; }

/* ─── Facet attributi (checkbox list) ─── */
.ke-facet-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}
.ke-facet-opt {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem 0;
    font-size: .88rem;
    color: #374151;
    cursor: pointer;
}
.ke-facet-opt input { flex: 0 0 auto; accent-color: var(--color-primary, #dc2626); }
.ke-facet-swatch {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, .15);
}
.ke-facet-nome {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ke-facet-count {
    flex: 0 0 auto;
    font-size: .75rem;
    color: #9ca3af;
}

/* ════════════════════════════════════════════════════════════
   VETRINA "DECISION HUB" — fino a 4 porte prodotto sopra la griglia
   ════════════════════════════════════════════════════════════ */
.ke-vetrina { margin: 0 0 1.75rem; }
.ke-vetrina-head { text-align: center; margin-bottom: 1rem; }
.ke-vetrina-title { font-size: 1.5rem; font-weight: 800; color: #111827; margin: 0; }
.ke-vetrina-sub { color: #6b7280; margin: .25rem 0 0; }
.ke-vetrina-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
@media (max-width: 1024px) { .ke-vetrina-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .ke-vetrina-grid { grid-template-columns: 1fr; } }
.ke-vetrina-card {
    display: flex; flex-direction: column;
    background: #fff; border: 1px solid #e5e7eb; border-radius: .75rem;
    overflow: hidden; text-decoration: none; color: inherit; position: relative;
    transition: box-shadow .2s, transform .2s;
}
.ke-vetrina-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.1); transform: translateY(-2px); }
.ke-vetrina-etichetta {
    position: absolute; top: .6rem; left: .6rem; z-index: 2;
    background: var(--color-cta, #d97706); color: #fff;
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    padding: .2rem .55rem; border-radius: 999px;
}
.ke-vetrina-imgbox {
    height: 150px; display: flex; align-items: center; justify-content: center;
    background: #f9fafb; padding: .75rem;
}
.ke-vetrina-imgbox img { max-height: 100%; max-width: 100%; object-fit: contain; }
.ke-vetrina-body { padding: .85rem; display: flex; flex-direction: column; flex: 1; }
.ke-vetrina-desc { font-size: .78rem; color: #6b7280; margin: 0 0 .35rem; }
.ke-vetrina-nome {
    font-size: .95rem; font-weight: 700; color: #111827; line-height: 1.3; margin: 0 0 .35rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ke-vetrina-prezzo { margin: .25rem 0 .5rem; display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
.ke-vetrina-prezzo-now { font-size: 1.1rem; font-weight: 800; color: var(--color-cta, #b45309); }
.ke-vetrina-prezzo-old { font-size: .85rem; color: #9ca3af; text-decoration: line-through; }
.ke-vetrina-cta { margin-top: auto; font-size: .85rem; font-weight: 700; color: var(--color-link, #2563eb); }
