/* ==========================================================================
   OstuGrupp — Live AJAX search dropdown
   Search-as-you-type results panel attached to the header search input.
   Uses the design tokens from main.css. JS injects the markup at runtime;
   header.php is never edited.
   ========================================================================== */

/* The header search becomes the positioning context for the dropdown.
   .header-search already exists in main.css (flex pill); we only add
   relative positioning + a tiny class the JS sets while active. */
.header-search.og-ls-host { position: relative; }

/* Keep the input pill clipping off so the panel can overflow below it. */
.header-search.og-ls-host { overflow: visible; }

/* ---- Dropdown panel ---- */
.og-ls-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: auto;
  width: min(420px, calc(100vw - 48px));
  z-index: 300;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card-hover);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(.99);
  transform-origin: top right;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.og-ls-panel[hidden] { display: none; }
.og-ls-host.og-ls-open .og-ls-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* decorative top accent — mirrors the mega-menu panel */
.og-ls-panel::before {
  content: "";
  position: absolute;
  right: 20px;
  top: 0;
  height: 3px;
  width: 64px;
  background: linear-gradient(90deg, var(--green), var(--green-dark));
  border-radius: 0 0 4px 4px;
}

/* ---- Section heading ---- */
.og-ls-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--slate-500);
  padding: 16px 18px 8px;
  margin: 0;
}

/* ---- Results list ---- */
.og-ls-list {
  list-style: none;
  margin: 0;
  padding: 0 8px 6px;
  max-height: min(60vh, 440px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.og-ls-item { margin: 0; }
.og-ls-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius);
  transition: background .15s ease;
  color: var(--fg);
}
.og-ls-item a:hover,
.og-ls-item.is-active a {
  background: var(--muted);
}
.og-ls-item.is-active a { box-shadow: inset 0 0 0 1px rgba(5,150,105,.3); }

.og-ls-thumb {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--muted);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.og-ls-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.og-ls-detail { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.og-ls-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.og-ls-item a:hover .og-ls-title,
.og-ls-item.is-active a .og-ls-title { color: var(--green-dark); }

.og-ls-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.og-ls-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--slate-dark);
  font-variant-numeric: tabular-nums;
}
.og-ls-price del { color: var(--slate-400); font-weight: 500; font-size: 12.5px; opacity: .7; margin-right: 5px; }
.og-ls-price ins { text-decoration: none; color: var(--green-dark); }

.og-ls-badge {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.5;
}
.og-ls-badge--sale { background: rgba(5,150,105,.12); color: var(--green-dark); }
.og-ls-badge--oos { background: var(--muted); color: var(--slate-600); }

/* ---- Footer "view all" link ---- */
.og-ls-foot {
  border-top: 1px solid var(--border);
  padding: 6px 8px;
}
.og-ls-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  color: var(--green-dark);
  transition: background .15s ease, gap .2s ease;
}
.og-ls-all:hover,
.og-ls-all.is-active {
  background: rgba(5,150,105,.08);
  color: var(--green);
}
.og-ls-all .og-ls-all-arrow { transition: transform .2s ease; }
.og-ls-all:hover .og-ls-all-arrow,
.og-ls-all.is-active .og-ls-all-arrow { transform: translateX(3px); }

/* ---- Loading state ---- */
.og-ls-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px;
  color: var(--slate-500);
  font-size: 14px;
  font-weight: 500;
}
.og-ls-state--empty { flex-direction: column; align-items: flex-start; gap: 4px; }
.og-ls-empty-title { font-weight: 600; color: var(--slate-dark); font-size: 14.5px; }
.og-ls-empty-hint { color: var(--slate-500); font-size: 13px; }

.og-ls-spinner {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: og-ls-spin .7s linear infinite;
}
@keyframes og-ls-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .og-ls-spinner { animation-duration: 1.4s; }
}

/* Skeleton rows shown while the first request is in flight. */
.og-ls-skeleton { padding: 8px; }
.og-ls-skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
}
.og-ls-skeleton-thumb,
.og-ls-skeleton-line {
  background: linear-gradient(90deg, var(--muted) 25%, #e9eef5 37%, var(--muted) 63%);
  background-size: 400% 100%;
  animation: og-ls-shimmer 1.3s ease infinite;
  border-radius: 8px;
}
.og-ls-skeleton-thumb { width: 52px; height: 52px; flex-shrink: 0; border-radius: 10px; }
.og-ls-skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.og-ls-skeleton-line { height: 11px; }
.og-ls-skeleton-line.is-short { width: 45%; height: 12px; }
@keyframes og-ls-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .og-ls-skeleton-thumb, .og-ls-skeleton-line { animation: none; }
}

/* Scrollbar polish for the results list. */
.og-ls-list::-webkit-scrollbar { width: 8px; }
.og-ls-list::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 999px; border: 2px solid #fff; }
.og-ls-list::-webkit-scrollbar-track { background: transparent; }

/* Visually-hidden live region for screen readers (status announcements). */
.og-ls-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(1px,1px,1px,1px);
  white-space: nowrap;
}
