.contains-match-group {
  margin-bottom: 16px;
}

.contains-match-group.has-value {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 16px;
}

.contains-match-group.variant-original.has-value {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 16px;
}

.contains-match-group .form-group {
  margin-bottom: 16px;
}

.contains-match-group .form-group:last-child {
  margin-bottom: 0;
}

.contains-match-group.variant-dropdown.has-value {
  border: none;
  padding: 0;
}

.contains-match-group.variant-dropdown .form-group {
  margin-bottom: 0;
}

/* Shared icon button styles for both close modal and clear field buttons */
.icon-btn,
.close-modal,
.clear-field-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  color: #495057;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.icon-btn:hover,
.close-modal:hover,
.clear-field-btn:hover {
  background: #e9ecef;
  border-color: #dee2e6;
  color: #212529;
}

.search-filters-wrapper {
  width: 100%;
  background: #fff;
}
.filters-container {
  position: relative;
  border-radius: 7px;
  padding: 8px 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Hamburger variant */
.filters-container.variant-hamburger {
  padding: 8px;
}

.filters-container.variant-hamburger .menu-button {
  width: 40px;
  height: 40px;
  padding: 8px;
  background: #43306c;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filters-container.variant-hamburger .menu-button svg {
  fill: #fff;
}

/* Filter button variant */
.filters-container.variant-filter .filter-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px; /* tighter */
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 16px;
  font-size: 12px; /* smaller */
  color: #495057;
  cursor: pointer;
  font-weight: 600;
}

.filters-container.variant-filter .filter-button svg {
  fill: #495057;
}

