.lpd-filter {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ── Danh sách text ────────────────────────────── */
.lpd-filter.disp-list { flex-direction: column; gap: 2px; }

.lpd-filter.disp-list .lpd-term a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 2px;
    text-decoration: none;
    color: inherit;
    font-size: .9em;
    transition: color .15s;
}
.lpd-filter.disp-list .lpd-term a:hover { opacity: .75; }
.lpd-filter.disp-list .lpd-term.active a { font-weight: 700; }
.lpd-filter.disp-list .lpd-term.active a::before { content: '✓ '; color: #27ae60; }
.lpd-count { font-size: .8em; color: #aaa; margin-left: 2px; }

/* ── Màu sắc ───────────────────────────────────── */
.lpd-filter.disp-color {
    flex-direction: row !important;  /* luôn xếp ngang */
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
}

.lpd-filter.disp-color .lpd-term a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: inherit;
}
.lpd-swatch {
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,.12);
    transition: transform .15s, box-shadow .15s;
    cursor: pointer;
    flex-shrink: 0;
}
.lpd-swatch:hover { transform: scale(1.12); box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.lpd-filter.disp-color .lpd-term.active .lpd-swatch {
    border: 2px solid #111;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111;
}
.lpd-filter.disp-color .lpd-name {
    font-size: .7em;
    color: #666;
    max-width: 38px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Hình mẫu ──────────────────────────────────── */
.lpd-filter.disp-image {
    flex-direction: row !important;  /* luôn xếp ngang */
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
}

/* Mỗi item tự co theo nội dung, không bị kéo full-width */
.lpd-filter.disp-image .lpd-term,
.lpd-filter.disp-color .lpd-term { flex: 0 0 auto !important; width: auto !important; }

.lpd-filter.disp-image .lpd-term a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    position: relative;
}

/* Bọc ảnh — khung cố định, KHÔNG bị co giãn */
.lpd-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    min-width: 64px;
    max-width: 64px;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
    overflow: hidden;
    background: #fff;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}
.lpd-filter.disp-image .lpd-term a:hover .lpd-img-wrap {
    border-color: #aaa;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.lpd-filter.disp-image .lpd-term.active .lpd-img-wrap {
    border-color: #222;
    box-shadow: 0 0 0 1px #222;
}

/* Ảnh luôn vừa khung — ghi đè cả width/height attribute của WordPress */
.lpd-img-wrap img {
    width: 60px !important;
    height: 60px !important;
    object-fit: contain !important;
    display: block !important;
    border-radius: 0;
}

/* Placeholder khi không có ảnh */
.lpd-img-placeholder {
    font-size: .7em;
    color: #999;
    text-align: center;
    padding: 4px;
    line-height: 1.2;
}

/* Dấu check khi active */
.lpd-filter.disp-image .lpd-term.active a::after {
    content: '✓';
    position: absolute;
    top: -4px;
    right: -4px;
    background: #222;
    color: #fff;
    font-size: 9px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.lpd-filter.disp-image .lpd-name {
    font-size: .7em;
    color: #555;
    max-width: 64px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Số cột ────────────────────────────────────── */
.lpd-filter.cols-2 .lpd-term { flex: 0 0 calc(50% - 4px); }
.lpd-filter.cols-3 .lpd-term { flex: 0 0 calc(33.33% - 4px); }
.lpd-filter.cols-4 .lpd-term { flex: 0 0 calc(25% - 5px); }
.lpd-filter.cols-5 .lpd-term { flex: 0 0 calc(20% - 5px); }
.lpd-filter.cols-6 .lpd-term { flex: 0 0 calc(16.66% - 5px); }

/* Image/color mode: không cần flex-basis theo cột, tự wrap */
.lpd-filter.disp-image.cols-1 .lpd-term,
.lpd-filter.disp-color.cols-1 .lpd-term { flex: 0 0 auto; }
