/* ES attribute filter */
.es-filter {
  margin-bottom: 2rem;
}

.es-filter .widget-title {
  margin-bottom: 1rem;
}

.es-filter-inner {
  font-size: 1.3rem;
  line-height: 1.5;
}

.es-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding-bottom: .9rem;
  margin-bottom: .9rem;
  border-bottom: 1px solid #eee;
}

.es-filter-total {
  color: #777;
}

.es-filter-total b {
  color: #222;
}

.es-filter-reset {
  border: 0;
  background: none;
  padding: 0;
  color: var(--rio-primary-color, #007ccc);
  font: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.es-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}

.es-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid var(--rio-primary-color, #007ccc);
  background: #fff;
  color: var(--rio-primary-color, #007ccc);
  border-radius: 20px;
  padding: .3rem .8rem;
  font: inherit;
  font-size: 1.15rem;
  line-height: 1.6;
  cursor: pointer;
}

.es-chip:hover {
  background: var(--rio-primary-color, #007ccc);
  color: #fff;
}

.es-chip-x {
  font-style: normal;
  font-size: 1.5rem;
  line-height: 1;
}

.es-filter-group {
  border-bottom: 1px solid #eee;
}

.es-filter-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: .9rem 0;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  outline: none;
}

.es-filter-group summary::-webkit-details-marker {
  display: none;
}

.es-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #999;
  transition: transform .2s ease;
}

.es-filter-group[open] .es-caret {
  transform: rotate(180deg);
}

.es-filter-vals {
  padding: .1rem 0 1rem;
}

.es-opt {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .35rem 0;
  cursor: pointer;
  user-select: none;
}

.es-opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.es-box {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border: 1px solid #c9c9c9;
  border-radius: 3px;
  background: #fff;
  position: relative;
  transition: background .15s ease, border-color .15s ease;
}

.es-opt:hover .es-box {
  border-color: var(--rio-primary-color, #007ccc);
}

.es-opt input:checked + .es-box {
  background: var(--rio-primary-color, #007ccc);
  border-color: var(--rio-primary-color, #007ccc);
}

.es-opt input:checked + .es-box::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.es-opt input:focus-visible + .es-box {
  box-shadow: 0 0 0 2px rgba(0, 124, 204, .25);
}

.es-name {
  flex: 1 1 auto;
  color: #333;
  word-break: break-word;
}

.es-count {
  flex: 0 0 auto;
  color: #aaa;
  font-size: 1.1rem;
  padding-left: .5rem;
}

.es-opt.is-zero {
  opacity: .45;
}

.es-more {
  margin-top: .6rem;
  border: 0;
  background: none;
  padding: 0;
  color: var(--rio-primary-color, #007ccc);
  font: inherit;
  font-size: 1.15rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.es-filter-loading,
.es-filter-empty {
  color: #999;
  padding: .5rem 0;
}

.es-filter.is-loading {
  opacity: .6;
  pointer-events: none;
}

/* Product grid loading overlay */
.product-archive .products.es-af-loading {
  position: relative;
}

.product-archive .products.es-af-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 9;
  background: rgba(255, 255, 255, .65) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='16' fill='none' stroke='%23007ccc' stroke-width='4' stroke-dasharray='80 40'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 20 20' to='360 20 20' dur='0.9s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E") center / 40px no-repeat;
}

/* Mobile: sidebar drawer */
@media (max-width: 991px) {
  #es-filter {
    margin-bottom: 1.5rem;
  }

  .es-filter .widget-title {
    font-size: 1.6rem;
  }
}

/* Compact filters button for mobile */
.es-filter-mobile-btn {
  display: none;
}

@media (max-width: 991px) {
  .es-filter-mobile-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    padding: .6rem 1rem;
    font: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    margin-bottom: 1rem;
  }
}

/* Legacy global-attribute widget is replaced by the ES filter */
.shop-sidebar .widget_layered_nav {
  display: none !important;
}