/* Edit search variant */
.filters-container.variant-edit_search .edit-search-button {
  padding: 8px 16px;
  background: #43306c;
  border: none;
  border-radius: 20px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Common hover states */
.filters-container.variant-hamburger .menu-button:hover,
.filters-container.variant-filter .filter-button:hover,
.filters-container.variant-edit_search .edit-search-button:hover,
.filters-container.variant-square_edit .square-edit-button:hover {
  opacity: 0.9;
}

/* Adjust pill container spacing based on variant */
.filters-container.variant-hamburger .filters-scroll-container,
.filters-container.variant-filter .filters-scroll-container,
.filters-container.variant-edit_search .filters-scroll-container,
.filters-container.variant-square_edit .filters-scroll-container {
  margin-top: 8px;
}

.edit-search {
  width: 100%;
  text-align: left;
  padding: 8px 0;
  background: none;
  border: none;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.edit-search:hover {
  color: #333;
  background: none;
}
.edit-search::before {
  content: "";
  display: inline-block;
  width: 27px;
  height: 27px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cg transform='translate(0,200) scale(0.1,-0.1)'%3E%3Cpath d='M600 1408c-18-13-40-38-49-55-15-30-20-33-62-33-53 0-83-18-73-43 5-13 18-17 60-17 53 0 54-1 74-40 56-109 206-107 263 3l19 37 373 0c344 0 373 1 379 17 16 40-10 43-393 43l-366 0-15 33c-34 73-141 101-210 55zm131-51c46-35 47-101 2-137-51-40-126-10-139 56-9 46 35 94 84 94 21 0 44-6 53-13z'/%3E%3Cpath d='M1168 1129c-23-12-46-35-58-59l-20-40-329 0c-280 0-330-2-341-15-10-12-10-18 0-30 11-13 61-15 341-15l328 0 16-30c51-98 173-116 244-35 17 20 31 42 31 50 0 12 18 15 94 15 71 0 97 4 106 15 10 12 10 18 0 30-9 11-35 15-104 15l-91 1-17 37c-21 45-80 82-129 82-19-1-51-10-71-21zm106-49c15-5 34-25 43-45 15-32 15-38 1-68-23-48-68-65-114-44-59 29-71 92-25 138 31 31 53 35 95 19z'/%3E%3Cpath d='M602 840c-18-11-40-36-49-55-16-33-20-35-64-35-45 0-79-17-79-40 0-16 38-30 82-30 38 0 45-4 59-33 50-103 211-102 259 0l15 33 366 0c383 0 409 3 393 43-6 16-35 17-380 17l-374 0-20 40c-12 23-35 50-53 60-42 26-112 26-155 0zm131-60c65-52 31-149-53-149-39 0-61 13-79 47-27 50 20 122 79 122 15 0 39-9 53-20z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}
.filters-scroll-container {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.filters-scroll-inner {
  display: flex;
  gap: 6px; /* reduced to fit more pills */
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  padding-right: 48px; /* tighter right padding */
}
.filters-scroll-inner::-webkit-scrollbar {
  display: none;
}
.scroll-arrow {
  position: absolute;
  bottom: -9px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e9ecef;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 10;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  opacity: 1;
  pointer-events: auto;
}
.scroll-arrow.scroll-right {
  right: -32px;
}
.scroll-arrow.scroll-left {
  left: -32px;
}

/* .scroll-arrow.scroll-left::before {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: linear-gradient(to left, rgba(255, 255, 255, 0), #ffffff);
  pointer-events: none;
  z-index: 1;
}
.scroll-arrow.scroll-right::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), #ffffff);
  pointer-events: none;
  z-index: 1;
} */
.scroll-arrow.hidden {
  display: none !important;
}
.scroll-arrow svg {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px;
  min-height: 20px;
  display: block;
}
.scroll-arrow:hover {
  background: #f8f9fa;
  border-color: #e9ecef;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.scroll-arrow.scroll-right:hover {
  transform: translateY(-50%) translateX(-4px);
}
.scroll-arrow.scroll-left:hover {
  transform: translateY(-50%) translateX(4px);
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 16px;
  padding: 4px 10px 4px 18px;
  min-height: 30px;
  font-size: 12px;
  line-height: 1.35;
  font-family: sans-serif;
  font-weight: 600;
  font-synthesis: none;
  font-size-adjust: 0.5;
  color: #495057;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}

.filter-pill svg {
  width: 10px !important;
  height: 10px !important;
  min-width: 10px;
  min-height: 10px;
  margin-left: 6px;
  transition: transform 0.2s ease;
  opacity: 1;
  fill: currentColor;
}

.filter-pill.applied {
  background: #43306c;
  border-color: #43306c;
  color: #ffffff;
}

.filter-pill.applied:hover {
  background: #362656;
  border-color: #362656;
  color: #ffffff;
}

.filter-pill:hover svg {
  transform: translateY(2px);
  opacity: 1;
}

.filter-pill .match-type-text {
  font-size: 11px; /* slightly smaller to match chip */
  opacity: 0.8;
  font-weight: normal;
  margin-left: 2px;
}

.filter-pill:hover {
  background: #43306c;
  border-color: #43306c;
  color: #ffffff;
}

.filter-pill:hover svg {
  fill: #ffffff;
}

.filter-pill--open {
  background: #43306c;
  border-color: #43306c;
  color: #ffffff;
}

.filter-pill--open svg {
  fill: #ffffff;
  transform: translateY(2px);
  opacity: 1;
}

/* Inactive pill state - matches default filter pill style */
.filter-pill.inactive {
  background: #ffffff;
  border: 1px solid #dee2e6; /* Same as default filter pill */
  color: #495057; /* Same as default filter pill */
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.filter-pill.inactive:hover {
  background: #43306c;
  border-color: #43306c;
  color: #ffffff;
}

.filter-pill.inactive:hover svg {
  fill: #ffffff;
}


.search-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99999999999;
  overflow: hidden;
  overscroll-behavior: contain;
}
@supports (height: 100dvh) {
  .search-modal {
    height: 100dvh;
    min-height: 100dvh;
  }
}
.search-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}
.modal-header h3 {
  margin: 0;
  font-size: 20px;
  color: #333;
  font-weight: 600;
}
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.clear-all-btn {
  height: 32px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  color: #495057;
  padding: 0 12px;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  font-weight: 600;
}
.clear-all-btn svg {
  width: 16px;
  height: 16px;
  min-width: 16px;
  color: #495057;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.clear-all-btn:hover {
  background: #f8f9fa;
  border-color: #dee2e6;
  color: #dc3545;
}
.clear-all-btn:hover svg {
  transform: scale(1.1);
  color: #dc3545;
}
/* Specific sizing for modal close button */
.modal-header .close-modal {
  width: 32px;
  height: 32px;
}
.form-group {
  margin-bottom: 16px;
}
.form-group .field-row {
  display: flex;
  gap: 16px;
  align-items: center;
}
.form-group .field-row label {
  min-width: 100px;
  color: #333;
  font-weight: 600;
  font-size: 16px;
}
.form-group .field-row label span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.form-group .field-row label .help-button {
  width: 18px;
  height: 18px;
  font-size: 12px;
  margin-top: 0;
}
.input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  width: 50%;
  max-width: 50%;
}
.input-wrapper input,
.input-wrapper select,
.form-group .contains-input-wrapper input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 7px;
  font-size: 14px;
  color: #333;
  background: #fff;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.form-group.contains-field .field-row {
  align-items: flex-start;
}

.form-group.contains-field .field-row > label {
  margin-top: 17px;
}

.input-wrapper input:focus,
.input-wrapper select:focus,
.contains-input-wrapper input[type="text"]:focus {
  outline: none;
  border-color: #43306c;
  box-shadow: 0 0 0 3px rgba(67, 48, 108, 0.1);
}
.input-wrapper input:hover,
.input-wrapper select:hover,
.contains-input-wrapper input[type="text"]:hover {
  border-color: #43306c;
}
.help-button {
  position: static;
  width: 16px;
  height: 16px;
  font-size: 10px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1px solid #ccc;
  background: #fff;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.help-button:hover,
.help-button:active {
  background: #b8b8b8;
  border-color: #b8b8b8;
  color: #fff;
}

.help-button:focus {
  background: #fff;
  border-color: #ccc;
  color: #666;
}

.match-options,
.dictionary-options {
  display: flex;
  gap: 8px;
  flex: 1;
}

/* Common button styles for both match and dictionary options */
.match-option,
.dictionary-option {
  flex: 1;
  padding: 8px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  color: #495057;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  font-weight: 600;
}

/* Common hover state */
.match-option:hover,
.dictionary-option:hover,
.match-type-options .dictionary-option:hover,
.match-type-options .match-option:hover {
  background: #b8b8b8;
  border-color: #b8b8b8;
  color: #ffffff;
}

/* Common active state */
.match-option.active,
.dictionary-option.active,
.match-option.active:hover,
.dictionary-option.active:hover,
.search-filters-wrapper .match-option.active,
.search-filters-wrapper .dictionary-option.active,
.search-filters-wrapper .match-option.active:hover,
.search-filters-wrapper .dictionary-option.active:hover,
.match-type-options .dictionary-option.active,
.match-type-options .match-option.active,
.match-type-options .dictionary-option.active:hover,
.match-type-options .match-option.active:hover {
  background: #b8b8b8;
  border-color: #b8b8b8;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(184, 184, 184, 0.2);
}

/* Remove any conflicting styles */
.match-type-options .dictionary-option.active {
  background: #b8b8b8;
  border-color: #b8b8b8;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(184, 184, 184, 0.2);
}

.match-type-options .dictionary-option,
.match-type-options .match-option {
  flex: 1;
  padding: 8px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  color: #495057;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  font-weight: 600;
}

.dictionary-type {
  margin-top: -1px;
}

.length-with-dictionary {
  margin-bottom: 18px;
}
.length-with-dictionary {
  border: 1px solid #e9ecef;
  padding: 16px;
  border-radius: 8px;
  position: relative;
}
.form-group.length-with-dictionary .field-row::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -1px;
  right: -1px;
  height: 1px;
  background: #e9ecef;
  background: linear-gradient(
    to right,
    #e9ecef 4px,
    transparent 4px,
    transparent 8px
  );
  background-size: 8px 1px;
}
.sort-group select {
  width: 100%;
  appearance: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 9L1 4h10L6 9z' fill='%23666'/%3E%3C/svg%3E")
    no-repeat;
  background-position: right 12px center;
  background-color: #fff;
}
.find-words-btn {
  width: 100%;
  padding: 12px;
  background: #43306c;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 2px 4px rgba(67, 48, 108, 0.2);
  position: relative;
  min-height: 48px;
}
@media (min-width: 768px) {
  .find-words-btn {
    position: relative;
    bottom: auto;
    z-index: 2;
  }
}

.find-words-btn:disabled {
  opacity: 0.8;
  cursor: wait;
}
.find-words-btn .button-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.find-words-btn .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.find-words-btn:hover {
  background: #372658;
  box-shadow: 0 4px 6px rgba(67, 48, 108, 0.25);
  transform: translateY(-1px);
}
.find-words-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(67, 48, 108, 0.2);
}
.find-words-btn.loading:hover {
  transform: none;
  box-shadow: 0 2px 4px rgba(67, 48, 108, 0.2);
}
@media (max-width: 768px) {
  /* MOBILE: Default - let filters wrap naturally */
  .filters-scroll-inner {
    white-space: normal !important;
    flex-wrap: wrap !important;
  }
  
  /* Hide scroll arrows by default on mobile */
  .scroll-arrow {
    display: none !important;
  }
  .search-modal:not(.popover-mode) {
    /* Use viewport height for proper keyboard handling */
    height: 100vh;
    height: -webkit-fill-available;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overscroll-behavior: none;
  }
  @supports (height: 100dvh) {
    .search-modal:not(.popover-mode) {
      height: 100dvh;
      min-height: 100dvh;
    }
  }
  .search-modal:not(.popover-mode).active {
    align-items: stretch;
    justify-content: flex-start;
  }
  .search-modal .modal-content {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
  }
  /* Add new modal-body wrapper */
  .search-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
  }
  /* On mobile full modal, keep submit button in normal flow for stability */
  .search-modal:not(.popover-mode) .find-words-btn {
    position: static;
    width: 100%;
    left: auto;
    right: auto;
    bottom: auto;
    margin-top: 16px;
  }
  /* Keep original button styling when keyboard is not open */
  .find-words-btn {
    position: fixed;
    bottom: 10px;
    left: 10px;
    right: 10px;
    margin: 0;
    border-radius: 7px;
    z-index: 10000001;
    width: calc(100% - 20px);
    transition: bottom 0.3s ease;
  }
  .field-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .field-row label {
    min-width: 80px;
  }
  .input-wrapper {
    max-width: 100%;
    width: 100%;
  }
  .scroll-arrow {
    display: none !important;
  }
  .filters-scroll-inner {
    padding-right: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .input-wrapper input,
  .input-wrapper select,
  .form-group .field-row label {
    font-size: 16px;
  }

  .form-group .field-row label .help-button {
    width: 20px;
    height: 20px;
    font-size: 13px;
  }

  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

}
.match-type {
  margin-top: -1px;
}
.match-type .field-row {
  padding: 16px;
  border: 1px solid #e9ecef;
  border-radius: 0 0 7px 7px;
  border-top: 0;
  position: relative;
}
.match-type .field-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: -1px;
  right: -1px;
  height: 1px;
  background: #e9ecef;
  background: linear-gradient(
    to right,
    #e9ecef 4px,
    transparent 4px,
    transparent 8px
  );
  background-size: 8px 1px;
}
.match-type .field-row label {
  display: flex;
}
.match-type .match-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.match-type .match-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #495057;
  cursor: pointer;
  font-weight: normal;
  margin: 0;
}
.match-type .match-options input[type="radio"] {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #ced4da;
  border-radius: 50%;
  outline: none;
  position: relative;
}
.match-type .match-options input[type="radio"]:checked {
  border-color: #43306c;
}
.match-type .match-options input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background-color: #43306c;
  border-radius: 50%;
}
.form-group.contains-with-match {
  margin-bottom: 0;
}
.form-group.contains-with-match .field-row {
  border: 1px solid #e9ecef;
  padding: 16px;
  border-radius: 7px 7px 0 0;
  border-bottom: 0;
  position: relative;
}
.form-group.contains-with-match .field-row::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -1px;
  right: -1px;
  height: 1px;
  background: #e9ecef;
  background: linear-gradient(
    to right,
    #e9ecef 4px,
    transparent 4px,
    transparent 8px
  );
  background-size: 8px 1px;
}
.form-group:not(.contains-with-match):not(.length-with-dictionary) .field-row {
  padding: 0;
  border: none;
}
.form-group.match-type:not(.hidden) + .form-group {
  margin-top: 16px;
}
.input-wrapper select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 7px;
  font-size: 14px;
  color: #333;
  background: #fff;
  appearance: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 9L1 4h10L6 9z' fill='%23666'/%3E%3C/svg%3E")
    no-repeat;
  background-position: right 12px center;
  background-color: #fff;
  padding-right: 32px;
}
.hidden {
  display: none !important;
}
.contains-match-group {
  margin-bottom: 16px;
}
.contains-match-group.has-value {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 16px;
}
.contains-match-group .form-group {
  margin-bottom: 16px;
}
.contains-match-group .form-group:last-child {
  margin-bottom: 0;
}
.contains-match-group .field-row {
  padding: 0;
  border: none;
}
.form-group.contains-with-match .field-row {
  border: none;
  padding: 0;
}
.form-group.contains-with-match .field-row::after {
  display: none;
}
.match-type .field-row {
  border: none;
  padding: 0;
}
.match-type .field-row::before {
  display: none;
}
.form-group.contains-with-match,
.form-group.contains-with-match .field-row,
.form-group.contains-with-match .field-row::after,
.match-type .field-row,
.match-type .field-row::before {
  border: none;
  padding: 0;
}
.form-group.contains-with-match .field-row::after,
.match-type .field-row::before {
  display: none;
}
.unscramble-field {
  margin-bottom: 32px;
}
.unscramble-field .required {
  color: #e53935;
  margin-left: 4px;
}
.unscramble-field .field-row label {
  font-weight: bold;
}
.unscramble-field .input-wrapper {
  width: 100%;
  max-width: 100%;
}

