.mg-woo-filter {
  position: relative;
  display: grid;
  gap: 16px;
  width: 100%;
  margin: 0 0 22px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff, #fbfcff);
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .07);
  overflow: hidden;
}

.mg-woo-filter,
.mg-woo-filter * {
  box-sizing: border-box;
}

.mg-woo-filter--horizontal {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
}

.mg-woo-filter--vertical {
  grid-template-columns: 1fr;
}

.mg-woo-filter__field {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
}

.mg-woo-filter__field span,
.mg-woo-filter__field legend {
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  padding: 0;
}

.mg-woo-filter input,
.mg-woo-filter select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  color: #101828;
  background: #fff;
  border: 1px solid #d0d5dd;
  border-radius: 9px;
  box-shadow: none;
  font-weight: 700;
}

.mg-woo-filter input:focus,
.mg-woo-filter select:focus {
  border-color: #d89a00;
  outline: none;
  box-shadow: 0 0 0 3px rgba(216, 154, 0, .16);
}

.mg-woo-filter__price {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mg-woo-filter__choices {
  border: 0;
  padding: 0;
  margin: 0;
}

.mg-woo-filter__choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mg-woo-filter__choices--cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mg-woo-filter__choices--cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mg-woo-filter__choices legend {
  grid-column: 1 / -1;
}

.mg-woo-choice {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.mg-woo-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mg-woo-choice span {
  width: 100%;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 11px;
  color: #344054;
  background: #fff;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  transition: border-color .16s ease, box-shadow .16s ease, color .16s ease, background .16s ease;
}

.mg-woo-choice em {
  font-style: normal;
}

.mg-woo-choice input:checked + span {
  color: #7a4f00;
  background: #fffbeb;
  border-color: #e4a600;
  box-shadow: 0 0 0 3px rgba(216, 154, 0, .16);
}

.mg-woo-filter__choices--swatch .mg-woo-choice:not(.mg-woo-choice--all) span {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--mg-choice-color, #d0d5dd);
}

.mg-woo-filter__choices--swatch .mg-woo-choice {
  justify-content: center;
}

.mg-woo-filter__choices--swatch .mg-woo-choice:not(.mg-woo-choice--all) em {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.mg-woo-filter__choices--image .mg-woo-choice span {
  min-width: 52px;
  min-height: 52px;
  padding: 5px;
  border-radius: 10px;
}

.mg-woo-filter__choices--image img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 8px;
}

.mg-woo-filter__actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
}

.mg-woo-filter__actions button,
.mg-woo-filter__actions a {
  min-height: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
}

.mg-woo-filter__actions button {
  color: #fff;
  background: linear-gradient(135deg, #d99a00, #f3b625);
  border: 0;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(216, 154, 0, .18);
}

.mg-woo-filter__actions a {
  color: #9a6700;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.mg-woo-filter__reset {
  width: 44px;
  min-width: 44px;
  padding: 0 !important;
}

.mg-woo-filter__reset span {
  font-size: 22px;
  line-height: 1;
  transform: translateY(-1px);
}

.mg-woo-filter.is-loading {
  pointer-events: none;
}

.mg-woo-filter.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .66);
  backdrop-filter: blur(2px);
  z-index: 4;
}

.mg-woo-filter__loading {
  display: none;
}

.mg-woo-filter.is-loading .mg-woo-filter__loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mg-woo-filter[data-loading="spinner"].is-loading .mg-woo-filter__loading span {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(216, 154, 0, .20);
  border-top-color: #d89a00;
  border-radius: 50%;
  animation: mgWooSpin .7s linear infinite;
}

.mg-woo-filter[data-loading="bar"].is-loading .mg-woo-filter__loading {
  align-items: flex-start;
}

.mg-woo-filter[data-loading="bar"].is-loading .mg-woo-filter__loading span {
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #d89a00, transparent);
  animation: mgWooBar 1s ease-in-out infinite;
}

.mg-woo-filter-target-loading {
  position: relative;
  pointer-events: none;
}

.mg-woo-filter-target-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(2px);
  z-index: 30;
}

.mg-woo-filter-target-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 31;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 3px solid rgba(216, 154, 0, .20);
  border-top-color: #d89a00;
  border-radius: 50%;
  animation: mgWooSpin .7s linear infinite;
}

.mg-woo-filter-target-loading[data-mg-loading="bar"]::after {
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, transparent, #d89a00, transparent);
  animation: mgWooBar 1s ease-in-out infinite;
}

@keyframes mgWooSpin {
  to { transform: rotate(360deg); }
}

@keyframes mgWooBar {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@media (max-width: 640px) {
  .mg-woo-filter--horizontal {
    grid-template-columns: 1fr;
  }

  .mg-woo-filter__choices,
  .mg-woo-filter__choices--cols-3,
  .mg-woo-filter__choices--cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
