/* Wellness Expert Search Form, Branded Catalog Selects & Theme Pagination (v1.0.4) */

/* --------------------------------------------------------------------------
 * 1. Global Pagination: replace default Bootstrap 3 blue (#337ab7) with
 *    Cosyone3 warm gold/cream storefront palette across all paginated pages.
 * -------------------------------------------------------------------------- */
body.cosyone3-theme .pagination {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 22px 0 12px;
  padding: 0;
  border-radius: 0;
}
body.cosyone3-theme .pagination > li {
  display: inline-flex;
}
body.cosyone3-theme .pagination > li > a,
body.cosyone3-theme .pagination > li > span {
  position: relative;
  float: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  margin-left: 0;
  padding: 0 11px;
  color: var(--cosy-secondary, #80620b);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  background-color: #fff;
  border: 1px solid #dfd3bc;
  border-radius: 6px !important;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
body.cosyone3-theme .pagination > li > a:hover,
body.cosyone3-theme .pagination > li > span:hover,
body.cosyone3-theme .pagination > li > a:focus,
body.cosyone3-theme .pagination > li > span:focus {
  z-index: 2;
  color: var(--cosy-ink, #30291f);
  background-color: var(--cosy-bg, #fffaf0);
  border-color: var(--cosy-accent, #b18a13);
}
body.cosyone3-theme .pagination > .active > a,
body.cosyone3-theme .pagination > .active > span,
body.cosyone3-theme .pagination > .active > a:hover,
body.cosyone3-theme .pagination > .active > span:hover,
body.cosyone3-theme .pagination > .active > a:focus,
body.cosyone3-theme .pagination > .active > span:focus {
  z-index: 3;
  color: var(--cosy-action-text, #fff);
  font-weight: 600;
  background-color: var(--cosy-gold-button, #b18a13);
  border-color: var(--cosy-gold-button, #b18a13);
  cursor: default;
}
body.cosyone3-theme .pagination > .disabled > a,
body.cosyone3-theme .pagination > .disabled > span,
body.cosyone3-theme .pagination > .disabled > a:hover,
body.cosyone3-theme .pagination > .disabled > span:hover {
  color: #a59c8d;
  background-color: #faf7f0;
  border-color: #ebe3d2;
  cursor: not-allowed;
}

@media (max-width: 767px) {
  body.cosyone3-theme #content .pagination {
    justify-content: center;
  }
  body.cosyone3-theme #content .col-sm-6.text-left:has(.pagination) {
    text-align: center;
  }
  body.cosyone3-theme #content .col-sm-6.text-left:has(.pagination) + .col-sm-6.text-right {
    margin-top: 8px;
    text-align: center;
    color: var(--cosy-muted, #716757);
  }
}

/* --------------------------------------------------------------------------
 * 2. Search Criteria Card (#product-search) — aligned 44px controls, 0 CLS.
 *    Uses CSS Grid + display:contents on native Bootstrap .row so zero Twig
 *    lines are replaced and all OpenCart IDs/handlers remain untouched.
 * -------------------------------------------------------------------------- */
body.cosyone3-theme #product-search .we-search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px) auto;
  gap: 12px;
  align-items: center;
  margin: 14px 0 26px;
  padding: 18px 20px 16px;
  background: var(--cosy-bg, #fffaf0);
  border: 1px solid var(--cosy-line, #ebddb5);
  border-radius: 8px;
}
body.cosyone3-theme #product-search .we-search-panel > label.control-label {
  grid-column: 1 / -1;
  grid-row: 1;
  display: block;
  margin: 0 0 -2px;
  color: var(--cosy-muted, #716757);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
}
body.cosyone3-theme #product-search .we-search-panel > .row {
  display: contents;
  margin: 0;
}
body.cosyone3-theme #product-search .we-search-panel > .row::before,
body.cosyone3-theme #product-search .we-search-panel > .row::after {
  display: none !important;
  content: none !important;
}
body.cosyone3-theme #product-search .we-search-panel > .row > div {
  float: none;
  width: auto;
  min-width: 0;
  padding: 0;
}
body.cosyone3-theme #product-search .we-search-panel > .row > div:nth-child(1) {
  grid-column: 1;
  grid-row: 2;
}
body.cosyone3-theme #product-search .we-search-panel > .row > div:nth-child(2) {
  grid-column: 2;
  grid-row: 2;
}
body.cosyone3-theme #product-search .we-search-panel > .row > div:nth-child(3) {
  grid-column: 1;
  grid-row: 3;
  margin-right: -12px;
  padding-top: 10px;
  padding-right: 12px;
  border-top: 1px solid rgba(213, 199, 173, .55);
}
body.cosyone3-theme #product-search .we-search-panel > p {
  grid-column: 2 / -1;
  grid-row: 3;
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid rgba(213, 199, 173, .55);
}
body.cosyone3-theme #product-search #input-search {
  width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 9px 14px;
  color: var(--cosy-ink, #30291f);
  font-size: 14px;
  background: #fff;
  border: 1px solid #d5c7ad;
  border-radius: 6px;
  box-shadow: none;
}
body.cosyone3-theme #product-search #input-search:focus {
  border-color: var(--cosy-accent, #b18a13);
  box-shadow: 0 0 0 2px rgba(146, 114, 20, .14);
}
body.cosyone3-theme #product-search #button-search {
  grid-column: 3;
  grid-row: 2;
  height: 44px;
  min-height: 44px;
  padding: 0 28px;
  font-size: 14px;
  font-weight: 600;
  line-height: 42px;
  border-radius: 6px;
}
body.cosyone3-theme #product-search .we-search-panel label.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  color: var(--cosy-ink, #30291f);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.35;
  cursor: pointer;
}
body.cosyone3-theme #product-search .we-search-panel label.checkbox-inline input[type="checkbox"] {
  position: static;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--cosy-gold-button, #b18a13);
  cursor: pointer;
}
body.cosyone3-theme #product-search .we-search-panel label.checkbox-inline.is-disabled,
body.cosyone3-theme #product-search .we-search-panel label.checkbox-inline:has(input:disabled) {
  color: #8c8273;
  opacity: .72;
  cursor: not-allowed;
}
body.cosyone3-theme #product-search .we-search-panel label.checkbox-inline input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

