/*
 * Komeco Category Grid
 * CSS ajustado para reproduzir a referencia enviada:
 * - sidebar com 280px
 * - espacamento de 32px entre filtro e grade
 * - 4 cards por linha no desktop
 * - tipografia e proporcoes do print
 */

.kom-category-wrapper {
    --kom-red: #ed1c24;
    --kom-text: #1f1f1f;
    --kom-muted: #98a0a9;
    --kom-border: #dfe3e7;
    --kom-card: #f5f5f5;
    --kom-filter-width: 280px;
    --kom-filter-sticky-top: 120px;
    --kom-filter-radius: 10px;
    --kom-card-radius: 5px;

    width: 100%;
    color: var(--kom-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.35;
}

.kom-category-wrapper *,
.kom-category-wrapper *::before,
.kom-category-wrapper *::after {
    box-sizing: border-box;
}

.kom-category-layout {
    display: flex;
    align-items: flex-start;
    gap: 32px;
    width: 100%;
}

.kom-category-content {
    flex: 1 1 auto;
    min-width: 0;
}

/* =========================================================
   FILTRO LATERAL
   ========================================================= */

.kom-category-filter {
    position: sticky;
    top: var(--kom-filter-sticky-top);
    align-self: flex-start;
    flex: 0 0 var(--kom-filter-width);
    width: var(--kom-filter-width);
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--kom-border);
    border-radius: var(--kom-filter-radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.025);
}

.kom-category-filter[hidden] {
    display: none !important;
}

/* Cabecalho: Filtro / Limpar tudo */
.kom-category-filter__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 60px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--kom-border);
}

.kom-category-filter__title {
    color: var(--kom-text);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.kom-category-wrapper .kom-category-filter__clear {
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    color: var(--kom-red) !important;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: 0;
    text-align: right;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    text-transform: none;
    cursor: pointer;
}

.kom-category-wrapper .kom-category-filter__clear:hover,
.kom-category-wrapper .kom-category-filter__clear:focus-visible {
    color: var(--kom-red) !important;
    opacity: 0.78;
    outline: none;
}

/* Secoes */
.kom-category-filter__section {
    border-bottom: 1px solid var(--kom-border);
}

.kom-category-filter__section:last-child {
    border-bottom: 0;
}

.kom-category-filter__section[hidden] {
    display: none !important;
}

.kom-category-wrapper .kom-category-filter__section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    margin: 0;
    padding: 16px 20px 13px;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    color: var(--kom-text) !important;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0;
    text-align: left;
    text-transform: none;
    text-shadow: none;
    cursor: pointer;
}

.kom-category-filter__chevron {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    color: #9aa2aa;
    transition: transform 0.2s ease;
}

.kom-category-filter__section-toggle[aria-expanded="false"] .kom-category-filter__chevron {
    transform: rotate(-90deg);
}

.kom-category-filter__section-toggle[aria-expanded="false"] + .kom-category-filter__list,
.kom-category-filter__section-toggle[aria-expanded="false"] + .kom-category-filter__checklist {
    display: none;
}

/* Produtos / subcategorias */
.kom-category-filter__list {
    margin: 0;
    padding: 0 0 7px;
    list-style: none;
}

.kom-category-filter__item {
    margin: 0;
    padding: 0;
    list-style: none;
}

.kom-category-filter__label,
.kom-category-filter__checkbox-label {
    flex: 1 1 auto;
    min-width: 0;
}

.kom-category-filter__count {
    flex: 0 0 auto;
    color: var(--kom-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    transition: color 0.18s ease;
}

.kom-category-wrapper .kom-category-filter__button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 39px;
    margin: 0;
    padding: 9px 20px;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    color: #2e2e2e !important;
    font: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: 0;
    text-align: left;
    text-transform: none;
    text-shadow: none;
    cursor: pointer;
    transition: color 0.18s ease;
}

.kom-category-wrapper .kom-category-filter__button[aria-pressed="true"] {
    color: var(--kom-red) !important;
    font-weight: 600;
}

.kom-category-wrapper .kom-category-filter__button:hover,
.kom-category-wrapper .kom-category-filter__button:focus-visible {
    background: transparent !important;
    color: var(--kom-red) !important;
    outline: none;
}

.kom-category-wrapper .kom-category-filter__button[aria-pressed="true"] .kom-category-filter__count,
.kom-category-wrapper .kom-category-filter__button:hover .kom-category-filter__count,
.kom-category-wrapper .kom-category-filter__button:focus-visible .kom-category-filter__count {
    color: var(--kom-red);
}

/* Duchas / Torneiras */
.kom-category-filter__checklist {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0 20px 10px;
    list-style: none;
}

.kom-category-filter__checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 29px;
    color: #444;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.25;
    cursor: pointer;
}

.kom-category-filter__checkbox input {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    margin: 0;
    border: 1px solid #979da3;
    border-radius: 2px;
    accent-color: var(--kom-red);
    cursor: pointer;
}

