.aces-htmx-controls{
  display:flex;
  flex-wrap:nowrap;
  align-items:center; /* vertical alignment for all controls */
  gap:12px 16px;
  margin:0 0 12px 0;
  background:transparent;
  border:0;
  border-radius:0;
  box-sizing:border-box;
}

/* Ensure consistent left/right padding for toolbar in all modes */

.aces-htmx-cols,
.aces-htmx-facet{
  border:0;
  padding:0;
  margin:0;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
}

.aces-htmx-cols legend,
.aces-htmx-facet legend{
  font-size:12px;
  color:#6c757d;
  text-transform:uppercase;
  letter-spacing:.04em;
  margin-right:6px;
}

.aces-htmx-cols label,
.aces-htmx-facet label{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border:1px solid #dee2e6;
  border-radius:6px;
  background:#ffffff;
  color:#495057;
  cursor:pointer;
  transition:background .15s ease,border-color .15s ease,color .15s ease;
}

.aces-htmx-controls input[type="checkbox"]{
  appearance:none;
  width:14px;
  height:14px;
  border:1px solid #adb5bd;
  border-radius:3px;
  background:#fff;
  position:relative;
}
.aces-htmx-controls input[type="checkbox"]:checked{
  background:#0d6efd;
  border-color:#0d6efd;
}
.aces-htmx-controls input[type="checkbox"]:checked::after{
  content:'';
  position:absolute;
  top:2px;left:4px;
  width:4px;height:8px;
  border:solid #fff;
  border-width:0 2px 2px 0;
  transform:rotate(45deg);
}

.aces-htmx-search-wrapper{
  margin-left:auto; /* pushes search cluster to the right */
  display:flex;
  align-items:center;
  gap:10px; /* spacing between search and any trailing buttons (e.g., Reset) */
}
.aces-htmx-search{
  min-width:220px;
  height:36px; /* match .aces-btn height */
  padding:8px 12px;
  border:1px solid #dee2e6;
  border-radius:8px; /* match .aces-btn radius */
  background:#fff;
  color:#212529;
  font-size:14px;
  line-height:1.2;
  box-sizing:border-box;
}
.aces-htmx-search:focus{
  outline:none;
  border-color:#86b7fe;
  box-shadow:0 0 0 0.2rem rgba(13,110,253,.1);
}

/* Hide the search icon when there is text */
.aces-list-search.has-value .aces-search-icon{ display:none; }
/* Also hide when the input is focused */
.aces-list-search:focus-within .aces-search-icon{ display:none; }
.aces-list-search.is-focus .aces-search-icon{ display:none; }



.aces-htmx-controls button{
  padding:8px 12px;
  border:1px solid #dee2e6;
  background:#ffffff;
  color:#495057;
  border-radius:8px;
  cursor:pointer;
  min-height:36px; /* align height with .aces-btn */
}
.aces-htmx-controls button:hover{
  background:#f1f3f5;
}
.aces-htmx-controls button:focus{
  outline:none;
  border-color:#86b7fe;
  box-shadow:0 0 0 0.2rem rgba(13,110,253,.1);
}

