/* === v1.51 skica: tražilica vozila u zaglavlju dosjea i stranice oglasa ======================================
   app.js "[v1.51 skica] Tražilica" + vozila/vehicle-search.mjs. Samo raspored; boje su tokeni (svijetla tema i iCare). */

/* === v1.51 fixb: polje u SREDINI trake zaglavlja (QX-05 / QX-09) ===============================================
   ui.pageHeader({ centerHtml }) -> .ui-head-center između naslova (.ui-head-main) i radnji (.page-actions).
   - Široko (sadržaj zaglavlja ≥ 820 px): jedan red. Lijevi i desni dio rastu jednako, pa je sredina polja sredina
     TRAKE: desni padding zaglavlja ima 78 px rezerve za kružić obaveza, zato lijevi dio kreće od 78 px. Kad desne radnje
     (oglas: "Dosje →", cijena) trebaju više, desni dio uzme koliko treba, a polje se malo pomakne ulijevo — nikad preko
     naslova ni radnji. Polje 420 px; na užem zaglavlju se suzi (do 340 px) prije nego naslov ostane bez mjesta — uže od
     340 px nikad (placeholder "Traži vozilo — šasija, registracija, model…" ostaje cijeli).
   - Usko (izbornik prikvačen na 1100 px, prozor ≤ 860 px): naslov u svom redu, ispod polje (do 480 px) i radnje. */
.ui-head-center { display: flex; min-width: 0; }
.ui-head-center > .vqs { flex: 1 1 auto; max-width: none; min-width: 0; }
.app-shell:not(.mobile-shell) .page-header.ui-page-head:not(.has-tabs):has(> .ui-head-center) {
  flex-direction: row; flex-wrap: wrap; align-items: center; container: vqs-head / inline-size;
}
.app-shell:not(.mobile-shell) .page-header.ui-page-head:not(.has-tabs):has(> .ui-head-center) > .ui-head-main { flex: 1 0 100%; min-width: 0; }
.app-shell:not(.mobile-shell) .page-header.ui-page-head:not(.has-tabs):has(> .ui-head-center) > .ui-head-center { flex: 1 1 260px; max-width: 480px; }
.app-shell:not(.mobile-shell) .page-header.ui-page-head:not(.has-tabs):has(> .ui-head-center) > .page-actions { flex: 0 1 auto; align-self: center; }
@media (min-width: 861px) {
  @container vqs-head (min-width: 820px) {
    .app-shell:not(.mobile-shell) .page-header.ui-page-head:not(.has-tabs):has(> .ui-head-center) > .ui-head-main { flex: 1 1 78px; min-width: 150px; }
    .app-shell:not(.mobile-shell) .page-header.ui-page-head:not(.has-tabs):has(> .ui-head-center) > .ui-head-center { flex: 0 1 clamp(360px, 100cqw - 580px, 420px); min-width: 360px; max-width: 420px; }
    .app-shell:not(.mobile-shell) .page-header.ui-page-head:not(.has-tabs):has(> .ui-head-center) > .page-actions { flex: 1 1 0; min-width: max-content; flex-wrap: nowrap; }
    /* dosje: bez radnji desno — prazan desni dio iste širine drži polje u sredini */
    .app-shell:not(.mobile-shell) .page-header.ui-page-head:not(.has-tabs):has(> .ui-head-center):not(:has(> .page-actions))::after { content: ""; flex: 1 1 0; }
  }
  /* bez radnji desno (dosje) jedan red stane i na užem zaglavlju (izbornik prikvačen na 1100 px) */
  @container vqs-head (min-width: 640px) and (max-width: 819.98px) {
    .app-shell:not(.mobile-shell) .page-header.ui-page-head:not(.has-tabs):has(> .ui-head-center):not(:has(> .page-actions)) > .ui-head-main { flex: 1 1 78px; min-width: 150px; }
    .app-shell:not(.mobile-shell) .page-header.ui-page-head:not(.has-tabs):has(> .ui-head-center):not(:has(> .page-actions)) > .ui-head-center { flex: 0 1 360px; min-width: 360px; max-width: 420px; }
    .app-shell:not(.mobile-shell) .page-header.ui-page-head:not(.has-tabs):has(> .ui-head-center):not(:has(> .page-actions))::after { content: ""; flex: 1 1 0; }
  }
}
/* osnovica polja (u zaglavlju ga raspoređuje .ui-head-center iznad; mobilni sloj .vqs--sheet) */
.vqs { position: relative; flex: 1 1 260px; max-width: 420px; min-width: 220px; }
.vqs-input { height: var(--control-h); padding-left: 34px; padding-right: 34px; border-radius: var(--radius-pill); background: var(--surface); }
.vqs-icon { position: absolute; left: 12px; top: 50%; translate: 0 -50%; display: inline-flex; color: var(--ink-3); pointer-events: none; }
.vqs-kbd {
  position: absolute; right: 10px; top: 50%; translate: 0 -50%;
  min-width: 20px; height: 20px; padding: 0 5px; display: inline-grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--radius-xs); background: var(--surface-soft);
  color: var(--ink-3); font: 600 11.5px/1 var(--num); pointer-events: none;
}
.vqs-input:focus ~ .vqs-kbd,
.vqs-input:not(:placeholder-shown) ~ .vqs-kbd { display: none; }

