/* Shared search field. Shell + icon + transparent input.
   Opt in with .wh-search on the container and .wh-search__input on the input.
   Layout (width, margin, flex) stays with the page. */

.wh-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    min-height: 34px;
    min-width: 0;
    padding: 0 10px;
    border: 1px solid var(--app-border-strong, #dde2eb);
    border-radius: 8px;
    background: var(--app-surface, #ffffff);
    color: #5c6b80;
    box-sizing: border-box;
    font-family: inherit;
}

.wh-search:focus-within,
button.wh-search:focus-visible {
    border-color: rgba(var(--wh-accent-rgb, 34, 90, 234), 0.7);
    box-shadow: 0 0 0 3px rgba(var(--wh-accent-rgb, 34, 90, 234), 0.18);
    outline: none;
}

button.wh-search {
    width: 100%;
    margin: 0;
    text-align: left;
    cursor: pointer;
}

.wh-search > svg,
.wh-search__icon {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    color: currentColor;
}

.wh-search input,
.wh-search__input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline: none;
    background: transparent;
    background-color: transparent;
    box-shadow: none;
    color: var(--app-text, #111111);
    font: inherit;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    -webkit-appearance: none;
    appearance: none;
}

.wh-search input::-webkit-search-decoration,
.wh-search input::-webkit-search-cancel-button,
.wh-search input::-webkit-search-results-button,
.wh-search input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    display: none;
}

.wh-search input::placeholder,
.wh-search__placeholder {
    color: #5c6b80;
    font-weight: 400;
    opacity: 1;
}

.wh-search__placeholder {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
}