@media (max-width: 767px) {
  body.cosyone3-theme #product-search .we-search-panel {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px 14px 12px;
  }
  body.cosyone3-theme #product-search .we-search-panel > label.control-label {
    grid-column: 1;
    grid-row: 1;
  }
  body.cosyone3-theme #product-search .we-search-panel > .row > div:nth-child(1) {
    grid-column: 1;
    grid-row: 2;
  }
  body.cosyone3-theme #product-search .we-search-panel > .row > div:nth-child(2) {
    grid-column: 1;
    grid-row: 3;
  }
  body.cosyone3-theme #product-search .we-search-panel > .row > div:nth-child(3) {
    grid-column: 1;
    grid-row: 4;
    margin-right: 0;
    padding-top: 8px;
    padding-right: 0;
  }
  body.cosyone3-theme #product-search .we-search-panel > p {
    grid-column: 1;
    grid-row: 5;
    padding-top: 0;
    border-top: 0;
  }
  body.cosyone3-theme #product-search #button-search {
    grid-column: 1;
    grid-row: 6;
    width: 100%;
    margin-top: 2px;
  }
}

/* --------------------------------------------------------------------------
 * 3. Custom Branded Dropdown (.we-select) replacing native OS popup menus on
 *    category_id (searchable tree) and #input-sort / #input-limit.
 * -------------------------------------------------------------------------- */