.unscramble-field .input-wrapper input {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.additional-filters-container {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}
.additional-filters-container .form-group:first-child {
  margin-top: 0;
}
.additional-filters-container .form-group:last-child {
  margin-bottom: 0;
}
.help-button {
  position: static;
  width: 16px;
  height: 16px;
  font-size: 10px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1px solid #ccc;
  background: #fff;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.help-button[data-tooltip] {
  position: relative;
}

.help-button[data-tooltip]::after,
.help-button[data-tooltip]::before {
  display: none;
}

@media (max-width: 768px) {
  .help-button[data-tooltip]::after,
  .help-button[data-tooltip]::before {
    display: block;
  }

  .help-button[data-tooltip]::after {
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 160px;
    white-space: normal;
    word-break: break-word;
    z-index: 9999999999999;
  }

  .help-button[data-tooltip]::before {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom: none;
    border-top-color: #333;
    z-index: 9999999999999;
  }

  /* Add positioning logic to prevent tooltip cutoff */
  .field-row label:first-child .help-button[data-tooltip]::after {
    left: 0;
    transform: none;
  }

  .field-row label:first-child .help-button[data-tooltip]::before {
    left: 10px;
    transform: none;
  }

  .field-row {
    position: relative;
    overflow: visible;
  }

  .form-group {
    position: relative;
    overflow: visible;
  }
}

.help-button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 9999999999999;
  padding: 8px 12px;
  background: #333;
  color: white;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 200px;
  width: max-content;
}

