.xewex-search,
.xewex-search * {
  box-sizing: border-box;
}

.xewex-search {
  display: inline-flex;
  flex: 0 0 auto;
}

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

.xewex-search__toggle,
.xewex-search__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.xewex-search__toggle {
  width: 48px;
  min-width: 48px;
  height: 48px;
  color: #10161b;
  transition: color 160ms ease;
}

.xewex-search__toggle:hover,
.xewex-search__toggle:focus-visible {
  color: #687078;
}

.xewex-search__toggle:focus-visible,
.xewex-search__close:focus-visible,
.xewex-search__result:focus-visible {
  outline: 2px solid #10161b;
  outline-offset: 3px;
}

.xewex-search__icon,
.xewex-search__field-icon,
.xewex-search__close svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.xewex-search__overlay[hidden] {
  display: none;
}

.xewex-search__overlay {
  position: fixed;
  z-index: 999999;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(64px, 8vh) 24px 24px;
  opacity: 0;
  transition: opacity 180ms ease;
}

.xewex-search__overlay.is-open {
  opacity: 1;
}

.xewex-search__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 17, 0.56);
  backdrop-filter: blur(4px);
}

.xewex-search__panel {
  position: relative;
  display: flex;
  width: min(680px, 100%);
  max-height: calc(100vh - max(88px, 12vh));
  flex-direction: column;
  padding: 28px;
  border: 1px solid #e1e3e4;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(10, 14, 17, 0.22);
  color: #10161b;
  transform: translateY(-10px);
  transition: transform 180ms ease;
}

.xewex-search__overlay.is-open .xewex-search__panel {
  transform: translateY(0);
}

.xewex-search__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.xewex-search__title {
  margin: 0;
  color: #10161b;
  font: 500 22px/1.25 Montserrat, Arial, sans-serif;
}

.xewex-search__close {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.xewex-search__field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid #cfd3d6;
  border-radius: 2px;
  background: #fff;
  color: #687078;
}

.xewex-search__field:focus-within {
  border-color: #10161b;
  box-shadow: 0 0 0 1px #10161b;
}

.xewex-search__input {
  width: 100%;
  min-width: 0;
  height: 52px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: #10161b;
  font: 400 16px/1.4 Montserrat, Arial, sans-serif;
  appearance: none;
}

.xewex-search__input::-webkit-search-cancel-button {
  cursor: pointer;
}

.xewex-search__status {
  min-height: 45px;
  padding: 15px 2px 8px;
  color: #687078;
  font: 400 13px/1.5 Montserrat, Arial, sans-serif;
}

.xewex-search__status.is-loading::before {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid #cfd3d6;
  border-top-color: #10161b;
  border-radius: 50%;
  content: "";
  vertical-align: -2px;
  animation: xewex-search-spin 700ms linear infinite;
}

.xewex-search__results {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.xewex-search__result {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 2px;
  border-top: 1px solid #eceeef;
  color: #10161b;
  text-decoration: none;
}

.xewex-search__result:hover {
  background: #f7f7f6;
}

.xewex-search__result-image,
.xewex-search__result-placeholder {
  display: block;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 2px;
  background: #f0f1f1;
  object-fit: cover;
}

.xewex-search__result-copy {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
}

.xewex-search__result-title {
  overflow: hidden;
  color: #10161b;
  font: 500 14px/1.35 Montserrat, Arial, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xewex-search__result-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  color: #687078;
  font: 400 12px/1.4 Montserrat, Arial, sans-serif;
}

.xewex-search__result-price {
  color: #10161b;
  font-weight: 600;
}

html.xewex-search-is-open,
html.xewex-search-is-open body {
  overflow: hidden;
}

@keyframes xewex-search-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
  .xewex-search__toggle {
    width: 42px;
    min-width: 42px;
    height: 42px;
  }

  .xewex-search__overlay {
    align-items: stretch;
    padding: 0;
  }

  .xewex-search__panel {
    width: 100%;
    max-height: 100dvh;
    min-height: 100dvh;
    padding: calc(14px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    transform: translateY(-100%);
  }

  .xewex-search__heading {
    margin-bottom: 14px;
  }

  .xewex-search__title {
    font-size: 19px;
  }

  .xewex-search__field {
    min-height: 50px;
    padding: 0 13px;
  }

  .xewex-search__input {
    height: 48px;
    font-size: 16px;
  }

  .xewex-search__results {
    padding-bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .xewex-search__overlay,
  .xewex-search__panel,
  .xewex-search__toggle {
    transition: none;
  }

  .xewex-search__status.is-loading::before {
    animation: none;
  }
}
