/* Webify Data Engine — Frontend Filter CSS
   UI kế thừa từ Webify Filter Product (pill-style horizontal checkboxes)
*/

/* ── Wrapper ── */
.webify-filter-wrapper {
  margin-bottom: 20px;
  font-family: inherit;
  font-size: 14px;
  color: #1e1e2f;
}
.webify-filter-wrapper:has(.webify-layout-dropdown) {
  margin-top: 30px;
}

/* ── Active tags row ── */
.webify-filter-active-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 15px;
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}
.webify-tag-label {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.webify-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.webify-active-tag {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid #ddd;
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 4px;
  color: #333;
  cursor: pointer;
  transition: all .15s ease;
}
.webify-active-tag:hover { border-color: #e74c3c; color: #e74c3c; }
.webify-active-tag__remove {
  margin-left: 6px;
  font-size: 15px;
  line-height: 1;
  color: #999;
}
button.webify-clear-all {
  color: #333;
  background: #eee;
  border: 1px solid #ccc;
  padding: 5px 12px;
  margin-left: auto;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all .2s;
  white-space: nowrap;
}
button.webify-clear-all:hover, button.webify-clear-all:focus { color: #e74c3c; background: #eee; }

/* ── Filter groups container ── */
.webify-filter-groups {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Group title ── */
.webify-filter-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: default;
}
.webify-layout-dropdown {
  position: relative;
  width: max-content;
  max-width: 100%;
}
.webify-layout-dropdown .webify-filter-title {
  margin-bottom: 0;
  height: 32px;
  padding: 0 14px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background-color: #fff;
  font-size: 14px;
  font-weight: 400;
  color: #1e1e2f;
  cursor: pointer;
  transition: border-color .15s;
}
.webify-layout-dropdown .webify-filter-title:hover {
  border-color: #b5b5b5;
}
.webify-layout-dropdown .wde-filter-body {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
  padding: 4px 0;
  z-index: 999;
  display: none;
}
.webify-layout-dropdown .webify-filter-list ul {
  flex-direction: column;
  gap: 0;
  width: 100%;
}
.webify-filter-list.wde-filter-checkbox {
  width: 100%;
}
.webify-layout-dropdown .webify-checkbox-label,
.webify-layout-dropdown .webify-radio-label {
  border: none !important;
  background: transparent !important;
  border-radius: 0;
  padding: 8px 16px;
  width: 100%;
  justify-content: flex-start;
  font-weight: 400;
  display: flex;
  align-items: center;
}
.webify-layout-dropdown .webify-checkbox-label::before,
.webify-layout-dropdown .webify-radio-label::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 10px;
  border: 1px solid #c5c5c5;
  border-radius: 3px;
  background-color: #fff;
  transition: all 0.2s;
  flex-shrink: 0;
}
.webify-layout-dropdown .webify-radio-label::before {
  border-radius: 50%;
}
.webify-layout-dropdown .webify-checkbox-label:hover::before,
.webify-layout-dropdown .webify-radio-label:hover::before {
  border-color: #999;
}
.webify-layout-dropdown .webify-checkbox-label:hover,
.webify-layout-dropdown .webify-radio-label:hover {
  background: #f8f9fa !important;
}
.webify-layout-dropdown .wfp-checked,
.webify-layout-dropdown .webify-checkbox-label:has(input:checked),
.webify-layout-dropdown .webify-radio-label:has(input:checked) {
  font-weight: 400;
}
.webify-layout-dropdown .wfp-checked::before,
.webify-layout-dropdown .webify-checkbox-label:has(input:checked)::before {
  background-color: var(--w-accent, #000);
  border-color: var(--w-accent, #000);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: 10px 10px;
  background-position: center;
  background-repeat: no-repeat;
}
.webify-layout-dropdown .webify-radio-label:has(input:checked)::before {
  background-color: #fff;
  border-color: var(--w-accent, #000);
  border-width: 4px;
}
.webify-toggle-icon {
  display: inline-flex;
  align-items: center;
  color: #666;
  transition: transform .3s;
  margin-left: 10px;
}
.webify-icon-active { transform: rotate(180deg); }

/* ── Filter list — PILL LAYOUT (horizontal flex-wrap) ── */
.webify-filter-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.webify-filter-list li { margin: 0; }

/* ── Pill checkbox label (input hidden, label styled as button) ── */
.webify-checkbox-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  color: #444;
  background: #fff;
  border: 1px solid #e0e0e0;
  padding: 8px 14px;
  border-radius: 6px;
  transition: border-color .18s ease, background .18s ease, font-weight .1s;
  user-select: none;
  white-space: nowrap;
}
.webify-checkbox-label:hover { border-color: #999; }

/* Active / checked state */
.webify-checkbox-label:has(input:checked) {
  border-color: #222;
  background: #fdfdfd;
  font-weight: 600;
  color: #000;
}
/* Fallback for browsers without :has() */
.webify-checkbox-label.wfp-checked {
  border-color: #222;
  background: #fdfdfd;
  font-weight: 600;
  color: #000;
}

/* Hide the actual checkbox/radio input */
.webify-checkbox-label input { display: none; }

.webify-filter-name { flex: 1; }
.webify-filter-count {
  margin-left: 5px;
  font-size: 12px;
  color: #888;
}

/* ── Radio label (same pill style) ── */
.webify-radio-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  color: #444;
  background: #fff;
  border: 1px solid #e0e0e0;
  padding: 8px 14px;
  border-radius: 6px;
  transition: border-color .18s ease;
  user-select: none;
  white-space: nowrap;
}
.webify-radio-label:hover { border-color: #999; }
.webify-radio-label:has(input:checked) { border-color: #222; font-weight: 600; color: #000; }
.webify-radio-label input { display: none; }

/* ── Select dropdown ── */
.wde-filter-select {
  width: auto;
  max-width: 100%;
  height: 40px;
  padding: 0 36px 0 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background-color: #fff;
  color: #1e1e2f;
  font-size: 13px;
  appearance: none;
  background-image: 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='%238f93b0' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}
.wde-filter-select:focus { border-color: #0075b3; box-shadow: 0 0 0 3px rgba(0,117,179,.07); }

/* ── Search input ── */
.wde-filter-search {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: #1e1e2f;
  outline: none;
  transition: border-color .15s;
}
.wde-filter-search:focus { border-color: #0075b3; box-shadow: 0 0 0 3px rgba(0,117,179,.07); }

/* ── Range slider ── */
.wde-filter-range { padding: 8px 0 14px; }
.wde-range-track { height: 4px; background: #e0e0e0; border-radius: 2px; position: relative; margin: 12px 0 6px; }
.wde-range-fill { height: 100%; background: #0075b3; border-radius: 2px; position: absolute; }
.wde-range-labels { display: flex; justify-content: space-between; font-size: 12px; color: #4a5568; font-weight: 500; }

/* ── Widget wrapper (native shortcode) ── */
.webify-filter-widget {
  background: #fff;
  margin-bottom: 12px;
}
.wde-filter-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #1e1e2f;
}
.wde-filter-body { padding: 0; }

/* ── Loading skeleton (spinner over products) ── */
.elementor-loop-container.webify-filtering,
ul.products.webify-filtering {
  position: relative;
  min-height: 200px;
}
.elementor-loop-container.webify-filtering > *,
ul.products.webify-filtering > * {
  opacity: .3;
  pointer-events: none;
  transition: opacity .2s;
}
.webify-loading-skeleton {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #0075b3;
  border-radius: 50%;
  animation: wfpSpin 1s linear infinite;
  z-index: 10;
}
@keyframes wfpSpin {
  0%   { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── No results ── */
.wde-no-results {
  text-align: center;
  padding: 40px 20px;
  font-size: 14px;
  color: #8f93b0;
}

/* ── Responsive ── */
@media (max-width: 767px) {
  .webify-filter-list ul { gap: 8px; }
  .webify-checkbox-label,
  .webify-radio-label { padding: 6px 10px; font-size: 12px; }
  .webify-filter-active-tags { flex-direction: column; align-items: flex-start; }
  button.webify-clear-all { margin-left: 0; padding: 3px 10px; font-size: 12px; }
  .webify-active-tag { padding: 3px 10px; font-size: 12px; }
}

/* User requested CSS */
.webify-filter-list {
	padding-left: 0;
	display: inline-flex;
	gap: 10px;
}
@media (max-width: 767px) {
	.webify-filter-list {
		gap: 8px;
	}
}
.webify-filter-list li {
	list-style: none;
}

@media (max-width: 767px) {
  .webify-layout-dropdown .webify-filter-title {
    height: 26px;
    padding: 0 5px 0 10px;
    font-size: 12px;
  }
  .webify-toggle-icon {
    margin-left: 8px;
  }
}