.help-button[data-tooltip]::before {
  content: "";
  position: absolute;
  z-index: 9999999999999;
  border: 5px solid transparent;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-bottom: none;
  border-top-color: #333;
}

@media (max-width: 768px) {
  .help-button[data-tooltip]::after {
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 160px;
    white-space: normal;
    word-break: break-word;
  }

  .help-button[data-tooltip]::before {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom: none;
    border-top-color: #333;
  }

  .field-row {
    position: relative;
    overflow: visible;
  }

  .form-group {
    position: relative;
    overflow: visible;
  }
}

.help-button[data-tooltip]:hover::after,
.help-button[data-tooltip]:hover::before,
.help-button[data-tooltip]:active::after,
.help-button[data-tooltip]:active::before,
.help-button[data-tooltip]:focus::after,
.help-button[data-tooltip]:focus::before {
  opacity: 1;
  visibility: visible;
}

.input-wrapper input::placeholder {
  color: #9ca3af;
  font-size: 0.95em;
  font-style: italic;
}

.contains-match-group.variant-dropdown .input-with-dropdown {
  display: flex;
  position: relative;
  width: 50%;
  border: 1px solid #ccc;
  border-radius: 7px;
}

@media (max-width: 768px) {
  .contains-match-group.variant-dropdown .input-with-dropdown {
    width: 100%;
  }
}