.kom-category-filter__checkbox.is-disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.kom-category-filter__checkbox.is-disabled input {
    cursor: not-allowed;
}

/* =========================================================
   GRADE / CARDS
   ========================================================= */

.kom-category-pages {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
}

.kom-category-pages__card {
    display: flex;
    min-width: 0;
    height: 264px;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    border: 0;
    border-radius: var(--kom-card-radius);
    background: var(--kom-card);
    color: var(--kom-text);
    text-decoration: none !important;
    box-shadow: none;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.kom-category-pages__card:hover,
.kom-category-pages__card:focus-visible {
    color: var(--kom-text);
    text-decoration: none !important;
    outline: none;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.045);
    transform: translateY(-1px);
}

.kom-category-pages__thumbnail {
    display: flex;
    height: 194px;
    flex: 0 0 194px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 28px 20px 8px;
    background: transparent;
}

.kom-category-pages__image,
.kom-category-pages__thumbnail img {
    display: block !important;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center center;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

.kom-category-pages__title {
    display: flex;
    flex: 1 1 auto;
    min-height: 70px;
    align-items: center;
    justify-content: center;
    padding: 8px 12px 13px;
    color: #1f1f1f;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: 0;
    text-align: center;
}

.kom-category-pages__card--no-image .kom-category-pages__image {
    opacity: 0.72 !important;
}

.kom-category-pages__status {
    grid-column: 1 / -1;
    width: 100%;
    padding: 34px 20px;
    border: 1px solid var(--kom-border);
    border-radius: 6px;
    background: #fff;
    color: #666;
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
}

.kom-category-pages__status--error {
    color: #a51f25;
}

/* =========================================================
   PAGINACAO
   ========================================================= */

.kom-category-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    margin-top: 22px;
}

.kom-category-pagination[hidden] {
    display: none !important;
}

.kom-category-wrapper .kom-category-pagination__button {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 1px solid #d8dce0 !important;
    border-radius: 3px !important;
    background: #fff !important;
    box-shadow: none !important;
    color: #6f757b !important;
    font: inherit;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    text-transform: none;
    cursor: pointer;
}

.kom-category-wrapper .kom-category-pagination__button:hover,
.kom-category-wrapper .kom-category-pagination__button:focus-visible {
    border-color: var(--kom-red) !important;
    color: var(--kom-red) !important;
    outline: none;
}

.kom-category-wrapper .kom-category-pagination__button--active,
.kom-category-wrapper .kom-category-pagination__button--active:hover,
.kom-category-wrapper .kom-category-pagination__button--active:focus-visible {
    border-color: var(--kom-red) !important;
    background: var(--kom-red) !important;
    color: #fff !important;
}

.kom-category-pagination__ellipsis {
    display: inline-flex;
    min-width: 20px;
    height: 28px;
    align-items: center;
    justify-content: center;
    color: #8d9399;
    font-size: 12px;
}

/* =========================================================
   RESPONSIVO
   ========================================================= */

/* Mantem a sidebar e reduz a grade antes de empilhar o filtro. */
@media (max-width: 1080px) {
    .kom-category-wrapper {
        --kom-filter-width: 250px;
    }

    .kom-category-layout {
        gap: 24px;
    }

    .kom-category-pages {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .kom-category-layout {
        display: block;
    }

    .kom-category-filter {
        position: static;
        width: 100%;
        max-width: none;
        margin: 0 0 24px;
    }

    .kom-category-pages {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .kom-category-pages__card {
        height: 250px;
    }

    .kom-category-pages__thumbnail {
        height: 182px;
        flex-basis: 182px;
        padding-top: 24px;
    }

    .kom-category-pages__title {
        min-height: 68px;
        font-size: 15px;
    }
}

@media (max-width: 640px) {
    .kom-category-filter__header {
        padding-right: 18px;
        padding-left: 18px;
    }

    .kom-category-wrapper .kom-category-filter__section-toggle,
    .kom-category-wrapper .kom-category-filter__button {
        padding-right: 18px;
        padding-left: 18px;
    }

    .kom-category-filter__checklist {
        padding-right: 18px;
        padding-left: 18px;
    }

    .kom-category-pages {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .kom-category-pages__card {
        height: 238px;
    }

    .kom-category-pages__thumbnail {
        height: 170px;
        flex-basis: 170px;
        padding: 20px 14px 6px;
    }

    .kom-category-pages__title {
        min-height: 68px;
        padding: 8px 8px 11px;
        font-size: 14px;
    }
}

@media (max-width: 390px) {
    .kom-category-pages {
        grid-template-columns: 1fr;
    }

    .kom-category-pages__card {
        height: 300px;
    }

    .kom-category-pages__thumbnail {
        height: 230px;
        flex-basis: 230px;
    }

    .kom-category-pages__title {
        min-height: 70px;
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kom-category-pages__card,
    .kom-category-filter__count,
    .kom-category-filter__chevron,
    .kom-category-wrapper .kom-category-filter__button {
        transition: none;
    }
}
