/* Paieška: prekių paieškos laukas ir rezultatų sąrašas.
 * Išvaizda keičiama CSS kintamaisiais ant .scp arba bet kurio tėvinio elemento (sąrašas readme.txt).
 * Taisyklės prasideda .scp:not(#_): :not(#_) prideda ID svorį, todėl temos ir Elementor rinkinio
 * bendri input, button ir a stiliai (dažnai 0,3,1 ar 0,4,1 svorio) lauko nesugadina. */

:where(.scp) {
  --_scp-bg: var(--scp-bg, #fff);
  --_scp-fg: var(--scp-fg, #1c1c1e);
  --_scp-muted: var(--scp-muted, #6e6e73);
  --_scp-border: var(--scp-border, #d2d2d7);
  --_scp-accent: var(--scp-accent, #1c1c1e);
  --_scp-hover: var(--scp-hover, rgba(0, 0, 0, .05));
  --_scp-line: var(--scp-line, rgba(0, 0, 0, .08));
  --_scp-radius: var(--scp-radius, 8px);
  --_scp-panel-radius: var(--scp-panel-radius, 10px);
  --_scp-height: var(--scp-height, 48px);
  --_scp-pad: var(--scp-pad, 14px);
  --_scp-font-size: var(--scp-font-size, 16px);
  --_scp-thumb: var(--scp-thumb, 56px);
  --_scp-btn-bg: var(--scp-btn-bg, transparent);
  --_scp-btn-fg: var(--scp-btn-fg, var(--_scp-fg));
  --_scp-panel-width: var(--scp-panel-width, 100%);
  --_scp-max-height: var(--scp-max-height, min(70vh, 560px));
  --_scp-shadow: var(--scp-shadow, 0 18px 40px -18px rgba(0, 0, 0, .28), 0 2px 6px rgba(0, 0, 0, .04));
  --_scp-z: var(--scp-z, 1000);
}

.scp:not(#_) {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--_scp-fg);
  font-family: inherit;
  font-size: var(--_scp-font-size);
  font-style: normal;
  font-weight: 400;
  line-height: 1.3;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  word-spacing: normal;
}

/* Vidiniai elementai paveldi iš .scp, net jei tema stilizuoja span, p ar a tiesiogiai. */
.scp:not(#_) *,
.scp:not(#_) *::before,
.scp:not(#_) *::after {
  box-sizing: border-box;
  text-transform: inherit;
  letter-spacing: inherit;
  word-spacing: inherit;
}

.scp:not(#_) .scp__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- laukas ---------- */

.scp:not(#_) .scp__field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: var(--_scp-height);
  margin: 0;
  padding: 0;
  background: var(--_scp-bg);
  border: 1px solid var(--_scp-border);
  border-radius: var(--_scp-radius);
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.scp:not(#_) .scp__field:focus-within {
  border-color: var(--_scp-accent);
  box-shadow: 0 0 0 1px var(--_scp-accent);
}

.scp:not(#_) .scp__input,
.scp:not(#_) .scp__input:hover,
.scp:not(#_) .scp__input:focus,
.scp:not(#_) .scp__input:focus-visible {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0 4px 0 var(--_scp-pad);
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
  color: var(--_scp-fg);
  font: inherit;
  font-size: var(--_scp-font-size);
  font-weight: 400;
  line-height: 1.3;
  text-align: left;
  text-indent: 0;
  text-transform: none;
  letter-spacing: normal;
  transition: none;
}

.scp:not(#_) .scp__input::placeholder {
  color: var(--_scp-muted);
  opacity: 1;
}

.scp:not(#_) .scp__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  display: none;
}

.scp:not(#_) .scp__input::-webkit-search-decoration {
  -webkit-appearance: none;
}

/* Užrašas su besikeičiančiu žodžiu (atributas words) */
.scp:not(#_) .scp__ph {
  position: absolute;
  top: 50%;
  left: var(--_scp-pad);
  right: calc(var(--_scp-height) + 4px);
  transform: translateY(-50%);
  overflow: hidden;
  color: var(--_scp-muted);
  font-size: var(--_scp-font-size);
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
  transition: opacity .12s ease;
}

.scp:not(#_) .scp__input:not(:placeholder-shown) ~ .scp__ph,
.scp:not(#_).is-filled .scp__ph {
  opacity: 0;
}

.scp:not(#_) .scp__word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: .1em;
  margin-bottom: -.1em;
  color: var(--_scp-accent);
  font-weight: 500;
}

.scp:not(#_) .scp__word-in {
  display: inline-block;
  transition: transform .32s cubic-bezier(.2, .8, .2, 1), opacity .32s cubic-bezier(.2, .8, .2, 1);
}

.scp:not(#_) .scp__word-in.is-out {
  transform: translateY(-75%);
  opacity: 0;
  transition-duration: .18s;
  transition-timing-function: cubic-bezier(.4, 0, 1, 1);
}

.scp:not(#_) .scp__word-in.is-in {
  transform: translateY(75%);
  opacity: 0;
  transition: none;
}

.scp:not(#_) .scp__btn,
.scp:not(#_) .scp__btn:hover,
.scp:not(#_) .scp__btn:focus,
.scp:not(#_) .scp__btn:active {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--_scp-height) - 8px);
  height: calc(var(--_scp-height) - 8px);
  min-width: 0;
  min-height: 0;
  margin: 0 3px 0 0;
  padding: 0;
  border: 0;
  border-radius: max(0px, calc(var(--_scp-radius) - 4px));
  outline: 0;
  box-shadow: none;
  background: var(--_scp-btn-bg);
  color: var(--_scp-btn-fg);
  font: inherit;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease;
}

.scp:not(#_) .scp__btn:hover {
  background: var(--scp-btn-bg-hover, var(--_scp-hover));
}

.scp:not(#_) .scp__btn:focus-visible {
  outline: 2px solid var(--_scp-accent);
  outline-offset: -2px;
}

.scp:not(#_) .scp__icon {
  display: block;
  width: 20px;
  height: 20px;
  max-width: none;
  margin: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  transition: opacity .15s ease;
}

.scp:not(#_).is-loading .scp__icon {
  opacity: .4;
}

/* ---------- rezultatai ---------- */

.scp:not(#_) .scp__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: var(--_scp-z);
  width: var(--_scp-panel-width);
  max-width: calc(100vw - 16px);
  max-height: var(--_scp-max-height);
  margin: 0;
  padding: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--_scp-bg);
  color: var(--_scp-fg);
  border: 1px solid var(--_scp-border);
  border-radius: var(--_scp-panel-radius);
  box-shadow: var(--_scp-shadow);
  text-align: left;
  animation: scp-in .16s cubic-bezier(.2, .8, .2, 1);
}

.scp:not(#_) .scp__panel[hidden],
.scp:not(#_) .scp__empty[hidden] {
  display: none;
}

@keyframes scp-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.scp:not(#_) .scp__list {
  display: block;
  margin: 0;
  padding: 0;
}

.scp:not(#_) .scp__group {
  display: block;
  margin: 0;
  padding: 0;
}

.scp:not(#_) .scp__group + .scp__group {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--_scp-line);
}

.scp:not(#_) .scp__head {
  display: block;
  margin: 0;
  padding: 6px 8px 4px;
  color: var(--_scp-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: normal;
}

.scp:not(#_) .scp__opt,
.scp:not(#_) .scp__opt:hover,
.scp:not(#_) .scp__opt:focus,
.scp:not(#_) .scp__opt:visited {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: max(0px, calc(var(--_scp-panel-radius) - 4px));
  outline: 0;
  box-shadow: none;
  background: transparent;
  color: var(--_scp-fg);
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}

.scp:not(#_) .scp__opt:hover,
.scp:not(#_) .scp__opt[aria-selected="true"] {
  background: var(--_scp-hover);
}

.scp:not(#_) .scp__cat {
  justify-content: space-between;
  padding-top: 8px;
  padding-bottom: 8px;
}

.scp:not(#_) .scp__name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.scp:not(#_) .scp__count {
  flex: 0 0 auto;
  color: var(--_scp-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.scp:not(#_) .scp__thumb {
  display: block;
  flex: 0 0 var(--_scp-thumb);
  width: var(--_scp-thumb);
  height: var(--_scp-thumb);
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: max(0px, calc(var(--_scp-panel-radius) - 4px));
  box-shadow: none;
  background: var(--_scp-hover);
  object-fit: cover;
}

.scp:not(#_) .scp__text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.scp:not(#_) .scp__title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--_scp-fg);
  font-size: 15px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.scp:not(#_) mark {
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: var(--scp-mark-bg, transparent);
  color: inherit;
  font-weight: 600;
}

.scp:not(#_) .scp__price {
  display: block;
  color: var(--_scp-fg);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.scp:not(#_) .scp__price .amount,
.scp:not(#_) .scp__price bdi {
  color: inherit;
  font: inherit;
}

.scp:not(#_) .scp__price del {
  margin-right: 6px;
  color: var(--_scp-muted);
  font-weight: 400;
  text-decoration: line-through;
  background: none;
  opacity: 1;
}

.scp:not(#_) .scp__price ins {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
  background: none;
}

.scp:not(#_) .scp__price .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.scp:not(#_) .scp__all,
.scp:not(#_) .scp__all:hover,
.scp:not(#_) .scp__all:focus {
  position: relative;
  margin-top: 9px;
  padding-top: 10px;
  padding-bottom: 10px;
  color: var(--_scp-accent);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.scp:not(#_) .scp__all::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 8px;
  right: 8px;
  height: 1px;
  background: var(--_scp-line);
}

.scp:not(#_) .scp__empty {
  margin: 0;
  padding: 10px 8px;
  color: var(--_scp-muted);
  font-size: 15px;
  line-height: 1.3;
}

@media (prefers-reduced-motion: reduce) {
  .scp:not(#_) .scp__panel,
  .scp:not(#_) .scp__word-in {
    animation: none;
    transition: none;
  }
}
