/**
 * Header search redesign — desktop autocomplete dropdown (#web_search_wrap) and
 * mobile full-screen overlay (.MobileSearch / #datafetch).
 *
 * Hand-maintained plain CSS, enqueued after main.css with filemtime versioning
 * (see load_styles() in functions.php). Not part of the gulp/SCSS build.
 *
 * The AJAX result markup lives in sarir_search_render_results() in functions.php
 * and is shared byte-for-byte between the two surfaces, so almost everything
 * here is namespaced `.sarir-srch`. Only the container/input rules reach back
 * into the theme's existing selectors, and those are written to out-specify the
 * compiled main.css declarations they replace.
 *
 *   1. Shared result panel (.sarir-srch*)
 *   2. Desktop dropdown shell (#web_search_wrap + input)
 *   3. Mobile overlay shell (.MobileSearch)
 *   4. Loading skeleton + spinner
 */

/* ===========================================================================
 * 1. Shared result panel
 * ======================================================================== */

.sarir-srch {
  font-size: 13px;
  line-height: 1.5;
  color: var(--primaryTextColor, #4c5e60);
  text-align: right;
}

.sarir-srch *,
.sarir-srch *::before,
.sarir-srch *::after {
  box-sizing: border-box;
}

/* The compiled theme styles buttons inside the header search form
   (`.header .header__search form button`, specificity 0,4,1) as an absolutely
   positioned, zero-line-height submit icon. Every <button> we inject into the
   panel (recent-search chips, the clear button) inherits that and collapses /
   stacks. Reset them here, id-scoped so it outweighs the theme rule on both
   surfaces. */
#web_search_wrap .sarir-srch button,
#datafetch .sarir-srch button {
  position: static;
  inset: auto;
  transform: none;
  margin: 0;
  width: auto;
  line-height: inherit;
  -webkit-appearance: none;
          appearance: none;
}

/* --- Category chips -------------------------------------------------------- */

.sarir-srch__cats {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--panelBorderSoft, #eef1f2);
}

.sarir-srch__cats-label,
.sarir-srch__head span:first-of-type {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--secondaryTextColor, #a0a0a0);
  margin-bottom: 9px;
}