.contains-match-group.variant-dropdown .match-type-select {
  position: relative;
  min-width: 120px;
  z-index: 1001;
}

.contains-match-group.variant-dropdown .dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 12px;
  background: #f8f9fa;
  border: none;
  border-radius: 0 7px 7px 0;
  font-size: 14px;
  color: #495057;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.contains-match-group.variant-dropdown .dropdown-toggle svg {
  fill: #495057;
  margin-left: 4px;
  transition: transform 0.2s ease;
}

.contains-match-group.variant-dropdown
  .match-type-select.active
  .dropdown-toggle
  svg {
  transform: rotate(180deg);
}

.contains-match-group.variant-dropdown .dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: none;
  z-index: 1001;
}

.contains-match-group.variant-dropdown
  .match-type-select.active
  .dropdown-menu {
  display: block;
}

.contains-match-group.variant-dropdown .dropdown-item {
  padding: 8px 12px;
  font-size: 14px;
  color: #495057;
  cursor: pointer;
}

.contains-match-group.variant-dropdown .dropdown-item:hover {
  background: #f8f9fa;
}

.contains-match-group.variant-dropdown .input-with-dropdown input[type="text"] {
  flex: 1;
  border: none;
  padding: 11px 12px;
  font-size: 14px;
  color: #495057;
  border-left: 1px solid #ccc;
  border-radius: 0 7px 7px 0;
}

.contains-match-group.variant-dropdown input[type="text"]:focus {
  outline: none;
}

.contains-match-group.variant-dropdown .input-with-dropdown:focus-within {
  border-color: #43306c;
  box-shadow: 0 0 0 3px rgba(67, 48, 108, 0.1);
}

@media (max-width: 768px) {
  .contains-match-group.variant-dropdown .match-type-select {
    min-width: 90px;
    width: 90px;
  }

  .contains-match-group.variant-dropdown .dropdown-toggle {
    padding: 8px 6px;
    font-size: 13px;
  }

  .contains-match-group.variant-dropdown .dropdown-menu {
    min-width: 120px;
    width: max-content;
  }

  .contains-match-group.variant-dropdown input[type="text"] {
    flex: 1;
    min-width: 0;
    width: 100%;
  }

  .contains-match-group.variant-dropdown .input-with-dropdown {
    display: flex;
    flex-wrap: nowrap;
  }

  .contains-match-group.variant-dropdown .dropdown-item {
    padding: 8px 6px;
    font-size: 13px;
  }
}

.match-type-options {
  margin-bottom: 16px;
}

.match-type-options .field-row {
  padding: 16px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  position: relative;
}

.match-type-options .dictionary-options {
  display: flex;
  gap: 8px;
  flex: 1;
}

.match-type-options.hidden {
  display: none;
}

.form-group:not(.match-type-options) {
  display: block;
}

.search-modal.popover-mode {
  background: transparent;
  overflow: visible;
}

.search-modal.popover-mode.active {
  align-items: flex-start;
  justify-content: flex-start;
}

.search-modal.popover-mode .modal-content {
  position: fixed;
  top: var(--popover-top, 80px);
  left: var(--popover-left, 16px);
  width: var(--popover-width, min(340px, calc(100vw - 32px)));
  max-height: min(460px, calc(100vh - 32px));
  height: auto;
  overflow: auto;
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(30, 16, 62, 0.18);
  padding: 16px;
  transform: none;
  display: block;
}

.search-modal.popover-mode .modal-header,
.search-modal.popover-mode .clear-all-btn,
.search-modal.popover-mode .modal-header-actions,
.search-modal.popover-mode .close-modal {
  display: none;
}

.search-modal.popover-mode .modal-body {
  padding: 0;
  flex: initial;
  overflow: auto;
}

.search-modal.popover-mode.popover-requires-submit .modal-body {
  padding-bottom: 16px;
}

.search-modal.popover-mode .search-form {
  padding: 0;
}

.search-modal.popover-mode .find-words-btn {
  display: none;
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  width: 100%;
}

.search-modal.popover-mode.popover-requires-submit .find-words-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  position: static;
}

.search-modal.popover-mode.popover-requires-submit .find-words-btn .button-content {
  justify-content: center;
}

.search-modal.popover-mode .form-group {
  margin-top: 8px;
}

.search-modal.popover-mode .form-group:first-child {
  margin-top: 0;
}

.search-modal.popover-mode .form-group + .form-group {
  margin-top: 8px;
}

.search-modal.popover-mode .form-group .field-row {
  gap: 0;
  align-items: stretch;
}

