/* Categories Listing — Structural CSS */
/* Colors, borders, gaps come from per-instance generated_css */

.catlist {
    display: block;
    margin-top: 10px;
}

.catlist .cl_list_and_pagination {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 16px;
    position: relative;
}

.catlist a, .catlist button {
    text-decoration: none !important;
    cursor: pointer;
}

.catlist img {
    max-width: 100%;
}

.catlist .cl_list {
    display: grid;
    width: 100%;
    margin: auto;
    overflow-x: hidden;
    overflow-y: hidden;
}

/* Card — flex column so button can stick to bottom via margin-top:auto */
.catlist .cl_list .cl_item {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

/* Hover — subtle lift */
.catlist .cl_list .cl_item:hover {
    transform: translateY(-2px);
}

/* ─── Content wrapper — padding + gap for all non-image elements ─── */
.catlist .cl-cat-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 14px 16px;
    flex-grow: 1;
}

/* ─── Horizontal layout ─── */
.catlist .cl_list .cl_item.layout-horizontal {
    flex-direction: row;
}

.catlist .cl_list .cl_item.layout-horizontal .cl-cat-image {
    max-width: 40%;
    flex-shrink: 0;
}

.catlist .cl_list .cl_item.layout-horizontal .cl-cat-content {
    justify-content: center;
}

/* ─── Image with aspect ratio ─── */
.cl-cat-image {
    overflow: hidden;
}

.cl-cat-image a {
    display: block;
    position: relative;
    overflow: hidden;
}

/* When padding-bottom is set inline (aspect ratio), image is absolute-positioned */
.cl-cat-image a[style*="padding-bottom"] {
    height: 0;
}

.cl-cat-image a[style*="padding-bottom"] img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cl-cat-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.35s ease;
}

/* Zoom on hover */
.catlist .cl_item:hover .cl-cat-image img {
    transform: scale(1.05);
}

/* ─── Title + Count row — same line, wrap when no space ─── */
.cl-cat-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0 8px;
}

.cl-cat-title-row .cl-cat-title {
    flex-shrink: 0;
}


/* ─── Title ─── */
.cl-cat-title a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

/* ─── Description ─── */
.cl-cat-description {
    overflow: hidden;
}

/* ─── Counts ─── */
.cl-cat-product-count,
.cl-cat-subcategories-count {
    display: flex;
    align-items: center;
}

/* ─── Button — push to bottom of card ─── */
.cl-cat-button-link {
    margin-top: auto;
}

.cl-cat-button-link a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none !important;
    transition: opacity 0.2s ease;
}

.cl-cat-button-link a:hover {
    opacity: 0.8;
}

/* ─── Pagination ─── */
.catlist .list-load-more-btn {
    cursor: pointer;
    transition: opacity 0.3s ease;
}
.catlist .list-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.catlist .list-loading {
    margin-top: 10px;
    color: #6b7280;
}
.catlist .list-pagination-numbers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.catlist .cl-pagination-number {
    min-width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.catlist .cl-pagination-number:disabled {
    cursor: not-allowed;
}

/* ─── Filter ─── */
.catlist .list-filter-groups {
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding-top: 10px;
}
.catlist .list-filter-group {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: min-content;
}

/* ─── Filter — visually hide radio inputs (list.css only hides checkboxes).
   Cannot use display:none — it breaks label click→radio check in some browsers.
   Use absolute positioning + opacity:0 so the radio stays in DOM + clickable. ─── */
.catlist .list-filter-display-buttons input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.catlist .list-filter-display-buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.catlist .list-filter-display-buttons li label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    user-select: none;
    transition: all 0.15s ease;
}

/* ─── Mobile ─── */
@media (max-width: 767px) {
    .catlist .list-filter-container {
        width: 100%;
    }
}

/* ─── Entry animation ─── */
@keyframes cl-catFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