.sarir-srch__cats-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sarir-srch__cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--backgroundColor, #f6f7f8);
  border: 1px solid transparent;
  color: var(--primaryTextColor, #4c5e60);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.sarir-srch__cat i {
  font-size: 13px;
  line-height: 0;
  color: var(--primaryColor, #3e9c92);
  flex: 0 0 auto;
}

.sarir-srch__cat span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sarir-srch__cat small {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--secondaryTextColor, #a0a0a0);
  white-space: nowrap;
}

.sarir-srch__cat:hover,
.sarir-srch__cat:focus-visible {
  background: var(--primaryColorLight, #edfbfc);
  border-color: color-mix(in srgb, var(--primaryColor, #3e9c92) 24%, #fff);
  color: var(--primaryColor, #3e9c92);
  outline: none;
}

.sarir-srch__cat:hover small {
  color: color-mix(in srgb, var(--primaryColor, #3e9c92) 70%, #fff);
}

/* --- Product list -------------------------------------------------------- */

.sarir-srch__section {
  padding: 6px 8px 8px;
}

.sarir-srch__head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 8px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--secondaryTextColor, #a0a0a0);
}

.sarir-srch__head i {
  font-size: 14px;
  line-height: 0;
  color: var(--primaryColor, #3e9c92);
}

.sarir-srch__head span:first-of-type {
  margin-bottom: 0;
}

.sarir-srch__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sarir-srch__item + .sarir-srch__item {
  margin-top: 2px;
}

.sarir-srch__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: background .15s ease;
}

.sarir-srch__link:hover,
.sarir-srch__link:focus-visible,
.sarir-srch__link.is-active {
  background: var(--primaryColorLight, #edfbfc);
  outline: none;
}

.sarir-srch__thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--backgroundColor, #fbfbfb);
  border: 1px solid var(--panelBorderSoft, #eef1f2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sarir-srch__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sarir-srch__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sarir-srch__title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--primaryTextColor, #4c5e60);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sarir-srch__price {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primaryColor, #3e9c92);
  line-height: 1.2;
}

.sarir-srch__price del {
  margin-inline-start: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--secondaryTextColor, #a0a0a0);
}

.sarir-srch__price ins {
  text-decoration: none;
}

.sarir-srch__price .discount {
  display: none; /* the percent badge from the theme filter — noise at this size */
}

.sarir-srch__oos {
  align-self: flex-start;
  margin-top: 1px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--danger, #ef4056);
  background: color-mix(in srgb, var(--danger, #ef4056) 12%, #fff);
  border-radius: 5px;
  padding: 2px 6px;
  line-height: 1.4;
}

.sarir-srch__go {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 0;
  color: var(--secondaryTextColor, #a0a0a0);
  opacity: 0;
  transform: translateX(4px);
  transition: opacity .15s ease, transform .15s ease;
}

.sarir-srch__link:hover .sarir-srch__go,
.sarir-srch__link.is-active .sarir-srch__go {
  opacity: 1;
  transform: translateX(0);
  color: var(--primaryColor, #3e9c92);
}

/* --- "View all results" bar -------------------------------------------- */

.sarir-srch__all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  border-top: 1px solid var(--panelBorderSoft, #eef1f2);
  background: var(--pureWhite, #fff);
  color: var(--primaryColor, #3e9c92);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  position: sticky;
  bottom: 0;
  transition: background .15s ease;
}

.sarir-srch__all i {
  font-size: 15px;
  line-height: 0;
  transition: transform .18s ease;
}

.sarir-srch__all:hover {
  background: var(--primaryColorLight, #edfbfc);
  color: var(--primaryColor, #3e9c92);
}

.sarir-srch__all:hover i {
  transform: translateX(-4px);
}

/* --- Hint / empty / error notes -------------------------------------- */

.sarir-srch__note {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 34px 24px;
}

.sarir-srch__note i {
  font-size: 30px;
  line-height: 1;
  color: color-mix(in srgb, var(--primaryColor, #3e9c92) 40%, #cfd6d6);
  margin-bottom: 2px;
}

.sarir-srch__note p {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--primaryTextColor, #4c5e60);
}

.sarir-srch__note span {
  font-size: 11.5px;
  color: var(--secondaryTextColor, #a0a0a0);
  line-height: 1.7;
}

/* --- Recent searches (built client-side in main.js) ----------------- */

.sarir-srch--recent {
  padding: 14px 16px 16px;
}

.sarir-srch__recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sarir-srch__recent-head .sarir-srch__cats-label {
  margin-bottom: 0;
}

.sarir-srch__recent-clear {
  border: none;
  background: none;
  padding: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--secondaryTextColor, #a0a0a0);
  cursor: pointer;
  transition: color .15s ease;
}

.sarir-srch__recent-clear:hover {
  color: var(--danger, #ef4056);
}

/* ===========================================================================
 * 2. Desktop dropdown shell
 * ======================================================================== */

/* Input pill — out-specifies `.header .header__search form .header__search--input_web`
   in main.css while staying off Elementor's per-widget typography controls. */
.header__search form .header__search--input_web,
.header .header__search form .header__search--input_web,
.header2 .header__search form .header__search--input_web {
  min-width: 0;
  width: 100%;
  padding: 12px 18px;
  padding-inline-end: 44px;
  background: var(--backgroundColor, #f6f7f8);
  border: 1.5px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  color: var(--primaryTextColor, #4c5e60);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.header__search form .header__search--input_web::placeholder {
  color: var(--secondaryTextColor, #a0a0a0);
}

.header__search form .header__search--input_web:focus {
  background: var(--pureWhite, #fff);
  border-color: var(--primaryColor, #3e9c92);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primaryColor, #3e9c92) 14%, transparent);
}

.header__search form {
  position: relative;
}

/* The submit button sits at the inline-end edge of the pill. */
.header__search form > button[type="submit"],
.header__search form button {
  z-index: 2;
}

.header__search form button i {
  transition: color .15s ease;
}

.header__search form .header__search--input_web:focus ~ button i {
  color: var(--primaryColor, #3e9c92);
}

/* Panel */
.header__search form #web_search_wrap,
.header .header__search form #web_search_wrap {
  width: min(560px, 92vw);
  inset-inline-start: 0;
  inset-inline-end: auto;
  right: auto;
  left: auto;
  margin: 0;
  margin-top: 12px;
  padding: 0;
  background: var(--pureWhite, #fff);
  border: 1px solid var(--panelBorderSoft, #eef1f2);
  border-radius: 16px;
  box-shadow: 0 18px 50px -18px rgba(23, 43, 42, .30), 0 6px 16px -10px rgba(23, 43, 42, .18);
  overflow: hidden;
  z-index: 999;
}

/* The wide `.header2` layout keeps its full-width dropdown. */
.header2 #web_search_wrap {
  width: 100% !important;
}

.header__search #web_search_wrap .web_search_wrap__inner {
  max-height: min(70vh, 540px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.header__search #web_search_wrap .web_search_wrap__inner::-webkit-scrollbar {
  width: 8px;
}

.header__search #web_search_wrap .web_search_wrap__inner::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--primaryColor, #3e9c92) 22%, #e6e9e9);
  border-radius: 8px;
}

/* Retire the old ring spinner — main.js now paints a skeleton instead. */
.header__search #web_search_wrap .loading {
  display: none !important;
}

/* ===========================================================================
 * 3. Mobile overlay shell
 * ======================================================================== */

.MobileSearch {
  background: var(--pureWhite, #fff);
}

.MobileSearch .offcanvas-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--panelBorderSoft, #eef1f2);
  box-shadow: 0 4px 14px -10px rgba(23, 43, 42, .25);
}

.MobileSearch .offcanvas-header form {
  position: relative;
  width: 100%;
}

.MobileSearch .offcanvas-header form input.modal_search_input {
  width: 100%;
  padding: 13px 46px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  background: var(--backgroundColor, #f6f7f8);
  font-size: 14px;
  color: var(--primaryTextColor, #4c5e60);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.MobileSearch .offcanvas-header form input.modal_search_input:focus {
  outline: none;
  background: var(--pureWhite, #fff);
  border-color: var(--primaryColor, #3e9c92);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primaryColor, #3e9c92) 14%, transparent);
}

.MobileSearch .offcanvas-header form .search_back {
  inset-inline-start: 6px;
  inset-inline-end: auto;
  right: auto;
  font-size: 26px;
  color: var(--primaryTextColor, #4c5e60);
}

.MobileSearch .offcanvas-header form .search_state {
  inset-inline-end: 10px;
  inset-inline-start: auto;
  left: auto;
  font-size: 18px;
  color: var(--secondaryTextColor, #a0a0a0);
}

/* Let results scroll — main.css pins this to `overflow:hidden !important`. */
.MobileSearch .offcanvas-body {
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 10px 28px;
}

.MobileSearch #datafetch {
  overflow: visible;
}

/* Roomier rows on touch. */
.MobileSearch .sarir-srch__link {
  padding: 11px 10px;
  gap: 13px;
}

.MobileSearch .sarir-srch__thumb {
  width: 58px;
  height: 58px;
}

.MobileSearch .sarir-srch__title {
  font-size: 13px;
}

.MobileSearch .sarir-srch__go {
  opacity: 1;
  transform: none;
}

.MobileSearch .sarir-srch__all {
  margin-top: 8px;
  border: 1px solid var(--panelBorderSoft, #eef1f2);
  border-radius: 12px;
  position: static;
}

/* ===========================================================================
 * 4. Loading skeleton + spinner
 * ======================================================================== */

.sarir-srch--loading {
  padding: 10px 12px;
}

.sarir-srch__sk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
}

.sarir-srch__sk-thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 10px;
}

.sarir-srch__sk-lines {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sarir-srch__sk-lines span {
  display: block;
  height: 10px;
  border-radius: 6px;
}

.sarir-srch__sk-lines span:first-child { width: 82%; }
.sarir-srch__sk-lines span:last-child  { width: 44%; }

.MobileSearch .sarir-srch__sk-thumb {
  width: 58px;
  height: 58px;
}

.sarir-srch__sk-thumb,
.sarir-srch__sk-lines span {
  background: linear-gradient(
    100deg,
    #eef1f2 30%,
    #f7f9f9 50%,
    #eef1f2 70%
  );
  background-size: 220% 100%;
  animation: sarir-srch-shimmer 1.15s ease-in-out infinite;
}

@keyframes sarir-srch-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -120% 0; }
}

/* Spinner reused for the mobile input status icon (.search_state). */
.MobileSearch .search_state .ispin {
  display: inline-block;
  animation: sarir-srch-spin .7s linear infinite;
}

@keyframes sarir-srch-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .sarir-srch__sk-thumb,
  .sarir-srch__sk-lines span,
  .MobileSearch .search_state .ispin {
    animation: none;
  }
}