.search-modal.popover-mode .form-group .field-row > label:not(.points-label) {
  display: none;
}

.search-modal.popover-mode .input-wrapper,
.search-modal.popover-mode .contains-input-wrapper,
.search-modal.popover-mode .length-input-wrapper {
  width: 100%;
  max-width: 100%;
}

.search-modal.popover-mode .wr-custom-options {
  display: none;
}

.search-modal.popover-mode .wr-custom-options.wr-custom-options--active {
  display: flex;
  width: 100%;
}

.search-modal.popover-mode[data-popover-field="length"] .form-group.length-field select,
.search-modal.popover-mode[data-popover-field="dictionary"] .form-group.dictionary-type select,
.search-modal.popover-mode select.wr-native-select-hidden {
  display: none;
}

.search-modal.popover-mode[data-popover-field="length"] .form-group.length-field .wr-custom-options,
.search-modal.popover-mode[data-popover-field="dictionary"] .form-group.dictionary-type .wr-custom-options,
.search-modal.popover-mode[data-popover-field="word_set"] .form-group.word-set-group .word-set-options {
  flex-direction: column;
  gap: 0;
  max-height: none;
  overflow: visible;
  border: 1px solid #d9dde3;
  border-radius: 8px;
  background: #ffffff;
  padding: 2px 0;
}

.search-modal.popover-mode[data-popover-field="length"] .wr-custom-options label.match-option,
.search-modal.popover-mode[data-popover-field="dictionary"] .wr-custom-options label.match-option,
.search-modal.popover-mode[data-popover-field="word_set"] .word-set-options label.match-option {
  margin: 0;
  padding: 8px 10px;
  min-height: 38px;
  font-size: 13px;
  line-height: 1.25;
  border: 0;
  border-bottom: 1px solid #eceff3;
  border-radius: 0;
  background: transparent;
  color: #313840;
  font-weight: 500;
  box-shadow: none;
}

.search-modal.popover-mode[data-popover-field="length"] .wr-custom-options label.match-option:last-child,
.search-modal.popover-mode[data-popover-field="dictionary"] .wr-custom-options label.match-option:last-child,
.search-modal.popover-mode[data-popover-field="word_set"] .word-set-options label.match-option:last-child {
  border-bottom: 0;
}

.search-modal.popover-mode[data-popover-field="length"] .wr-custom-options label.match-option:hover,
.search-modal.popover-mode[data-popover-field="dictionary"] .wr-custom-options label.match-option:hover,
.search-modal.popover-mode[data-popover-field="word_set"] .word-set-options label.match-option:hover {
  background: #f6f8fb;
  color: #1f252b;
}

.search-modal.popover-mode[data-popover-field="length"] .wr-custom-options label.match-option.active,
.search-modal.popover-mode[data-popover-field="dictionary"] .wr-custom-options label.match-option.active,
.search-modal.popover-mode[data-popover-field="word_set"] .word-set-options label.match-option.active {
  background: #f0ebfa;
  color: #2f2250;
  border-color: #e5ddf6;
  box-shadow: none;
}

.search-modal.popover-mode[data-popover-field="length"] .wr-custom-options input[type="radio"],
.search-modal.popover-mode[data-popover-field="dictionary"] .wr-custom-options input[type="radio"],
.search-modal.popover-mode[data-popover-field="word_set"] .word-set-options input[type="radio"] {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.search-modal.popover-mode[data-popover-field="length"] .wr-custom-options input[type="radio"]:checked::after,
.search-modal.popover-mode[data-popover-field="dictionary"] .wr-custom-options input[type="radio"]:checked::after,
.search-modal.popover-mode[data-popover-field="word_set"] .word-set-options input[type="radio"]:checked::after {
  width: 8px;
  height: 8px;
}

@media (max-width: 768px) {
  .search-modal.popover-mode[data-popover-field="length"] .wr-custom-options label.match-option,
  .search-modal.popover-mode[data-popover-field="dictionary"] .wr-custom-options label.match-option,
  .search-modal.popover-mode[data-popover-field="word_set"] .word-set-options label.match-option {
    padding: 10px 12px;
    min-height: 42px;
    font-size: 14px;
    line-height: 1.3;
  }
}

.search-modal input[type="text"] {
  text-transform: uppercase;
}

.search-modal .modal-content input[type="text"] {
  text-transform: uppercase !important;
}

.contains-input-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 50%;
}

.contains-input-wrapper .match-options,
.length-input-wrapper .match-options,
.word-set-options {
  display: flex;
  flex-direction: column;
  padding: 8px 6px;
  background: #fff;
}

.contains-input-wrapper .match-options label,
.length-input-wrapper .match-options label,
.word-set-options label {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 14px;
  color: #495057;
  cursor: pointer;
  font-weight: normal;
  margin: 4px 0;
  min-width: auto;
  position: relative;
}

.contains-input-wrapper .match-options input[type="radio"],
.length-input-wrapper .match-options input[type="radio"],
.word-set-options input[type="radio"] {
  margin: 0 2px 0 0;
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #ced4da;
  border-radius: 50%;
  outline: none;
  position: relative;
  cursor: pointer;
  z-index: 2;
  transition: border-color 0.2s ease;
}

