/* ==============================================
   DMTT Ajax Filter – filter.css
   Giao diện hòa quyện với theme Electro
   ============================================== */

/* ── Widget container ── */
.dmtt-filter-widget {
  font-size: 13px;
  color: #333;
  line-height: 1.5;
}

/* ── Thanh kết quả + nút reset ── */
.dmtt-filter-active-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid #eee;
  gap: 8px;
}

.dmtt-result-count {
  font-size: 12px;
  color: #666;
  flex: 1;
}
.dmtt-result-count strong {
  color: #c8a951;  /* màu vàng Electro */
  font-weight: 700;
}

.dmtt-reset-btn {
  background: none;
  border: 1px solid #c8a951;
  color: #c8a951;
  border-radius: 3px;
  padding: 3px 9px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  line-height: 1.6;
}
.dmtt-reset-btn:hover {
  background: #c8a951;
  color: #fff;
}

/* ── Nhóm thuộc tính ── */
.dmtt-group {
  border-bottom: 1px solid #f0f0f0;
}
.dmtt-group:last-of-type {
  border-bottom: none;
}

.dmtt-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px;
  font-weight: 600;
  font-size: 13px;
  color: #222;
  cursor: pointer;
  user-select: none;
  transition: color .15s;
}
.dmtt-group-title:hover {
  color: #c8a951;
}

.dmtt-arrow {
  transition: transform .2s;
  color: #999;
  flex-shrink: 0;
}
.dmtt-group.collapsed .dmtt-arrow {
  transform: rotate(-90deg);
}
.dmtt-group.collapsed .dmtt-term-list {
  display: none;
}

/* ── Danh sách terms ── */
.dmtt-term-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}
.dmtt-term-list li {
  padding: 0;
  margin: 0;
}

/* 2-column grid */
.dmtt-term-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 6px;
}

/* ── Label mỗi term ── */
.dmtt-term-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: background .12s;
  color: #444;
  min-width: 0; /* allow truncation in grid */
}
.dmtt-term-label:hover {
  background: #faf7ee;
  color: #c8a951;
}

/* Checkbox */
.dmtt-chk {
  width: 14px;
  height: 14px;
  accent-color: #c8a951;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

/* Tên term – cắt nếu quá dài, tooltip qua title */
.dmtt-term-name {
  flex: 1;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* dmtt-term-count removed */

/* Checked state */
.dmtt-term-label:has(.dmtt-chk:checked) {
  background: #fdf8ea;
}
.dmtt-term-label:has(.dmtt-chk:checked) .dmtt-term-name {
  color: #b8940f;
  font-weight: 600;
}
.dmtt-term-label:has(.dmtt-chk:checked) .dmtt-term-count {
  color: #c8a951;
}

/* Zero count → mờ, không click được */
.dmtt-term-label.is-zero {
  opacity: 0.38;
  pointer-events: none;
}

/* ── Loading ── */
.dmtt-loading-bar {
  font-size: 12px;
  color: #aaa;
  padding: 8px 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dmtt-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid #ddd;
  border-top-color: #c8a951;
  border-radius: 50%;
  animation: dmtt-spin .6s linear infinite;
  flex-shrink: 0;
}

@keyframes dmtt-spin {
  to { transform: rotate(360deg); }
}

/* ── Products loading state ── */
ul.products {
  transition: opacity .18s;
}

/* ── Pagination inject ── */
.dmtt-pagination .page-numbers,
.woocommerce-pagination.dmtt-pagination .page-numbers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  list-style: none;
  padding: 20px 0;
  margin: 0;
}

.dmtt-pagination .page-numbers li {
  margin: 0;
}

.dmtt-pagination .page-numbers a,
.dmtt-pagination .page-numbers span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  font-size: 13px;
  color: #555;
  text-decoration: none;
  transition: all .15s;
  background: #fff;
}

.dmtt-pagination .page-numbers a:hover {
  border-color: #c8a951;
  color: #c8a951;
}

.dmtt-pagination .page-numbers .current {
  background: #c8a951;
  border-color: #c8a951;
  color: #fff;
  font-weight: 700;
}

.dmtt-pagination .page-numbers .dots {
  border-color: transparent;
  background: none;
}

/* ── "Không tìm thấy" message ── */
li.dmtt-no-products {
  display: block;
  width: 100%;
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 14px;
  background: #fafafa;
  border: 1px dashed #e0e0e0;
  border-radius: 6px;
  list-style: none;
}

/* ─────────────────────────────
   MOBILE
───────────────────────────── */
@media (max-width: 767px) {
  .dmtt-filter-widget {
    font-size: 13px;
  }
  .dmtt-group-title {
    padding: 10px 0;
  }
}

/* ── Faceted: ẩn term không có kết quả ── */
li.dmtt-hidden {
  display: none !important;
}

/* ── Ẩn cả nhóm khi không còn term nào ── */
.dmtt-group.dmtt-group-hidden {
  display: none !important;
}

/* ── Term đang được chọn ── */
.dmtt-term-label.is-checked .dmtt-term-name {
  color: #b8940f;
  font-weight: 600;
}
.dmtt-term-label.is-checked .dmtt-term-count {
  color: #c8a951;
}

/* ══════════════════════════════════════
   FACETED FILTER – VISIBILITY
══════════════════════════════════════ */

/* Term li wrapper (thêm class này trong widget PHP) */
.dmtt-term-li {
  transition: opacity .15s;
}

/* Term ẩn hoàn toàn */
.dmtt-term-li.dmtt-hidden {
  display: none !important;
}

/* Nhóm không còn term nào liên quan */
.dmtt-group.dmtt-group-empty {
  display: none !important;
}

/* Term đang được chọn */
.dmtt-term-label.dmtt-checked .dmtt-term-name {
  color: #b8940f;
  font-weight: 600;
}
.dmtt-term-label.dmtt-checked .dmtt-term-count {
  color: #c8a951;
}

/* Xóa rule cũ nếu còn */
.dmtt-term-label.is-zero { opacity: 1; pointer-events: auto; }
li.dmtt-hidden { display: none !important; }
.dmtt-group.dmtt-group-hidden { display: none !important; }
