/* The search control and its live suggestions — the topbar pill, the shop's
   own form, the dropdown — and the catalogue's own filtering chrome: the two
   column layout, the category tree and the filter panel beside the register.
   Split out of app.css (#324) and out of card.css (#372). */

/* ---------- search + live suggest ---------- */
.dsearch, .search-pill { position: relative; }
.suggest {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  width: 100%;
  min-width: min(480px, calc(100vw - 32px));
  z-index: 70;
  /* Opaque, unlike every other panel: the suggestions float over whatever the
     page happens to be showing, and cream at 7 % over a photograph is not a
     list you can read. */
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-raised);
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--radius-card);
}
.suggest:empty { display: none; }
.suggest-h {
  font-family: var(--font-ui);
  font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-secondary);
  padding: 10px 12px 4px;
}
.suggest-row {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px;
  color: var(--text-primary);
  border-radius: var(--radius-control);
}
.suggest-row:hover, .suggest-row:focus-visible { background: var(--surface-warm); outline: none; }
.suggest-thumb {
  flex: none; width: 40px; height: 40px;
 overflow: hidden;
  background: var(--surface-lilac); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
}
.suggest-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.suggest-row .avatar { width: 34px; height: 34px; font-size: 14px; }
.suggest-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.suggest-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-sub { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-price { flex: none; font-weight: 700; font-size: 13px; }
.suggest-none { padding: 14px 12px; color: var(--text-secondary); font-size: 13.5px; }
.suggest-all {
  display: block;
  min-height: 42px;
  margin-block-start: 4px;
  padding: 10px 12px 8px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12.5px;
}
.suggest-all:hover, .suggest-all:focus-visible {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  outline: none;
}
.suggest-all-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggest-all-label strong { color: var(--text-primary); font-weight: 650; }

.search-pill {
  display: flex; align-items: center; gap: 8px;
  height: 44px;
  padding: 0 16px;
  background: var(--surface-card);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-control);
}
.search-pill.live { color: var(--text-primary); }
.search-pill input { flex: 1; border: 0; outline: 0; background: transparent; height: 100%; }
.search-icon { display: flex; color: var(--state-success); }
.search-icon svg { width: 17px; height: 17px; }
.search-form { display: flex; flex-direction: column; gap: 10px; }
.filter-row { display: flex; gap: 8px; }
.filter-row > * { flex: 1; min-width: 0; }

/* ---------- the species and locality pickers on /sell and /shop ---------- */
/* Moved out of app.css with #351: the same panel problem, the same sheet. */
.species-field { position: relative; }
.species-drop {
  position: absolute; top: 100%; inset-inline-start: 0;
  width: 100%; z-index: 70;
  margin-top: 6px;
  /* Opaque, like the header's suggestions (#351): the list floats over the
     labels, selects and checkboxes of the form behind it, and transparency
     leaves both layers unreadable. */
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-raised);
  overflow: hidden;
  max-height: 320px; overflow-y: auto;
  border-radius: var(--radius-card);
}
.species-drop:empty { display: none; }
.species-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 13px;
  background: none; border: 0; cursor: pointer; text-align: start;
  color: var(--text-primary);
  border-radius: var(--radius-control);
  min-height: 44px;
}
.species-row:hover, .species-row:focus-visible { background: var(--surface-warm); outline: none; }
.species-pl { font-weight: 600; font-size: 13.5px; }
.species-la { flex: 1; font-style: italic; font-size: 12.5px; color: var(--text-secondary); }
.species-ax {
  flex: none;
  font-family: var(--font-ui); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; background: var(--action-primary); color: var(--action-ink);
  border-radius: var(--radius-pill);
}
.species-ax.free { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-strong); }
.species-none { padding: 12px 13px; color: var(--text-secondary); font-size: 13px; }

/* The catalogue species result needs room for a common name and Latin name.
   Locality suggestions deliberately keep the compact shared layout above. */
.shop-species-field .species-drop { padding: 6px; scrollbar-width: thin; }
.shop-species-field .species-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: var(--radius-media);
}
.shop-species-field .species-pl { line-height: 1.35; }
.shop-species-field .species-la {
  flex: none;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
@media (min-width: 900px) { .shop-species-field .species-drop { width: 380px; } }

/* ---------- shop catalog ---------- */
.shop-layout { display: flex; flex-direction: column; gap: 14px; }
.shop-side { display: none; }
.shop-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.shop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.filter-sheet summary { list-style: none; cursor: pointer; width: fit-content; }
.filter-sheet summary::-webkit-details-marker { display: none; }
.filter-sheet[open] summary { background: var(--text-primary); color: var(--surface-page); border-color: var(--text-primary); }
.filter-sheet .filters-form {
  margin-top: 10px;
  padding: 16px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}
.filters-form { display: flex; flex-direction: column; gap: 12px; }
.filters-form label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 13px; }
.filters-form label.check { flex-direction: row; align-items: center; gap: 8px; }

@media (min-width: 900px) {
  .shop-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: var(--space-8);
    align-items: start;
  }
  .shop-side {
    display: flex; flex-direction: column; gap: 16px;
  }
  .cat-tree {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    padding: 10px;
    display: flex; flex-direction: column; gap: 2px;
    box-shadow: var(--shadow-raised);
    border-radius: var(--radius-card);
  }
  .cat-root {
    display: block;
    padding: 9px 12px;
    font-weight: 600; font-size: 14px;
    cursor: pointer;
    list-style: none;
    border-radius: var(--radius-control);
  }
  .cat-root::-webkit-details-marker { display: none; }
  .cat-root:hover { background: var(--surface-warm); }
  .cat-root.on { color: var(--action-primary); }
  .cat-children { display: flex; flex-direction: column; padding-inline-start: 12px; }
  .cat-children a { padding: 6px 12px; font-size: 13.5px; color: var(--text-secondary); border-radius: var(--radius-control); }
  .cat-children a:hover { background: var(--surface-warm); color: var(--text-primary); }
  .cat-children a.on { color: var(--action-primary); font-weight: 700; background: color-mix(in srgb, var(--action-primary) 8%, transparent); }
  .side-filters {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    padding: 16px;
    box-shadow: var(--shadow-raised);
    border-radius: var(--radius-card);
  }
  .side-h {
    margin: 0 0 12px;
    font-family: var(--font-ui); font-weight: 400;
    font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
    color: var(--text-secondary);
  }
}