.contains-input-wrapper .match-options input[type="radio"]:checked,
.length-input-wrapper .match-options input[type="radio"]:checked,
.word-set-options input[type="radio"]:checked {
  border-color: #43306c;
  background-color: #fff;
}

.contains-input-wrapper .match-options input[type="radio"]:checked::after,
.length-input-wrapper .match-options input[type="radio"]:checked::after,
.word-set-options input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background-color: #43306c;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.contains-input-wrapper .match-options b,
.length-input-wrapper .match-options b,
.word-set-options b {
  margin: 0 2px;
}

/* Word-set radios use the same bordered layout as Contains radios via .match-option */

@media (max-width: 768px) {
  .contains-input-wrapper,
  .length-input-wrapper {
    width: 100%;
  }
}

.length-input-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 50%;
}

.length-input-wrapper select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 7px;
  font-size: 14px;
  color: #333;
  background: #fff;
  appearance: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 9L1 4h10L6 9z' fill='%23666'/%3E%3C/svg%3E") no-repeat;
  background-position: right 12px center;
  background-color: #fff;
  padding-right: 32px;
}

.length-input-wrapper .dictionary-options {
  display: flex;
  padding: 8px 12px;
  background: #fff;
  gap: 8px;
}

@media (max-width: 768px) {
  .length-input-wrapper {
    width: 100%;
  }
}

/* Custom styling for the Scrabble points checkbox */
.form-group.show-points-group .field-row .points-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  color: #495057;
  cursor: pointer;
  font-weight: normal;
  margin: 0;
  min-width: 100%;
}

.form-group.show-points-group .field-row .points-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #ced4da;
  border-radius: 4px;
  background-color: #fff;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.form-group.show-points-group .field-row .points-checkbox:checked {
  border-color: #43306c;
  background-color: #43306c;
}

/* Hide legacy Wordle/All radios inside Length selector (now controlled by Dictionary pill) */
.length-input-wrapper .dictionary-options {
  display: none !important;
}

.form-group.show-points-group .field-row .points-checkbox:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
}

.form-group.show-points-group .field-row .points-checkbox:hover {
  border-color: #43306c;
}

.form-group.show-points-group .field-row .points-checkbox:hover {
  border-color: #43306c;
}

.match-options.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.match-options.disabled label {
  color: #999;
  cursor: not-allowed;
}

.match-options.disabled input[type="radio"] {
  border-color: #ccc;
  cursor: not-allowed;
}

.match-options.disabled input[type="radio"]:disabled {
  opacity: 0.6;
}

/* Clear field button positioning - moved to variant section at end of file */

.input-wrapper {
  position: relative;
}

.input-wrapper input[type="text"] {
  padding-right: 30px;
}

/* Position already defined in base .clear-field-btn class */

/* Inline Sort Styles */
.list-header .header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.list-header .header-text {
  flex: 1;
  /* Keep original styling - no changes to font size, weight, color */
}

.list-header .header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inline-sort-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-sort-container label {
  font-size: 16px;
  font-weight: 600;
  color: #666;
  white-space: nowrap;
}

