/* Compact search with an inline, downward reveal. Both themes share the site
   tokens; the panel leaves the page and its mobile keyboard scrollable. */
.smart-search {
  --smart-soft: var(--theme-surface-soft, var(--paper));
  --smart-selected: var(--theme-selected, #fff3be);
  min-width: 0;
  width: 100%;
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 4px solid var(--yellow);
  border-radius: 16px;
  padding: clamp(20px, 3vw, 30px);
  box-shadow: var(--theme-shadow, 0 8px 28px rgb(28 33 40 / 7%));
}
.smart-search *, .smart-search *::before, .smart-search *::after { box-sizing: border-box; }
.smart-search .smart-heading { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; }
.smart-search .smart-heading h2 { font-family: var(--display); font-size: clamp(28px, 3.1vw, 39px); line-height: 1.08; margin: 0; color: var(--navy); }
.smart-heading-symbol { flex: 0 0 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--yellow); color: #1c2128; }
.smart-controls { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 12px; }
.smart-mode { display: flex; flex: 1 1 160px; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 11px; background: var(--smart-soft); }
.smart-search .smart-mode-button { min-width: 0; flex: 1; min-height: 44px; padding: 9px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; transition: color 150ms ease, background 150ms ease; }
.smart-search .smart-mode-button.is-selected { color: var(--navy); background: var(--white); border-color: var(--border); box-shadow: 0 1px 3px rgb(0 0 0 / 5%); }
.smart-search .smart-mode-button:focus-visible { outline: 2px solid var(--theme-focus, var(--cobalt)); outline-offset: 2px; }
.smart-search .smart-mode-hint { margin: 0 0 12px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.smart-vehicle-kind { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.smart-vehicle-kind > span { margin-right: auto; color: var(--muted); font-size: 12px; font-weight: 650; }
.smart-controls .smart-vehicle-kind { margin: 0; }
.smart-controls .smart-vehicle-kind > span { display: none; }
.smart-kind-options { display: flex; align-items: center; gap: 8px; }
.smart-search .smart-kind-button { min-height: 44px; min-width: 76px; border: 1px solid var(--border); border-radius: 9px; padding: 10px 16px; background: var(--smart-soft); color: var(--navy); font-size: 14px; font-weight: 650; transition: background 150ms ease, border-color 150ms ease; }
.smart-search .smart-kind-button.is-selected { background: var(--yellow); border-color: var(--yellow); color: #1c2128; }
.smart-search .smart-kind-button:focus-visible { outline: 2px solid var(--theme-focus, var(--cobalt)); outline-offset: 2px; }
.smart-required { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.smart-choice { min-width: 0; display: flex; align-items: center; border: 1px dashed var(--border); border-radius: 10px; background: var(--smart-soft); }
.smart-choice.is-selected { border-style: solid; border-color: var(--theme-border-strong, var(--border)); background: var(--smart-selected); }
.smart-choice:has(.smart-choice-main[aria-expanded='true']) { border-style: solid; border-color: var(--theme-focus, var(--cobalt)); box-shadow: 0 0 0 1px var(--theme-focus, var(--cobalt)); }
.smart-search button { font-family: inherit; cursor: pointer; }
.smart-choice-main { flex: 1; min-width: 0; min-height: 72px; padding: 12px; border: 0; background: transparent; color: var(--navy); text-align: left; }
.smart-choice-label { display: flex; align-items: center; flex-wrap: wrap; column-gap: 5px; row-gap: 3px; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.smart-choice-label small { margin-left: auto; font-size: 10px; color: var(--muted); font-weight: 400; }
.smart-choice-label svg { color: var(--navy); }
.smart-choice-number { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--muted); border-radius: 50%; font-size: 10px; }
.smart-choice-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; line-height: 1.4; font-weight: 650; }
.smart-search .smart-choice-remove, .smart-search .smart-option-remove, .smart-search .smart-query-clear, .smart-search .smart-toggle { display: inline-grid; flex: 0 0 44px; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.smart-search .smart-choice-remove { margin-right: 2px; }
.smart-query-zone { min-width: 0; }
.smart-query-label { display: block; margin: 0 0 5px; font-size: 12px; font-weight: 650; color: var(--navy); }
.smart-input-row { display: flex; align-items: center; min-width: 0; min-height: 58px; border: 1px solid var(--theme-border-strong, var(--border)); border-radius: 10px; padding: 0 5px 0 14px; background: var(--white); }
.smart-input-row:focus-within { outline: 2px solid var(--theme-focus, var(--cobalt)); outline-offset: 2px; }
.smart-input-symbol { display: grid; place-items: center; flex: 0 0 20px; color: var(--muted); margin-right: 9px; }
.smart-search .smart-query { width: 100%; flex: 1; min-width: 0; min-height: 56px; padding: 12px 0; border: 0; outline: 0; box-shadow: none; border-radius: 0; font: inherit; font-size: 16px; color: var(--navy); background: transparent; }
.smart-query::placeholder { color: var(--muted); opacity: 1; }
.smart-search .smart-query:focus-visible { outline: 0; }
.smart-search .smart-query-clear[hidden], .smart-search .smart-option-remove[hidden] { display: none; }
.smart-toggle svg { transition: transform 200ms ease; }
.smart-search.is-open .smart-toggle svg { transform: rotate(180deg); }
.smart-panel { display: grid; grid-template-rows: 0fr; opacity: 0; transform: translateY(-6px); transition: grid-template-rows 200ms ease, opacity 200ms ease, transform 200ms ease; }
.smart-search.is-open .smart-panel { grid-template-rows: 1fr; opacity: 1; transform: translateY(0); }
.smart-panel-inner { min-height: 0; overflow: hidden; }
.smart-suggestions { max-height: 260px; overflow-y: auto; overscroll-behavior: contain; scroll-padding: 8px; margin-top: 12px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--white); }
.smart-search .smart-suggestions[hidden] { display: none; }
.smart-group-title { margin: 4px 8px 2px; font-size: 10px; letter-spacing: .05em; font-weight: 700; text-transform: uppercase; line-height: 1.6; color: var(--muted); }
.smart-suggestion { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 10px 9px; border-radius: 7px; cursor: pointer; color: var(--navy); font-size: 14px; line-height: 1.35; }
.smart-suggestion > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.smart-suggestion > svg { flex: 0 0 16px; width: 16px; color: var(--muted); }
.smart-suggestion small { color: var(--muted); font-size: 10px; max-width: 42%; }
.smart-suggestion:hover, .smart-suggestion.is-active { background: var(--smart-selected); }
.smart-suggestion--text { border-top: 1px solid var(--border); margin-top: 5px; padding-block: 12px; }
.smart-suggestion--text strong { font-size: 13px; font-weight: 650; }
.smart-suggestion--text small { display: block; max-width: none; font-size: 12px; margin-top: 2px; }
.smart-no-suggestions { margin: 5px; padding: 10px 8px; color: var(--muted); font-size: 13px; }
.smart-options { min-width: 0; }
.smart-details { margin-top: 12px; border-top: 1px solid var(--border); }
.smart-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding-block: 10px; color: var(--navy); font-size: 12px; font-weight: 650; cursor: pointer; list-style: none; }
.smart-details > summary::-webkit-details-marker { display: none; }
.smart-search .smart-details > summary::after { content: none; }
.smart-details > summary svg { flex: 0 0 18px; transition: transform 180ms ease; }
.smart-details[open] > summary svg { transform: rotate(180deg); }
.smart-details > summary:focus-visible { outline: 2px solid var(--theme-focus, var(--cobalt)); outline-offset: 2px; border-radius: 6px; }
.smart-details-content { padding-bottom: 4px; }
.smart-details-title { margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 650; }
.smart-details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.smart-vehicle-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 14px; }
.smart-vehicle-grid--tuning { grid-template-columns: minmax(0, 1fr); }
.smart-detail { min-width: 0; }
.smart-detail label { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 650; color: var(--navy); }
.smart-search .smart-detail--variant, .smart-search .smart-detail--island { grid-column: 1 / -1; }
.smart-model-wrap, .smart-year-wrap, .smart-variant-wrap { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--white); min-width: 0; }
.smart-search .smart-model { min-width: 0; flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 5px; width: 100%; min-height: 46px; padding: 10px; border: 0; border-radius: 8px; background: transparent; color: var(--navy); font-size: 15px; text-align: left; }
.smart-model span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smart-model svg { flex: 0 0 16px; }
.smart-search .smart-model:disabled { color: var(--muted); cursor: not-allowed; background: var(--smart-soft); }
.smart-search .smart-year, .smart-search .smart-variant { min-width: 0; width: 100%; min-height: 46px; border: 0; border-radius: 8px; padding: 10px; color: var(--navy); background: transparent; font: inherit; font-size: 16px; }
.smart-year::placeholder, .smart-variant::placeholder { color: var(--muted); opacity: 1; }
.smart-search .smart-year:disabled, .smart-search .smart-variant:disabled { color: var(--muted); background: var(--smart-soft); cursor: not-allowed; }
.smart-detail-hint { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.smart-year[aria-invalid='true'] { outline: 2px solid var(--danger, #a82f3d); outline-offset: -2px; }
.smart-search .smart-island { display: block; width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 8px; padding: 10px; color: var(--navy); background: var(--white); font: inherit; font-size: 16px; }
.smart-search .smart-exact { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); min-height: 44px; margin-top: 10px; cursor: pointer; }
.smart-exact input { width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--theme-on-accent, #1c2128); }
.smart-search .smart-status { min-height: 20px; margin: 14px 0 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.smart-search .smart-status.is-ready { color: var(--navy); }
.smart-search .smart-submit { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 50px; border: 1px solid transparent; border-radius: 9px; padding: 13px 18px; font-size: 15px; font-weight: 750; line-height: 1.3; background: var(--yellow); color: #1c2128; transition: background 150ms ease, opacity 150ms ease; }
.smart-search .smart-submit:hover:not(:disabled) { background: var(--theme-accent-hover, #f4be00); }
.smart-search .smart-submit:disabled { cursor: not-allowed; opacity: 1; border-style: dashed; border-color: var(--theme-on-accent, #1c2128); }
.smart-search .smart-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.smart-search--catalog .smart-heading h2 { font-size: 29px; }
.smart-search--catalog { max-width: 100%; }
@media (min-width: 1000px) {
  .smart-search--catalog { display: grid; grid-template-columns: 1fr minmax(300px, 1fr); column-gap: 28px; row-gap: 10px; align-items: start; }
  .smart-search--catalog .smart-heading { grid-column: 1 / -1; grid-row: 1; margin-bottom: 4px; }
  .smart-search--catalog .smart-controls { grid-column: 1 / -1; grid-row: 2; margin-bottom: 0; justify-content: flex-start; }
  .smart-search--catalog .smart-mode { flex: 0 1 300px; }
  .smart-search--catalog .smart-mode-hint { grid-column: 1 / -1; grid-row: 3; margin-bottom: 0; }
  .smart-search--catalog .smart-required { grid-column: 1 / -1; grid-row: 4; margin-bottom: 0; }
  .smart-search--catalog [data-smart-vehicle-fields] { grid-column: 1 / -1; grid-row: 7; }
  .smart-search--catalog .smart-vehicle-grid { margin: 0; }
  .smart-search--catalog .smart-query-zone { grid-column: 1 / -1; grid-row: 5; }
  .smart-search--catalog .smart-panel { grid-column: 1 / -1; grid-row: 6; }
  .smart-search--catalog .smart-options { grid-column: 1 / -1; grid-row: 8; }
  .smart-search--catalog .smart-details { margin-top: 0; }
  .smart-search--catalog .smart-detail--variant, .smart-search--catalog .smart-detail--island { grid-column: auto; }
  .smart-search--catalog .smart-status { grid-column: 1; grid-row: 9; margin-block: 0; align-self: center; }
  .smart-search--catalog .smart-submit { grid-column: 2; grid-row: 9; }
  .smart-search--catalog .smart-note { grid-column: 1 / -1; grid-row: 10; margin-top: 0; }
}
@media (max-width: 600px) {
  .smart-search { padding: 18px; border-radius: 13px; }
  .smart-search .smart-heading { gap: 0; margin-bottom: 17px; }
  .smart-search .smart-heading h2 { font-size: 26px; }
  .smart-heading-symbol { display: none; }
  .smart-controls { gap: 8px; }
  .smart-mode { flex-basis: 100%; }
  .smart-controls .smart-vehicle-kind { width: 100%; }
  .smart-kind-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .smart-required { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 13px; }
  .smart-choice-main { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; column-gap: 10px; padding: 10px; min-height: 60px; }
  .smart-choice-label { font-size: 11px; }
  .smart-choice-label small { width: 100%; margin-left: 0; }
  .smart-choice-main strong { font-size: 14px; white-space: normal; text-overflow: clip; overflow: visible; overflow-wrap: anywhere; }
  .smart-search .smart-choice-remove { width: 44px; flex-basis: 44px; }
  .smart-input-row { padding-left: 10px; }
  .smart-input-symbol { display: none; }
  .smart-search .smart-toggle { width: 44px; flex-basis: 44px; }
  .smart-suggestions { max-height: 230px; }
  .smart-suggestion { font-size: 14px; min-height: 46px; }
  .smart-suggestion small { max-width: 38%; }
  .smart-details-grid, .smart-vehicle-grid { gap: 10px; }
  .smart-vehicle-grid > .smart-detail > label { min-height: 32px; }
  .smart-model span { white-space: normal; text-overflow: clip; overflow: visible; overflow-wrap: anywhere; }
  .smart-search.is-open { scroll-margin-bottom: 100px; }
}
@media (max-width: 359px) {
  .smart-search { padding: 14px; }
  .smart-search .smart-heading h2 { font-size: 26px; }
  .smart-details-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .smart-search .smart-panel, .smart-search .smart-toggle svg, .smart-search .smart-submit, .smart-search .smart-kind-button, .smart-search .smart-mode-button, .smart-details > summary svg { transition: none; }
}