@media (max-width:768px){
  .aces-htmx-controls{flex-wrap:wrap}
  .aces-htmx-search-wrapper{width:100%;margin-left:0}
  .aces-htmx-search{width:100%;}
}
.aces-toolbar-left{display:flex;align-items:center;gap:10px}
.aces-btn{border:1px solid #dee2e6;background:#fff;color:#495057;border-radius:8px;padding:6px 12px;cursor:pointer;display:inline-flex;align-items:center;gap:8px;white-space:nowrap;line-height:1.2;height:36px;font-size:14px;vertical-align:middle}
.aces-btn i{display:inline-flex;align-items:center;justify-content:center;line-height:0;vertical-align:middle}
/* Nudge FA arrow icon slightly to align with text baseline */
.aces-btn i.fa-arrow-up, .aces-btn i.fa-arrow-down{position:relative;top:1px;font-size:13px}
.aces-btn:hover{background:#f1f3f5}
.aces-btn-link{background:none;border:0;color:#0d6efd;cursor:pointer;padding:6px 8px}
.aces-btn-reset{border-color:#e9ecef}
/* Prevent button text from wrapping */
.aces-btn span{white-space:nowrap}

.aces-dropdown{position:relative}
.aces-dropdown-menu{position:absolute;z-index:40;top:calc(100% + 6px);left:0;min-width:260px;max-width:360px;background:#fff;border:1px solid #e9ecef;border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.08);padding:8px 0;display:none}
.aces-dropdown[data-dd].open>.aces-dropdown-menu{display:block}
.aces-dropdown-header{font-size:12px;color:#6c757d;padding:6px 12px;text-transform:uppercase;letter-spacing:.04em}
.aces-dropdown-header.aces-sort-header{display:flex;align-items:center;justify-content:space-between}
.aces-dropdown-body{max-height:340px;overflow:auto;padding:4px 8px 8px}
.aces-dropdown-footer{display:flex;justify-content:space-between;gap:8px;padding:8px 12px;border-top:1px solid #f1f3f5}
.aces-checkbox{display:flex;align-items:center;gap:8px;border-radius:6px}
.aces-facet-group{padding:6px 4px}
.aces-facet-title{font-size:12px;color:#6c757d;margin:4px 8px}
.aces-facet-options{display:flex;flex-wrap:wrap;gap:6px 10px;padding:0 8px}
/* Range control tweaks */
.aces-facet-options input[type=range]{width:100%;max-width:260px}
.aces-facet-options .aces-range-value strong{color:#495057}

/* Icons next to labels */
.aces-dropdown-body .aces-checkbox i{color:#6c757d;font-size:14px;width:16px;text-align:center}
.aces-facet-title i{color:#6c757d;margin-right:6px}
.aces-dropdown-body .aces-checkbox span{font-size:14px}

/* Sorting menu options without boxed borders */
.aces-dropdown-menu .aces-htmx-sorting-option{
  border:0 !important;
  background:transparent !important;
  display:flex; /* icon + label alignment */
  align-items:center;
  gap:10px; /* space between icon and text */
  width:100%;
  text-align:left;
  padding:8px 12px;
  color:#212529;
  font-size:14px;
  line-height:1.2;
  white-space:nowrap;
}
.aces-dropdown-menu .aces-htmx-sorting-option i{width:16px;display:inline-flex;align-items:center;justify-content:center;color:#6c757d}
.aces-dropdown-menu .aces-htmx-sorting-option svg{width:16px;min-width:16px;height:16px;display:inline-block;color:#6c757d}
.aces-dropdown-menu .aces-htmx-sorting-option:hover{
  background:#f8f9fa !important;
}
/* Sort hint text */
.aces-sort-hint{
  font-size:11px;
  color:#6c757d;
  font-style:italic;
  margin-left:8px;
}

/* Active sort option styling */
.aces-htmx-sorting-option.aces-sort-active{
  background:#e3f2fd !important;
  color:#1976d2 !important;
  font-weight:500;
}

.aces-htmx-sorting-option.aces-sort-active i{
  color:#1976d2 !important;
}

/* Sort direction indicator */
.aces-sort-direction{
  margin-left:auto;
  color:#1976d2 !important;
  font-size:12px;
  opacity:0.8;
}

/* Hover state for active sort option */
.aces-htmx-sorting-option.aces-sort-active:hover{
  background:#bbdefb !important;
}
/* Filters badge */
.aces-btn .aces-badge{display:inline-flex;align-items:center;justify-content:center;height:16px;min-width:16px;padding:0 6px;border-radius:999px;background:#ff2453;color:#fff;font-size:11px;line-height:16px;margin-left:4px}

/* Dropdown guardrail for viewport */
@media (max-width: 600px){
  .aces-dropdown-menu{left:auto;right:0;min-width:72vw}
}
