/* ============================================================================
   CATALOGO /nossosprodutos — layout boutique (par de /js/catalog-ui.js)
   Tudo escopado em body.has-cx: sem o JS, a pagina antiga continua intacta.
   ========================================================================== */
body.has-cx {
    --cx-white: #FFFFFF;
    --cx-off: #FAF6F4;
    --cx-lilac: #EADCE7;
    --cx-rose: #B895AE;
    --cx-plum: #846780;
    --cx-plum-deep: #6F5370;
    --cx-ink: #302935;
    --cx-muted: #78717C;
    --cx-line: rgba(132,103,128,0.16);
    --cx-radius: 16px;
}

/* Interface antiga substituida (continua no DOM para a logica existente) */
body.has-cx .page-header,
body.has-cx #productsCatalogHeader,
body.has-cx #catalogGridFilters,
body.has-cx #mobilePriceSection,
body.has-cx #loading,
body.has-cx #filterOverlay,
body.has-cx #filterDrawer,
body.has-cx #filterDrawerBackdrop,
body.has-cx .products-catalog-grid { display: none !important; }
body.has-cx #productsGrid { display: grid !important; }

.cx-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

body.has-cx .products-page { padding-top: 0 !important; }
body.has-cx .products-container { max-width: 1440px !important; padding: 0 clamp(16px, 3vw, 40px) !important; box-sizing: border-box; }
.cx { font-family: var(--mt-sans, 'Montserrat', sans-serif); color: var(--cx-ink); padding: clamp(1.25rem, 3vw, 2.25rem) 0 clamp(2rem, 5vw, 4rem); }

/* ---------------------------------------------------------- cabecalho -- */
.cx-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.cx-crumbs { display: flex; gap: .45rem; align-items: center; font-size: .72rem; color: var(--cx-muted); margin-bottom: .4rem; }
.cx-crumbs a { color: var(--cx-muted); text-decoration: none; }
.cx-crumbs a:hover { color: var(--cx-plum); text-decoration: underline; }
.cx-crumbs [aria-current] { color: var(--cx-ink); font-weight: 600; }
.cx-title { margin: 0; font-family: var(--mt-serif, 'Cormorant Garamond', serif); font-weight: 500; font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.02; color: var(--cx-ink); }
.cx-title-short { display: none; }
.cx-count { margin: 0 0 .35rem; font-size: .8rem; color: var(--cx-muted); white-space: nowrap; }
.cx-count strong { color: var(--cx-ink); font-weight: 600; }

/* ------------------------------------------------------------ toolbar -- */
.cx-toolbar { display: flex; gap: .75rem; align-items: center; margin-bottom: 1.5rem; }
.cx-search { position: relative; flex: 1; min-width: 0; }
.cx-search > svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--cx-rose); pointer-events: none; }
.cx-search input {
    width: 100%; height: 50px; box-sizing: border-box; padding: 0 44px 0 46px;
    border: 1px solid var(--cx-lilac); border-radius: 14px; background: var(--cx-white);
    font: 500 .9rem var(--mt-sans, sans-serif); color: var(--cx-ink);
    box-shadow: 0 8px 24px -22px rgba(48,41,53,.5);
    transition: border-color .25s ease, box-shadow .25s ease;
}
.cx-search input::placeholder { color: #A89CA6; font-weight: 400; }
.cx-search input::-webkit-search-cancel-button { display: none; }
.cx-search input:focus { outline: none; border-color: var(--cx-plum); box-shadow: 0 0 0 4px rgba(132,103,128,.12); }
.cx-search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--cx-off); color: var(--cx-plum-deep); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.cx-sort { position: relative; display: flex; align-items: center; flex-shrink: 0; }
.cx-sort-label { position: absolute; left: 16px; top: 7px; font-size: .56rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--cx-rose); pointer-events: none; }
.cx-sort select {
    height: 50px; min-width: 200px; padding: 14px 40px 0 16px; box-sizing: border-box;
    border: 1px solid var(--cx-lilac); border-radius: 14px; background: var(--cx-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23846780' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 16px center;
    -webkit-appearance: none; appearance: none; cursor: pointer;
    font: 600 .82rem var(--mt-sans, sans-serif); color: var(--cx-ink);
}
.cx-sort select:focus { outline: none; border-color: var(--cx-plum); box-shadow: 0 0 0 4px rgba(132,103,128,.12); }
.cx-filter-btn { display: none; align-items: center; justify-content: center; gap: .5rem; height: 50px; padding: 0 1.1rem; border-radius: 14px; border: 1px solid var(--cx-lilac); background: var(--cx-white); color: var(--cx-plum-deep); font: 600 .82rem var(--mt-sans, sans-serif); cursor: pointer; flex-shrink: 0; }
.cx-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--cx-plum); color: #fff; font-size: .66rem; box-sizing: border-box; }
.cx-badge[hidden] { display: none; }