body.cosyone3-theme .we-select {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}
body.cosyone3-theme #content .cosy-catalog-tools .input-group .we-select {
  display: flex;
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
  margin-left: -1px;
}
body.cosyone3-theme .we-select__native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
}
body.cosyone3-theme .we-select__trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 9px 14px;
  color: var(--cosy-ink, #30291f);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  text-align: left;
  background: #fff;
  border: 1px solid #d5c7ad;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
body.cosyone3-theme #content .cosy-catalog-tools .input-group .we-select__trigger {
  border-radius: 0 6px 6px 0;
}
body.cosyone3-theme .we-select__trigger:hover {
  border-color: var(--cosy-accent, #b18a13);
}
body.cosyone3-theme .we-select.is-open .we-select__trigger {
  border-color: var(--cosy-accent, #b18a13);
  box-shadow: 0 0 0 2px rgba(146, 114, 20, .16);
  z-index: 4;
}
body.cosyone3-theme .we-select__trigger:focus-visible {
  border-color: var(--cosy-accent, #b18a13);
  box-shadow: 0 0 0 2px rgba(146, 114, 20, .16);
  outline: 2px solid var(--cosy-secondary, #80620b) !important;
  outline-offset: -2px !important;
  z-index: 4;
}
body.cosyone3-theme .we-select__value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.cosyone3-theme .we-select__chevron {
  flex: 0 0 auto;
  width: 13px;
  height: 9px;
  color: var(--cosy-secondary, #80620b);
  transition: transform .18s ease;
}
body.cosyone3-theme .we-select.is-open .we-select__chevron {
  transform: rotate(180deg);
}

/* Floating dropdown panel */
body.cosyone3-theme .we-select__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1050;
  display: none;
  min-width: 100%;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid #dfd3bc;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(48, 41, 31, .16);
  overflow: hidden;
}
body.cosyone3-theme .we-select.is-searchable .we-select__panel {
  min-width: max(100%, 300px);
  max-width: min(400px, calc(100vw - 24px));
}
body.cosyone3-theme .we-select.is-open .we-select__panel {
  display: block;
}
body.cosyone3-theme .we-select.is-align-right .we-select__panel {
  left: auto;
  right: 0;
}
body.cosyone3-theme .we-select.is-dropup .we-select__panel {
  top: auto;
  bottom: calc(100% + 6px);
}

/* Sticky filter input inside category dropdown */
body.cosyone3-theme .we-select__filter-wrap {
  position: relative;
  padding: 10px 10px 8px;
  background: var(--cosy-bg, #fffaf0);
  border-bottom: 1px solid var(--cosy-line, #ebddb5);
}
body.cosyone3-theme .we-select__filter {
  display: block;
  width: 100%;
  height: 36px;
  padding: 6px 32px 6px 11px;
  color: var(--cosy-ink, #30291f);
  font-size: 13.5px;
  background: #fff;
  border: 1px solid #d5c7ad;
  border-radius: 5px;
  box-shadow: none;
  outline: none;
}
body.cosyone3-theme .we-select__filter:focus,
body.cosyone3-theme .we-select__filter:focus-visible {
  border-color: var(--cosy-accent, #b18a13);
  box-shadow: 0 0 0 2px rgba(146, 114, 20, .14);
  outline: 2px solid var(--cosy-secondary, #80620b) !important;
  outline-offset: 0;
}
body.cosyone3-theme .we-select__filter-clear {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  color: var(--cosy-muted, #716757);
  font-size: 16px;
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
body.cosyone3-theme .we-select__filter-clear.is-visible {
  display: inline-flex;
}
body.cosyone3-theme .we-select__filter-clear:hover {
  color: var(--cosy-ink, #30291f);
  background: rgba(177, 138, 19, .12);
}

/* Option list */
body.cosyone3-theme .we-select__list {
  max-height: 310px;
  margin: 0;
  padding: 6px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
body.cosyone3-theme .we-select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  color: var(--cosy-ink, #30291f);
  font-size: 13.5px;
  line-height: 1.35;
  text-align: left;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
}
body.cosyone3-theme .we-select__option-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}
body.cosyone3-theme .we-select__option-label {
  overflow-wrap: anywhere;
}
body.cosyone3-theme .we-select__option-parent {
  display: none;
  margin-top: 1px;
  color: var(--cosy-muted, #716757);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.25;
}
body.cosyone3-theme .we-select.is-filtering .we-select__option-parent {
  display: block;
}
body.cosyone3-theme .we-select__option-check {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  opacity: 0;
}
body.cosyone3-theme .we-select__option.is-selected .we-select__option-check {
  opacity: 1;
}

/* 3-level category tree hierarchy (only when not filtering) */
body.cosyone3-theme .we-select:not(.is-filtering) .we-select__option--lvl-0 {
  margin-bottom: 4px;
  padding-bottom: 8px;
  font-weight: 600;
  border-bottom: 1px solid #f0e6d2;
  border-radius: 5px 5px 0 0;
}
body.cosyone3-theme .we-select:not(.is-filtering) .we-select__option--lvl-1 {
  margin-top: 4px;
  font-weight: 600;
  color: #261f16;
}
body.cosyone3-theme .we-select:not(.is-filtering) .we-select__option--lvl-2 {
  padding-left: 24px;
  font-weight: 400;
}
body.cosyone3-theme .we-select:not(.is-filtering) .we-select__option--lvl-3 {
  padding-left: 40px;
  font-size: 13px;
  color: #4f4638;
}
body.cosyone3-theme .we-select:not(.is-filtering) .we-select__option--lvl-3 .we-select__option-label::before {
  content: '· ';
  color: var(--cosy-accent, #b18a13);
  font-weight: 700;
}

body.cosyone3-theme .we-select__option:hover,
body.cosyone3-theme .we-select__option.is-active {
  color: var(--cosy-secondary, #80620b);
  background: var(--cosy-bg, #fffaf0);
}
body.cosyone3-theme .we-select__option.is-selected,
body.cosyone3-theme .we-select__option.is-selected.is-active,
body.cosyone3-theme .we-select__option.is-selected:hover {
  color: var(--cosy-action-text, #fff);
  font-weight: 600;
  background: var(--cosy-gold-button, #b18a13);
}
body.cosyone3-theme .we-select__option.is-selected .we-select__option-parent {
  color: rgba(255, 255, 255, .86);
}
body.cosyone3-theme .we-select__option.is-selected .we-select__option-label::before {
  content: none;
}
body.cosyone3-theme .we-select__option[hidden] {
  display: none;
}
body.cosyone3-theme .we-select__empty {
  display: none;
  padding: 14px 12px;
  color: var(--cosy-muted, #716757);
  font-size: 13px;
  text-align: center;
}
body.cosyone3-theme .we-select__empty.is-visible {
  display: block;
}

/* Narrow phone adjustments matching wellness-selects.css */
@media (max-width: 400px) {
  body.cosyone3-theme #content .cosy-catalog-tools > div:nth-child(3) .we-select {
    flex: 0 0 44px;
    width: 100%;
    margin-top: -1px;
    margin-left: 0;
  }
  body.cosyone3-theme #content .cosy-catalog-tools > div:nth-child(3) .we-select__trigger {
    border-radius: 0 0 6px 6px;
  }
  body.cosyone3-theme #content .cosy-catalog-tools > div:nth-child(3) .we-select__panel {
    width: 100%;
    min-width: 100%;
  }
}
@media (max-width: 767px) {
  body.cosyone3-theme #product-search #input-search,
  body.cosyone3-theme .we-select__filter {
    font-size: 16px;
  }
  body.cosyone3-theme .we-select.is-searchable .we-select__panel {
    min-width: 100%;
    width: 100%;
  }
  body.cosyone3-theme .we-select__list {
    max-height: min(290px, 46vh);
  }
  body.cosyone3-theme .we-select__option {
    min-height: 40px;
  }
}
@media (min-width: 768px) and (max-width: 1023px) {
  body.cosyone3-theme.cosy-phone-desktop #content .cosy-catalog-tools .we-select__trigger,
  body.cosyone3-theme.cosy-phone-desktop #product-search #input-search,
  body.cosyone3-theme.cosy-phone-desktop #product-search .we-select__trigger,
  body.cosyone3-theme.cosy-phone-desktop #product-search #button-search {
    height: 64px;
    min-height: 64px;
    font-size: 18px;
  }
}

@media (forced-colors: active) {
  body.cosyone3-theme .we-select__option.is-selected {
    outline: 2px solid Highlight;
  }
}
