/* The pill provides the input's keyboard focus ring. */
.lwr-search { position: relative; }
.lwr-search:focus-within { box-shadow: 0 0 0 2px var(--lwr-teal); }
.lwr-search input:focus { outline: none; }

.lwr-search__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: 380px;
  max-width: calc(100vw - 32px);
  padding: 8px;
  border-radius: 22px;
  background: var(--lwr-card);
  box-shadow: 0 16px 40px rgba(16,24,40,0.16);
}

.lwr-search__option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 12px;
  border-radius: 14px;
  color: var(--lwr-ink);
  text-decoration: none;
}
.lwr-search__option.is-active,
.lwr-search__option:hover { background: var(--lwr-bg); }
.lwr-search__icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--lwr-teal-soft);
  color: var(--lwr-teal);
}
.lwr-search__icon svg { width: 16px; height: 16px; }
.lwr-search__text { flex: 1; min-width: 0; }
.lwr-search__name,
.lwr-search__meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lwr-search__name { font-size: 16px; font-weight: 700; }
.lwr-search__meta { font-size: 13px; color: var(--lwr-muted); }
.lwr-search__code { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--lwr-teal); }
.lwr-search__empty { margin: 0; padding: 14px 12px; font-size: 15px; color: #3E4A5A; }
.lwr-search__all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin-top: 4px;
  padding: 0 12px;
  border-top: 1px solid var(--lwr-line);
  font-size: 14px;
  font-weight: 600;
  color: var(--lwr-teal);
}

.lwr-search__panel[hidden],
.lwr-search__empty[hidden],
.lwr-search-sheet[hidden],
.lwr-search-sheet__popular[hidden] { display: none; }

.lwr-search-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow-y: auto;
  padding: 0 16px 24px;
  background: var(--lwr-bg);
}
.lwr-search-sheet__bar { display: flex; align-items: center; gap: 10px; height: 64px; }
.lwr-search-sheet__form { flex: 1; min-width: 0; margin: 0; }
.lwr-search-sheet__form label {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 16px;
  border-radius: 23px;
  background: var(--lwr-card);
  box-shadow: 0 0 0 2px var(--lwr-teal);
}
.lwr-search-sheet__form svg { flex-shrink: 0; width: 18px; height: 18px; color: var(--lwr-teal); }
.lwr-search-sheet__form input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--lwr-ink);
  font: inherit;
  font-size: 16px;
}
.lwr-search-sheet__form input:focus { outline: none; }
.lwr-search-sheet__form input::placeholder { color: var(--lwr-muted); opacity: 1; }
.lwr-search-sheet__cancel {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--lwr-teal);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
/* Keep results below the bar, in the sheet's normal document flow. */
.lwr-search-sheet .lwr-search__panel {
  position: static;
  width: auto;
  max-width: none;
  margin-top: 8px;
  padding: 6px;
  box-shadow: none;
}
.lwr-search-sheet .lwr-search__option { min-height: 56px; }
.lwr-search-sheet__popular h2 {
  margin: 20px 4px 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lwr-muted);
}
.lwr-search-sheet__popular-list { padding: 6px; border-radius: 22px; background: var(--lwr-card); }
.lwr-search-sheet__popular a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 12px;
  color: var(--lwr-ink);
  font-size: 16px;
  font-weight: 600;
}
.lwr-search-sheet__popular a + a { border-top: 1px solid var(--lwr-line); }
.lwr-search-sheet__popular a span { color: var(--lwr-teal); }
.lwr-search-sheet__all {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  margin-top: 14px;
  border-radius: 24px;
  background: var(--lwr-ink);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
}
@media (max-width: 767px) {
  body.lwr-search-open { overflow: hidden; }
}
@media (min-width: 768px) {
  .lwr-search-sheet { display: none !important; }
}