html[data-theme="dark"] .wh-search {
    background: var(--app-surface, #0f1420);
    border-color: var(--app-border-strong, #313a52);
    color: var(--app-text-2, #bcc5d4);
}

html[data-theme="dark"] .wh-search input,
html[data-theme="dark"] .wh-search input[type="search"],
html[data-theme="dark"] .wh-search input[type="text"],
html[data-theme="dark"] .wh-search input:hover,
html[data-theme="dark"] .wh-search input:focus,
html[data-theme="dark"] .wh-search input:focus-visible {
    background: transparent;
    background-color: transparent;
    border: 0;
    box-shadow: none;
    color: var(--app-text, #ffffff);
    -webkit-text-fill-color: var(--app-text, #ffffff);
}

html[data-theme="dark"] .wh-search input::placeholder,
html[data-theme="dark"] .wh-search__placeholder {
    color: var(--app-text-2, #bcc5d4);
    -webkit-text-fill-color: var(--app-text-2, #bcc5d4);
    opacity: 1;
}

/* Page stylesheets paint their own search chrome, often with !important.
   These opted-in fields keep the shared look. */
#search-wrapper-main.wh-search,
#brands-search-wrapper.wh-search,
.brands-page-wrapper .brands-meta-search.wh-search,
.trends-page-wrapper .tf-search.wh-search,
.docs-search.wh-search,
.wh-cmd-search.wh-search,
.settings-panel__search.wh-search,
.std-header-store-search-field .wh-search {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 10px !important;
    border: 1px solid var(--app-border-strong, #dde2eb) !important;
    border-radius: 8px !important;
    background: var(--app-surface, #ffffff) !important;
    box-shadow: none !important;
    color: #5c6b80 !important;
}

#search-wrapper-main.wh-search:focus-within,
#brands-search-wrapper.wh-search:focus-within,
.brands-page-wrapper .brands-meta-search.wh-search:focus-within,
.trends-page-wrapper .tf-search.wh-search:focus-within,
.docs-search.wh-search:focus-within,
.wh-cmd-search.wh-search:focus-within,
.settings-panel__search.wh-search:focus-within,
.std-header-store-search-field .wh-search:focus-within {
    border-color: rgba(var(--wh-accent-rgb, 34, 90, 234), 0.7) !important;
    box-shadow: 0 0 0 3px rgba(var(--wh-accent-rgb, 34, 90, 234), 0.18) !important;
    background: var(--app-surface, #ffffff) !important;
}

#search-wrapper-main.wh-search > svg,
#brands-search-wrapper.wh-search > svg,
.brands-page-wrapper .brands-meta-search.wh-search > svg,
.trends-page-wrapper .tf-search.wh-search > svg,
.wh-search__icon {
    width: 15px !important;
    height: 15px !important;
    color: currentColor !important;
}

/* The field is 34px. A 32px camera box sits on the border and breaks the outline. */
#search-wrapper-main.wh-search:has(.explore-visual-search-camera-btn) {
    padding-right: 5px !important;
}

#search-wrapper-main .explore-visual-search-camera-btn {
    box-sizing: border-box !important;
    flex: 0 0 24px !important;
    align-self: center !important;
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 6px !important;
    line-height: 0 !important;
}

#search-wrapper-main .explore-visual-search-camera-btn svg {
    width: 15px !important;
    height: 15px !important;
    display: block !important;
}

#search-wrapper-main.wh-search .wh-search__input,
#brands-search-wrapper.wh-search #brands-search,
.brands-page-wrapper .brands-meta-search.wh-search #brands-search,
.docs-search.wh-search input,
.trends-page-wrapper #search-keyword.wh-search__input,
.std-header-store-search-field .wh-search__input,
.wh-cmd-search.wh-search .wh-search__input,
.settings-panel__search.wh-search input {
    font-size: 13px !important;
    font-weight: 400 !important;
    color: var(--app-text, #111111) !important;
    -webkit-text-fill-color: var(--app-text, #111111) !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 !important;
}

#search-wrapper-main.wh-search .wh-search__input::placeholder,
.brands-page-wrapper .brands-meta-search.wh-search #brands-search::placeholder,
.docs-search.wh-search input::placeholder,
.trends-page-wrapper #search-keyword.wh-search__input::placeholder,
.std-header-store-search-field .wh-search__input::placeholder {
    color: #5c6b80 !important;
    -webkit-text-fill-color: #5c6b80 !important;
    font-weight: 400 !important;
    opacity: 1 !important;
}

html[data-theme="dark"] #search-wrapper-main.wh-search,
html[data-theme="dark"] .brands-page-wrapper #brands-search-wrapper.wh-search,
html[data-theme="dark"] .brands-page-wrapper .brands-meta-search.wh-search,
html[data-theme="dark"] .trends-page-wrapper .tf-search.wh-search,
html[data-theme="dark"] .docs-search.wh-search,
html[data-theme="dark"] .wh-cmd-search.wh-search,
html[data-theme="dark"] .settings-panel__search.wh-search,
html[data-theme="dark"] .std-header-store-search-field .wh-search {
    background: var(--app-surface, #0f1420) !important;
    border-color: var(--app-border-strong, #313a52) !important;
    box-shadow: none !important;
    color: var(--app-text-2, #bcc5d4) !important;
}

html[data-theme="dark"] #search-wrapper-main.wh-search:focus-within,
html[data-theme="dark"] #brands-search-wrapper.wh-search:focus-within,
html[data-theme="dark"] .brands-page-wrapper .brands-meta-search.wh-search:focus-within,
html[data-theme="dark"] .trends-page-wrapper .tf-search.wh-search:focus-within,
html[data-theme="dark"] .docs-search.wh-search:focus-within,
html[data-theme="dark"] .wh-cmd-search.wh-search:focus-within,
html[data-theme="dark"] .settings-panel__search.wh-search:focus-within,
html[data-theme="dark"] .std-header-store-search-field .wh-search:focus-within {
    background: var(--app-surface, #0f1420) !important;
    border-color: rgba(var(--wh-accent-rgb, 34, 90, 234), 0.7) !important;
    box-shadow: 0 0 0 3px rgba(var(--wh-accent-rgb, 34, 90, 234), 0.18) !important;
}

html[data-theme="dark"] #search-wrapper-main.wh-search .wh-search__input,
html[data-theme="dark"] #brands-search-wrapper.wh-search #brands-search,
html[data-theme="dark"] .brands-page-wrapper .brands-meta-search.wh-search #brands-search,
html[data-theme="dark"] .docs-search.wh-search input,
html[data-theme="dark"] .trends-page-wrapper #search-keyword.wh-search__input,
html[data-theme="dark"] .std-header-store-search-field .wh-search__input,
html[data-theme="dark"] .std-header-store-search-field .wh-search__input:focus,
html[data-theme="dark"] .wh-cmd-search.wh-search .wh-search__input,
html[data-theme="dark"] .settings-panel__search.wh-search input {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: var(--app-text, #ffffff) !important;
    -webkit-text-fill-color: var(--app-text, #ffffff) !important;
}

html[data-theme="dark"] #search-wrapper-main.wh-search .wh-search__input::placeholder,
html[data-theme="dark"] #brands-search-wrapper.wh-search #brands-search::placeholder,
html[data-theme="dark"] .brands-page-wrapper .brands-meta-search.wh-search #brands-search::placeholder,
html[data-theme="dark"] .docs-search.wh-search input::placeholder,
html[data-theme="dark"] .trends-page-wrapper #search-keyword.wh-search__input::placeholder,
html[data-theme="dark"] .std-header-store-search-field .wh-search__input::placeholder {
    color: var(--app-text-2, #bcc5d4) !important;
    -webkit-text-fill-color: var(--app-text-2, #bcc5d4) !important;
    font-weight: 400 !important;
    opacity: 1 !important;
}

.std-header-store-search-field.is-dropdown-open .wh-search {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}