/* Chips rapidos (so celular/tablet) */
.cx-quick { display: none; }
.cx-chip {
    flex: 0 0 auto; height: 38px; padding: 0 1rem; border-radius: 999px; border: 1px solid var(--cx-lilac);
    background: var(--cx-white); color: var(--cx-plum-deep); font: 600 .74rem var(--mt-sans, sans-serif); cursor: pointer; white-space: nowrap;
}
.cx-chip.is-on { background: var(--cx-plum); border-color: var(--cx-plum); color: #fff; }

/* -------------------------------------------------------------- layout -- */
.cx-layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 28px; align-items: start; }
.cx-side {
    position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; overscroll-behavior: contain;
    background: var(--cx-white); border: 1px solid var(--cx-line); border-radius: 18px; padding: 1.15rem 1.15rem .5rem;
    box-shadow: 0 18px 40px -36px rgba(48,41,53,.5);
}
.cx-side:empty { display: none; }
.cx-panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-bottom: .9rem; border-bottom: 1px solid var(--cx-line); }
.cx-panel-head h2 { margin: 0; font-family: var(--mt-serif, serif); font-weight: 500; font-size: 1.45rem; color: var(--cx-ink); }
.cx-link { border: 0; background: none; padding: 6px 0; cursor: pointer; font: 600 .7rem var(--mt-sans, sans-serif); letter-spacing: .06em; color: var(--cx-plum); text-decoration: underline; text-underline-offset: 3px; }
.cx-link:hover { color: var(--cx-plum-deep); }

