/**
 * UpPay shared header search drawer (<=639px).
 * Opened by .uppay-site-header__search-trigger in the canonical header.
 * Source of truth: this file + js/uppay-header-search-drawer.js.
 */

#uppay-header-search-drawer,
#uppay-header-search-drawer *,
#uppay-header-search-drawer *::before,
#uppay-header-search-drawer *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-width: 0;
  border-style: solid;
  border-color: transparent;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-decoration: none;
  background: transparent;
  box-shadow: none;
  transform: none;
  -webkit-appearance: none;
  appearance: none;
}

#uppay-header-search-drawer {
  --uppay-header-search-drawer-top: var(--uppay-header-pad, 2.625rem);
  position: fixed;
  inset: 0;
  z-index: 48;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  color: #f8fafc;
  font-family: var(--uppay-font);
  line-height: 1.1;
  transition: opacity 0.18s ease, visibility 0s linear 0.18s;
}

#uppay-header-search-drawer.is-open {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
  transition: opacity 0.18s ease, visibility 0s linear 0s;
}

#uppay-header-search-drawer .uppay-header-search-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 18, 0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
}

#uppay-header-search-drawer .uppay-header-search-drawer__panel {
  position: absolute;
  top: var(--uppay-header-search-drawer-top);
  right: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4375rem;
  width: 100%;
  padding: 0.4375rem 0.5rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(16, 19, 24, 0.94);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 28px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}

#uppay-header-search-drawer .uppay-header-search-drawer__field {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
  height: 2rem;
  min-height: 2rem;
  padding: 0 0.5625rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#uppay-header-search-drawer .uppay-header-search-drawer__field:focus-within {
  border-color: rgba(140, 185, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(124, 92, 255, 0.12),
    0 0 14px rgba(0, 172, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#uppay-header-search-drawer .uppay-header-search-drawer__field-icon {
  display: block;
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
  color: #8ea0c8;
}

#uppay-header-search-drawer .uppay-header-search-drawer__input {
  flex: 1 1 auto;
  min-width: 0;
  color: #f8fafc;
  font-size: 0.625rem;
  font-weight: 600;
  outline: none;
  cursor: text;
}

#uppay-header-search-drawer .uppay-header-search-drawer__input::placeholder {
  color: #8ea0c8;
  font-weight: 500;
  opacity: 1;
}

#uppay-header-search-drawer .uppay-header-search-drawer__zakaz {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3125rem;
  width: 100%;
  height: 2rem;
  min-height: 2rem;
  padding: 0 0.625rem;
  border: 1px solid rgba(140, 185, 255, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow:
    0 0 0 1px rgba(124, 92, 255, 0.12),
    0 0 14px rgba(0, 172, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  font-size: 0.625rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

#uppay-header-search-drawer .uppay-header-search-drawer__zakaz-icon {
  display: block;
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
  color: var(--uppay-accent, #5ec8ff);
  fill: currentColor;
}

/* Иконка «Статьи» контурная: без заливки, линией текущего цвета. */
#uppay-header-search-drawer .uppay-header-search-drawer__articles-icon {
  fill: none;
  stroke: currentColor;
}

#uppay-header-search-drawer .uppay-header-search-drawer__zakaz:hover,
#uppay-header-search-drawer .uppay-header-search-drawer__zakaz:focus-visible {
  border-color: rgba(140, 185, 255, 0.75);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  outline: none;
}

@media (min-width: 640px) {
  #uppay-header-search-drawer {
    display: none;
  }
}

body.uppay-header-search-drawer-open {
  overflow: hidden;
}

/* Search results inside the drawer: same look as the desktop dropdown (css/uppay-shell.css .uppay-search-dd). */
#uppay-header-search-drawer .uppay-search-dd {
  display: none;
  max-height: min(320px, 50vh);
  overflow-y: auto;
  border-radius: 12px;
  border-width: 1px;
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(10, 12, 20, 0.96);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#uppay-header-search-drawer .uppay-search-dd.is-open {
  display: block;
}

#uppay-header-search-drawer .uppay-search-dd button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  color: #d1d9e8;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
}

#uppay-header-search-drawer .uppay-search-dd button:hover,
#uppay-header-search-drawer .uppay-search-dd button:focus-visible {
  border-color: rgba(79, 125, 255, 0.35);
  background: rgba(79, 125, 255, 0.1);
  color: #f1f5f9;
  outline: none;
}

#uppay-header-search-drawer .uppay-search-dd button:disabled {
  cursor: default;
  color: #8ea0c8;
  background: transparent;
  border-color: transparent;
}

#uppay-header-search-drawer .uppay-search-dd-icon {
  display: block;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 0.6rem;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#uppay-header-search-drawer .uppay-search-dd button > span {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}
