/* The theme's own search (inc/search.php, search.js), proposal 2026-11-03:
   dropdown option B and results option 1. Loaded only while
   farmula_own_search is on. Tokens from home.css. */

/* link and chip colours: farmula.de's darker green; sites/topro/site.css
   sets topro's blues */
/* (fallbacks in each var(): search.css loads after site.css, so a :root
   block here would override the site's values) */

/* --- dropdown ------------------------------------------------------------ */
.search-drop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: min(560px, 70vh);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--light-blue);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(41, 38, 93, 0.14);
  padding: 6px 0;
  font-family: var(--font-body);
}
.search-drop[hidden] { display: none; }
.search-drop__item {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  color: var(--dark-grey);
  text-decoration: none;
  font-size: 16px;
  line-height: 22px;
}
.search-drop__item.is-active { background: var(--light-blue); }
/* only a real pointer hovers: iOS keeps :hover on the last tapped row */
@media (hover: hover) { .search-drop__item:hover { background: var(--light-blue); } }
.search-drop__ico { width: 16px; height: 16px; flex: 0 0 16px; color: var(--grey); }
.search-drop__term b { font-weight: 700; color: var(--blue); }
.search-drop__head {
  margin: 0;
  padding: 8px 16px 4px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grey);
}
.search-drop__head--sep { border-top: 1px solid var(--light-blue); margin-top: 6px; padding-top: 10px; }
.search-drop__prod img,
.search-drop__noimg { width: 44px; height: 44px; flex: 0 0 44px; object-fit: contain; border-radius: 6px; background: var(--light-blue); }
.search-drop__name { flex: 1; min-width: 0; font-weight: 500; color: var(--blue); }
.search-drop__name small { display: block; font-weight: 400; font-size: 13px; color: var(--grey); }
.search-drop__price { font-weight: 700; color: var(--blue); white-space: nowrap; font-variant-numeric: tabular-nums; }
.search-drop__all {
  border-top: 1px solid var(--light-blue);
  margin-top: 6px;
  padding-top: 12px;
  font-weight: 700;
  color: var(--search-link, #00806a);
}
.search-drop__none { margin: 0; padding: 12px 16px; color: var(--grey); }

/* --- phone: full-screen search (child of <body>, outside the zoomed .page) */
.search-overlay {
  /* border-box: search.js sets the height to the space above the keyboard,
     and the padding must fit inside it (Android cut the last row, 2026-11-03) */
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  background: #fff;
  padding: max(16px, env(safe-area-inset-top)) 16px 16px;
  font-family: var(--font-body);
}
.search-overlay[hidden] { display: none; }
html.is-search-open, html.is-search-open body { overflow: hidden; }
.search-overlay__bar { display: flex; gap: 12px; align-items: stretch; height: 48px; flex: 0 0 48px; }
.search-overlay__back {
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--light-blue);
  border-radius: var(--radius-btn);
  background: #fff;
  color: var(--grey);
  cursor: pointer;
}
.search-overlay__bar input[type="search"] {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--light-blue);
  border-right: none;
  border-radius: var(--radius-btn) 0 0 var(--radius-btn);
  font: 400 16px var(--font-body); /* 16px: iOS zooms into smaller fields */
  color: var(--dark-grey);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.search-overlay__bar input[type="search"]:focus { border-color: var(--green); }
.search-overlay__go {
  flex: 0 0 48px;
  margin-left: -12px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 0 var(--radius-btn) var(--radius-btn) 0;
  background: var(--green);
  color: #fff;
  cursor: pointer;
}
.search-drop--overlay {
  position: static;
  flex: 1;
  max-height: none;
  margin-top: 12px;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.search-drop--overlay .search-drop__item { padding: 6px 4px; min-height: 44px; }
.search-drop--overlay .search-drop__prod { min-height: 56px; }
.search-drop--overlay .search-drop__head { padding-left: 4px; }
/* the overlay ends at the keyboard (search.js sizes it to visualViewport);
   the link to all results stays in view at the list's foot */
.search-overlay { bottom: auto; height: 100%; }
.search-drop--overlay { min-height: 0; }
.search-drop--overlay .search-drop__all {
  position: sticky;
  bottom: 0;
  background: #fff;
  margin-top: 0;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* --- results page ---------------------------------------------------------- */
.shop-search { display: grid; gap: 24px; }
.shop-search__count { margin: 0; color: var(--grey); font-size: 16px; }
.search-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.search-chip {
  border: 1px solid var(--light-blue);
  border-radius: 99px;
  padding: 6px 16px;
  font-size: 15px;
  color: var(--blue);
  text-decoration: none;
  background: #fff;
}
.search-chip:hover { border-color: var(--green); }
.search-chip.is-on { border-color: var(--search-chip-on-border, var(--green)); background: var(--search-chip-on, #e6f6f3); color: var(--search-link, #00806a); font-weight: 700; }
.shop-search .shop__grid { margin: 0; }
.shop-search__related { margin: 16px 0 0; font-family: var(--font-display); color: var(--blue); font-size: 28px; letter-spacing: -1.12px; }

.product-card__sizes { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.product-card__sizes a {
  font-size: 13px;
  line-height: 20px;
  padding: 1px 8px;
  border: 1px solid var(--light-blue);
  border-radius: 4px;
  color: var(--dark-grey);
  text-decoration: none;
}
.product-card__sizes a:hover { border-color: var(--green); }
.product-card__sizes a.is-current { border-color: var(--blue); color: var(--blue); font-weight: 700; }

.search-articles {
  display: grid;
  gap: 6px;
  border: 1px dashed var(--light-blue);
  border-radius: 8px;
  padding: 14px 18px;
}
.search-articles__head { margin: 0; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--grey); }
.search-articles a { color: var(--search-link, #00806a); font-weight: 500; text-decoration: none; }
.search-articles a:hover { text-decoration: underline; }
/* .product__call carries grid-area: call from the product page; here it is one row of the list */
.shop-search__call { grid-area: auto; justify-self: start; }

.search-empty { display: grid; gap: 14px; }
.search-empty h2 { margin: 0; font-family: var(--font-display); color: var(--blue); font-size: 28px; letter-spacing: -1.12px; }
.search-empty p { margin: 0; font-size: 18px; }
.search-empty a { color: var(--search-link, #00806a); }

@media (max-width: 900px) {
  /* the plain form sits in the open menu like FiboSearch's wrapper did; the
     desktop offsets of .navbar--slogan / --plus2 would push it off screen */
  .navbar form.navbar__search { left: var(--page-margin); right: var(--page-margin); width: auto; }
  /* .shop__main is display: contents here and the shop orders its parts;
     the results block goes where the grid would, its own parts in order */
  .shop-search { order: 3; }
  .shop-search > *, .shop-search .shop__grid { order: 0; }
  /* bigger rows for thumbs, and the list scrolls inside the open menu */
  .search-drop__item { min-height: 44px; }
  .search-drop { max-height: 60vh; }
  .search-empty h2 { font-size: 24px; }
}