.cx-acc { border-bottom: 1px solid var(--cx-line); }
.cx-acc:last-child { border-bottom: 0; }
.cx-acc > summary {
    list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 48px; cursor: pointer;
    font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--cx-ink);
}
.cx-acc > summary::-webkit-details-marker { display: none; }
.cx-acc > summary::after { content: ''; width: 8px; height: 8px; border-right: 1.6px solid var(--cx-plum); border-bottom: 1.6px solid var(--cx-plum); transform: rotate(45deg) translateY(-2px); transition: transform .25s ease; }
.cx-acc[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.cx-acc-body { padding: .1rem 0 1rem; }

/* Faixa de preco (slider duplo + campos) */
.cx-range { position: relative; height: 28px; margin: .35rem 4px .6rem; }
.cx-range-track { position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 4px; background: var(--cx-lilac); }
.cx-range-fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--cx-plum); }
.cx-range input[type=range] { position: absolute; left: -4px; right: -4px; width: calc(100% + 8px); top: 0; height: 28px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.cx-range input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--cx-plum); box-shadow: 0 4px 10px -4px rgba(48,41,53,.5); cursor: grab; }
.cx-range input[type=range]::-moz-range-thumb { pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--cx-plum); cursor: grab; }
.cx-range input[type=range]::-webkit-slider-runnable-track { background: none; height: 28px; }
.cx-range input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(132,103,128,.25); }
.cx-range-inputs { display: flex; align-items: flex-end; gap: .5rem; }
.cx-range-inputs label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: .64rem; color: var(--cx-muted); }
.cx-money { display: flex; align-items: center; height: 42px; border: 1px solid var(--cx-lilac); border-radius: 10px; background: var(--cx-off); padding: 0 8px; }
.cx-money em { font-style: normal; font-size: .72rem; color: var(--cx-muted); margin-right: 4px; }
.cx-money input { width: 100%; min-width: 0; border: 0; background: transparent; font: 600 .84rem var(--mt-sans, sans-serif); color: var(--cx-ink); -moz-appearance: textfield; }
.cx-money input::-webkit-outer-spin-button, .cx-money input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cx-money:focus-within { border-color: var(--cx-plum); background: #fff; }
.cx-money input:focus { outline: none; }
.cx-range-sep { padding-bottom: 12px; color: var(--cx-rose); }

/* Tamanho da toalha (radio em chips) */
.cx-sizes { display: flex; flex-wrap: wrap; gap: .4rem; }
.cx-size { position: relative; cursor: pointer; }
.cx-size input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cx-size span { display: inline-flex; align-items: center; height: 36px; padding: 0 .9rem; border-radius: 999px; border: 1px solid var(--cx-lilac); background: #fff; font: 600 .72rem var(--mt-sans, sans-serif); color: var(--cx-plum-deep); transition: background .2s ease; }
.cx-size.is-on span, .cx-size input:checked + span { background: var(--cx-plum); border-color: var(--cx-plum); color: #fff; }
.cx-size input:focus-visible + span { box-shadow: 0 0 0 3px rgba(132,103,128,.3); }

/* Checkboxes da marca */
.cx-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cx-checks--sub { padding-left: 1.6rem; }
.cx-check { display: flex; align-items: center; gap: .65rem; min-height: 40px; cursor: pointer; font-size: .8rem; color: var(--cx-ink); border-radius: 10px; padding: 0 .35rem; }
.cx-check:hover { background: var(--cx-off); }
.cx-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cx-box { flex: 0 0 18px; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--cx-rose); background: #fff; display: grid; place-items: center; transition: background .2s ease, border-color .2s ease; }
.cx-check input:checked + .cx-box { background: var(--cx-plum); border-color: var(--cx-plum); }
.cx-check input:checked + .cx-box::after { content: ''; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.cx-check input:focus-visible + .cx-box { box-shadow: 0 0 0 3px rgba(132,103,128,.3); }
.cx-check input:checked ~ .cx-check-name { font-weight: 600; }
.cx-check-name { flex: 1; min-width: 0; line-height: 1.3; }
.cx-check.is-empty { opacity: .45; cursor: not-allowed; }
.cx-check.is-empty:hover { background: none; }
.cx-check-count { font-size: .68rem; color: var(--cx-muted); background: var(--cx-off); border-radius: 999px; padding: 2px 8px; }

/* ---------------------------------------------------- filtros aplicados -- */
.cx-applied { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.cx-applied[hidden] { display: none; }
.cx-tag {
    display: inline-flex; align-items: center; gap: .45rem; height: 34px; padding: 0 .85rem; border-radius: 999px;
    border: 1px solid var(--cx-lilac); background: var(--cx-off); color: var(--cx-plum-deep);
    font: 600 .72rem var(--mt-sans, sans-serif); cursor: pointer; transition: background .2s ease, border-color .2s ease;
}
.cx-tag:hover { background: #fff; border-color: var(--cx-plum); }
.cx-tag span[aria-hidden] { font-size: 1rem; line-height: 1; }

/* --------------------------------------------------------------- grade -- */
body.has-cx .cx .products-grid-host,
body.has-cx .cx .products-grid-mobile-carousel-wrapper { width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; }
body.has-cx .cx #productsGrid.products-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 18px !important;
    width: 100% !important; margin: 0 !important; padding: 0 !important; transform: none !important;
    overflow: visible !important; flex-wrap: initial !important;
    transition: opacity .2s ease;
}
body.has-cx .cx #productsGrid.is-refreshing { opacity: .45; pointer-events: none; }
body.has-cx .cx #productsGrid > .product-card { width: auto !important; min-width: 0 !important; max-width: none !important; flex: initial !important; margin: 0 !important; }
body.has-cx .cx .product-card .product-name { -webkit-line-clamp: 3 !important; min-height: 3.9em !important; }

/* Skeleton */
.cx-skel { display: flex; flex-direction: column; gap: 10px; padding: 8px 8px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--cx-line); }
.cx-skel span { display: block; border-radius: 8px; background: linear-gradient(90deg, #F3EDF1 0%, #FAF6F4 40%, #F3EDF1 80%); background-size: 200% 100%; animation: cxShimmer 1.4s ease-in-out infinite; }
.cx-skel-img { aspect-ratio: 1; border-radius: 12px !important; }
.cx-skel-line { height: 12px; margin: 0 6px; }
.cx-skel-line--short { width: 60%; }
.cx-skel-price { height: 18px; width: 40%; margin: 4px 6px 0; }
.cx-skel-btn { height: 40px; margin: 4px 6px 0; border-radius: 10px !important; }
@keyframes cxShimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Vazio / erro */
.cx-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; text-align: center; padding: clamp(2.5rem, 6vw, 4.5rem) 1.25rem; border-radius: 20px; background: #fff; border: 1px solid var(--cx-line); }
.cx-empty svg { margin-bottom: 1.25rem; }
.cx-empty h2 { margin: 0 0 .5rem; font-family: var(--mt-serif, serif); font-weight: 500; font-size: clamp(1.5rem, 2.6vw, 2rem); color: var(--cx-ink); }
.cx-empty p { margin: 0 0 1.5rem; max-width: 42ch; font-size: .86rem; line-height: 1.65; color: var(--cx-muted); }
.cx-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.cx-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 1.5rem; border-radius: 12px; cursor: pointer; font: 600 .72rem var(--mt-sans, sans-serif); letter-spacing: .14em; text-transform: uppercase; transition: background .25s ease; }
.cx-btn--primary { border: 0; background: var(--cx-plum); color: #fff; box-shadow: 0 14px 26px -18px rgba(132,103,128,.95); }
.cx-btn--primary:hover { background: var(--cx-plum-deep); }
.cx-btn--ghost { border: 1px solid var(--cx-lilac); background: #fff; color: var(--cx-plum-deep); }

/* Paginacao */
body.has-cx .cx #pagination { margin: 2rem 0 0 !important; padding: 0 !important; display: block !important; }
.cx-pager { display: flex; justify-content: center; align-items: center; gap: .4rem; flex-wrap: wrap; }
.cx-page { min-width: 44px; height: 44px; padding: 0 .6rem; border-radius: 12px; border: 1px solid var(--cx-lilac); background: #fff; color: var(--cx-ink); font: 600 .8rem var(--mt-sans, sans-serif); cursor: pointer; transition: background .2s ease, border-color .2s ease; }
.cx-page:hover:not(:disabled):not(.is-current) { border-color: var(--cx-plum); color: var(--cx-plum); }
.cx-page.is-current { background: var(--cx-plum); border-color: var(--cx-plum); color: #fff; }
.cx-page:disabled { opacity: .4; cursor: not-allowed; }
.cx-page--nav { padding: 0 1rem; color: var(--cx-plum-deep); }
.cx-page-gap { color: var(--cx-muted); padding: 0 .2rem; }

/* Selos de confianca */
.cx-trust { list-style: none; margin: 2.5rem 0 0; padding: 1.25rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; border-radius: 18px; background: #fff; border: 1px solid var(--cx-line); }
.cx-trust li { display: flex; align-items: center; gap: .75rem; font-size: .74rem; line-height: 1.45; color: var(--cx-muted); }
.cx-trust svg { flex: 0 0 auto; color: var(--cx-plum); }

.cx :focus-visible, .cx-sheet :focus-visible { outline: 2px solid var(--cx-plum); outline-offset: 2px; }

/* ------------------------------------------------------ gaveta (mobile) -- */
.cx-sheet { position: fixed; inset: 0; z-index: 24000; background: rgba(48,41,53,.45); opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s ease; }
.cx-sheet.is-open { opacity: 1; visibility: visible; }
.cx-sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0; max-height: 90dvh; height: 90dvh;
    display: flex; flex-direction: column; background: #fff; border-radius: 22px 22px 0 0;
    transform: translateY(100%); transition: transform .4s cubic-bezier(.16,1,.3,1);
    font-family: var(--mt-sans, sans-serif); color: var(--cx-ink);
}
.cx-sheet.is-open .cx-sheet-panel { transform: none; }
.cx-sheet-grip { width: 44px; height: 4px; border-radius: 4px; background: var(--cx-lilac); margin: 10px auto 0; }
.cx-sheet-head { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem .8rem 1.25rem; border-bottom: 1px solid var(--cx-line); }
.cx-sheet-head h2 { flex: 1; margin: 0; font-family: var(--mt-serif, serif); font-weight: 500; font-size: 1.55rem; }
.cx-sheet-close { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--cx-line); background: var(--cx-off); color: var(--cx-plum-deep); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.cx-sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .25rem 1.25rem 1rem; }
.cx-sheet-foot { padding: .85rem 1.25rem calc(.85rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--cx-line); background: #fff; }
.cx-sheet-foot .cx-btn { width: 100%; min-height: 52px; }
html.cx-lock { overflow: hidden; }

/* ---------------------------------------------------------- responsivo -- */
@media (max-width: 1280px) {
    body.has-cx .cx #productsGrid.products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .cx-trust { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
    .cx-layout { grid-template-columns: minmax(0, 1fr); }
    .cx-side { display: none; }
    .cx-filter-btn { display: inline-flex; }
    .cx-quick {
        display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; margin: -.5rem calc(-1 * clamp(16px, 3vw, 40px)) 1rem;
        padding: 0 clamp(16px, 3vw, 40px); -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y;
    }
    .cx-quick::-webkit-scrollbar { display: none; }
}
@media (max-width: 700px) {
    body.has-cx .products-container { padding: 0 14px !important; }
    .cx { padding-top: 1rem; }
    .cx-head { flex-direction: column; align-items: flex-start; gap: .2rem; margin-bottom: .85rem; }
    .cx-title-full { display: none; }
    .cx-title-short { display: inline; }
    .cx-title { font-size: 2rem; }
    .cx-count { font-size: .7rem; }
    .cx-crumbs { display: none; }
    .cx-toolbar { flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
    .cx-search { flex: 1 1 100%; }
    .cx-search input { height: 46px; font-size: 16px; }
    .cx-filter-btn, .cx-sort { flex: 1 1 0; }
    .cx-filter-btn { height: 46px; }
    .cx-sort select { width: 100%; min-width: 0; height: 46px; padding-right: 30px; font-size: .78rem; background-position: right 12px center; }
    .cx-quick { margin: 0 -14px .9rem; padding: 0 14px; }
    body.has-cx .cx #productsGrid.products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
    body.has-cx .cx .product-card .product-name { -webkit-line-clamp: 2 !important; min-height: 2.6em !important; }
    .product-card-badge { top: 7px; left: 7px; height: 20px; padding: 0 7px; font-size: .5rem; letter-spacing: .08em; }
    .cx-trust { grid-template-columns: 1fr; padding: 1rem; margin-top: 1.75rem; }
    .cx-page--nav span { display: none; }
    .cx-page { min-width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
    .cx-skel span { animation: none; }
    .cx-sheet, .cx-sheet-panel { transition-duration: .01ms; }
}