/* Padajući popis: ispod polja, sredinom (polje je u sredini zaglavlja), iznad ljepljivih traka (z-menu) */
.vqs-pop {
  position: absolute; top: calc(100% + 6px); left: 50%; translate: -50% 0; z-index: var(--z-menu);
  width: max(100%, 500px); max-width: min(580px, calc(100vw - 32px));
  max-height: min(470px, 70vh); overflow-y: auto; overscroll-behavior: contain;
  padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-pop); text-align: left;
}
.vqs-pop[hidden] { display: none; }
.vqs-list { display: grid; gap: 2px; }
.vqs-row {
  position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 6px 8px 6px 6px; border-radius: var(--radius); cursor: pointer;
}
.vqs-row.is-active { background: var(--brand-soft); }
.vqs-row.is-current .vqs-title { color: var(--ink-2); }
.vqs-thumb {
  width: 64px; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden;
  border-radius: var(--radius-sm); background: var(--surface-soft); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3);
}
.vqs-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vqs-thumb svg { width: 22px; height: 22px; }
.vqs-main { display: grid; gap: 3px; min-width: 0; }
.vqs-title {
  color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vqs-title::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }   /* cijeli redak = glavna poveznica */
.vqs-version { color: var(--ink-3); font-size: 12.5px; font-weight: 450; }
.vqs-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; color: var(--ink-3); font-size: 12.5px; }
.vqs-plate { padding: 0 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); color: var(--ink-2); font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; }
.vqs-vin, .vqs-internal { color: var(--ink-2); font-family: var(--num); font-size: 12px; letter-spacing: 0.02em; white-space: nowrap; }
.vqs-internal { font-family: inherit; letter-spacing: 0; }
.vqs-row mark { padding: 0 1px; border-radius: 2px; background: var(--warn-soft); color: var(--ink); font-weight: 700; box-shadow: 0 0 0 1px var(--warn-line); }
.vqs-side { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.vqs-current { color: var(--ink-3); font-size: 12px; }
/* mala poveznica na drugo (Oglas / Dosje) iznad rastegnute poveznice retka */
.vqs-alt { position: relative; z-index: 1; padding: 2px 4px; color: var(--ink-3); font-size: 12px; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; }
.vqs-alt:hover { color: var(--brand-strong); text-decoration-color: currentColor; }
.vqs-hint, .vqs-more { margin: 0; padding: 10px; color: var(--ink-3); font-size: 13px; }
.vqs-hint.is-error { color: var(--danger); }
.vqs-more { padding: 6px 10px 4px; font-size: 12px; }

/* Mobitel: povećalo u gornjoj traci (dosje) / u zaglavlju (oglas) otvara sloj preko cijele širine */
.vqs-sheet-host { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(16, 20, 24, 0.45); }
.vqs-sheet {
  display: flex; flex-direction: column; max-height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) 12px 8px; border-bottom: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-pop);
}
.vqs-sheet-bar { display: flex; align-items: center; gap: 8px; }
.vqs--sheet { flex: 1 1 auto; min-width: 0; }
.vqs--sheet .vqs-input { height: 44px; font-size: 16px; }   /* 16 px: iOS ne zumira pri fokusu */
.vqs-sheet-close { flex: 0 0 auto; }
button.icon-btn.vqs-sheet-close { width: 44px; height: 44px; }
.vqs-pop--sheet {
  position: static; translate: none; width: auto; max-width: none; max-height: none; flex: 1 1 auto;
  margin-top: 8px; padding: 0; border: 0; box-shadow: none; background: transparent;
}
.vqs-pop--sheet .vqs-row { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; padding: 8px 4px; }
.vqs-pop--sheet .vqs-thumb { width: 56px; }
.vqs-pop--sheet .vqs-side { flex-direction: column; align-items: flex-end; gap: 6px; }
.vqs-pop--sheet .vqs-alt { padding: 6px 2px; }
