/* Important declarations in this layer keep the shared search control independent
   of the unlayered application button and input styles. */
@layer weles-search-field {
  .wf-search-field {
    position: relative;
    display: block;
    flex: 1 1 0;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    line-height: 1.5;
  }

  .wf-search-field > input.wf-search-input {
    box-sizing: border-box !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    margin: 0 !important;
    padding: 0 48px 0 12px !important;
    border: 1px solid var(--wf-line, #3a4046) !important;
    border-radius: 12px !important;
    background: var(--wf-surface, #141619) !important;
    color: var(--wf-text, #f5f3ef) !important;
    font: 400 16px/1.5 Inter, Arial, sans-serif !important;
    box-shadow: none !important;
    outline: none !important;
    appearance: none !important;
    transition: none !important;
  }

  .wf-search-field > input.wf-search-input:focus {
    border-color: var(--wf-control-border, #66707a) !important;
    outline: 2px solid var(--wf-text-secondary, #b9bdc3) !important;
    outline-offset: -3px !important;
  }

  .wf-search-input::placeholder {
    color: var(--wf-text-secondary, #b9bdc3) !important;
    opacity: 1 !important;
  }

  .wf-search-field > input.wf-search-input:disabled {
    color: var(--wf-text-muted, #949ba4) !important;
    cursor: not-allowed;
  }

  .wf-search-input::-webkit-search-cancel-button,
  .wf-search-input::-webkit-search-decoration {
    display: none !important;
    appearance: none !important;
  }

  .wf-search-field > button.wf-search-clear {
    appearance: none !important;
    box-sizing: border-box !important;
    position: absolute !important;
    inset: 0 0 auto auto !important;
    display: grid !important;
    place-items: center !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: transparent !important;
    color: var(--wf-text-secondary, #b9bdc3) !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
    transition: none !important;
    isolation: isolate;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .wf-search-field > button.wf-search-clear::before {
    content: "" !important;
    position: absolute !important;
    inset: 3px !important;
    border-radius: 9px !important;
    background: transparent !important;
    z-index: -1;
    pointer-events: none;
  }

  .wf-search-field > button.wf-search-clear::after {
    content: none !important;
  }

  .wf-search-field > button.wf-search-clear:is(:hover,:active):enabled {
    color: var(--wf-text, #f5f3ef) !important;
  }

  .wf-search-field > button.wf-search-clear:is(:hover,:active):enabled::before {
    background: var(--wf-hover, #252a2f) !important;
  }

  .wf-search-field > button.wf-search-clear:focus-visible::before {
    outline: 1px solid var(--wf-text-secondary, #b9bdc3) !important;
    outline-offset: -1px !important;
  }

  .wf-search-field > button.wf-search-clear:disabled {
    color: var(--wf-text-muted, #949ba4) !important;
    cursor: not-allowed;
  }

  .wf-search-clear > svg {
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    pointer-events: none;
  }

  .wf-search-field > button.wf-search-clear[hidden],
  [data-wf-search-submit-hidden] {
    display: none !important;
  }

  @media (forced-colors: active) {
    .wf-search-field > input.wf-search-input {
      border-color: CanvasText !important;
    }
    .wf-search-field > input.wf-search-input:focus,
    .wf-search-field > button.wf-search-clear:focus-visible::before {
      outline-color: Highlight !important;
    }
  }
}

/* The wrapper takes the grid area originally assigned to the music input. */
.wf-music-toolbar > .wf-search-field {
  grid-area: search;
}

body .ct-search-form-inner.ct-pseudo-input:has(.wf-search-field){height:auto;min-height:0;padding:0;border:0!important;background:transparent!important;box-shadow:none!important;outline:none!important}
body .ct-search-form-inner.ct-pseudo-input:has(.wf-search-field)::after,
body .ct-search-form-inner.ct-pseudo-input:has(.wf-search-field)::before{display:none!important}
body .ct-search-form[data-wf-search-empty="true"] :is(.ct-search-results,[role="status"]){display:none!important}
body .wm-people-search__row:has(.wf-search-field){grid-template-columns:minmax(0,1fr)}

/* Keep the built-in guest fallback only until the shared clear control is mounted. */
.weles-fr02-recipe-filter__controls:has(> .wf-search-field) {
  grid-template-columns: minmax(0, 1fr);
}
.weles-fr02-recipe-filter__controls:has(> .wf-search-field) > .weles-fr02-recipe-filter__clear {
  display: none !important;
}