.inline-sort-select {
  padding: 8px 22px 8px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  color: #333;
  background: #fff;
  min-width: 80px;
  width: 90px;
  cursor: pointer;
  transition: border-color 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 9L1 4h10L6 9z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

.inline-sort-select:hover {
  border-color: #43306c;
}

.inline-sort-select:focus {
  outline: none;
  border-color: #43306c;
  box-shadow: 0 0 0 3px rgba(67, 48, 108, 0.1);
}

.toggle-list {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.toggle-list:hover {
  border-color: #43306c;
  background-color: #f8f9fa;
}

.toggle-list svg {
  transition: transform 0.2s ease;
}

.toggle-list.collapsed svg {
  transform: rotate(180deg);
}

@media (max-width: 768px) {
  .list-header .header-content {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  
  .list-header .header-controls {
    flex-shrink: 0;
  }
  
  .inline-sort-container {
    gap: 4px;
  }
  
  .inline-sort-container label {
    font-size: 15px;
  }
  
  .inline-sort-select {
    min-width: 95px;
    width: 75px;
    font-size: 14px;
    padding: 4px 18px 4px 5px;
    background-position: right 5px center;
  }
}

/* ========================================================================
   VARIANT-SPECIFIC STYLES
   Previously in class-scs-search-filters-variants.css
   ======================================================================== */

/* Base variant containers */
.search-filters-wrapper:not(.variant-original) .filters-container {
  padding: 0 0 7px 0;
  border-radius: 20px;
  background: transparent;
}

/* Hamburger variant */
.search-filters-wrapper.variant-hamburger .menu-button {
  width: 40px;
  height: 40px;
  padding: 8px;
  background: #43306c;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-filters-wrapper.variant-hamburger .menu-button svg {
  fill: #fff;
  width: 24px;
  height: 24px;
}

/* Edit search, filter, and square edit button variants */
.search-filters-wrapper.variant-edit_search .edit-search-button,
.search-filters-wrapper.variant-filter .filter-button,
.search-filters-wrapper.variant-square_edit .square-edit-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  background: #43306c;
  border: none;
  border-radius: 20px;
  font-size: 19px;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.search-filters-wrapper.variant-filter .filter-button svg,
.search-filters-wrapper.variant-edit_search .edit-search-button svg,
.search-filters-wrapper.variant-square_edit .square-edit-button svg {
  fill: #fff;
  width: 20px;
  height: 20px;
  margin: 0;
}

/* Common hover states for variant buttons */
.search-filters-wrapper [class*="variant-"] button:hover {
  opacity: 0.9;
}

/* Filters scroll container adjustments for variants */
.search-filters-wrapper.variant-hamburger .filters-scroll-container,
.search-filters-wrapper.variant-filter .filters-scroll-container,
.search-filters-wrapper.variant-edit_search .filters-scroll-container,
.search-filters-wrapper.variant-square_edit .filters-scroll-container {
  margin-top: 8px;
}

/* Non-original variant filter pills */
.filters-container:not(.variant-original) .filter-pill {
  font-size: 15px;
  padding: 4px 5px;
  transition: background-color 0.2s ease;
  border-color: #362656;
}

.filters-container:not(.variant-original) .filter-pill:hover {
  background-color: #b8b8b8;
  border-color: #b8b8b8;
  color: #ffffff;
  cursor: pointer;
}

/* Filter pill spacing */
.filters-container .filters-scroll-inner:not(:first-of-type),
.filters-container:not(.variant-default) .filters-scroll-inner:not(:first-of-type) {
  margin-left: 8px;
}

/* Square edit variant specific styles */
.search-filters-wrapper.variant-square_edit .filters-scroll-container {
  flex-direction: column;
  align-items: flex-start;
}

.search-filters-wrapper.variant-square_edit .square-edit-button {
  margin-bottom: 8px;
}

.search-filters-wrapper.variant-square_edit .filters-scroll-inner {
  margin-left: 0;
}

/* Filters all visible layout */
.filters-all-visible {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 8px;
  padding: 0;
  min-height: 40px;
  align-content: flex-start;
}

.filters-all-visible .filter-pill {
  margin-bottom: 0;
}

/* Applied filter pills in all visible layout */
.filters-all-visible .filter-pill.applied {
  background: #43306c;
  color: #fff;
  border-color: #43306c;
}


.filters-all-visible .filter-pill.applied:hover {
  background: #362656;
  border-color: #362656;
  color: #fff;
}

/* ========================================================================
   FIXED SINGLE-LINE BAR
   ======================================================================== */

/* CSS custom property for dynamic height */
:root {
  --filters-bar-h: 60px; /* Default, updated by JS */
}

/* Fixed single-line bar */
.filters-single {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
  transition: opacity 0.2s ease, transform 0.2s ease;
  will-change: transform;
  backface-visibility: hidden; /* iOS Safari fix */
}

/* When visible */
.filters-single--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Remove inert when visible */
.filters-single--visible[inert] {
  inert: auto;
}

/* Force single-line with scroll hint */
.filters-single .filters-all-visible {
  flex-wrap: nowrap !important;
  overflow-x: auto;
  padding: 12px 15px;
  margin: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
}

.filters-single .filters-all-visible::-webkit-scrollbar {
  display: none;
}

.filters-single .filters-all-visible .filter-pill {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Only on desktop */
@media (min-width: 769px) {
  .filters-single:not(.js-force-show) {
    display: none;
  }
}

/* ========================================================================
   VARIANT-SPECIFIC MOBILE ADJUSTMENTS
   ======================================================================== */

@media (max-width: 768px) {
  .search-filters-wrapper [class*="variant-"] .filters-scroll-container {
    margin-top: 12px;
  }
  
  .search-filters-wrapper:not(.variant-original) .filters-container {
    margin-right: -15px;
    width: calc(100% + 15px);
  }
  
  /* Default: Allow wrapping on mobile */
  .filters-all-visible {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
  }
}

/* ========================================================================
   CLEAR BUTTON VARIANT POSITIONING
   Note: Visual styles are inherited from base button styles above
   ======================================================================== */

/* Clear button positioning for all variants */
.search-filters-wrapper .clear-field-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  z-index: 5;
}

/* Ensure input wrapper is positioned correctly for clear buttons */
.search-filters-wrapper .input-wrapper {
  position: relative;
}

/* Special positioning for contains field clear button */
.search-filters-wrapper .contains-input-wrapper .clear-field-btn {
  right: 16px;
  transform: translateY(-50%);
}

.search-filters-wrapper .contains-input-wrapper {
  position: relative;
}

/* Mobile accessibility: keep tappable size on smaller screens */
@media (max-width: 768px) {
  .filter-pill {
    font-size: 14px;
    min-height: 36px;
    padding: 6px 12px 6px 20px;
    border-radius: 18px;
  }
  .filter-pill svg {
    width: 12px !important;
    height: 12px !important;
    min-width: 12px;
    min-height: 12px;
    margin-left: 8px;
  }
}

.filter-pill.priority-pill {
  background: #000 !important;
  color: #fff !important;
  border-color: #000 !important;
}
