/* Pretraga: dugme u headeru, prozor sa rezultatima, stranica rezultata */

/* Dugme */
.sg-search-toggle { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: 6px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--sg-primary); cursor: pointer; transition: background-color .2s, color .2s; }
.sg-search-toggle:hover, .sg-search-toggle:focus-visible { background: var(--sg-sky-50); color: var(--sg-primary-700); }
.sg-search-toggle svg { width: 21px; height: 21px; }
@media (max-width: 1180px) { .sg-search-toggle { margin-left: auto; margin-right: 6px; } }

/* Prozor */
html.sg-search-open { overflow: hidden; }
.sg-search[hidden] { display: none; }
.sg-search { position: fixed; inset: 0; z-index: 100001; padding: 10vh 16px 16px; }
.sg-search__backdrop { position: absolute; inset: 0; background: rgba(10, 29, 69, .55); backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s ease; }
.sg-search__panel { position: relative; max-width: 680px; margin: 0 auto; overflow: hidden; border-radius: var(--sg-radius); background: #fff; box-shadow: var(--sg-shadow-lg); opacity: 0; transform: translateY(-12px) scale(.98); transition: opacity .2s ease, transform .2s ease; }
.sg-search.is-open .sg-search__backdrop, .sg-search.is-open .sg-search__panel { opacity: 1; transform: none; }
.sg-search__form { position: relative; display: flex; align-items: center; gap: 12px; margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--sg-line); }
.sg-search__form::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 30%; height: 2px; background: linear-gradient(90deg, transparent, var(--sg-primary), transparent); opacity: 0; }
.sg-search.is-loading .sg-search__form::after { opacity: 1; animation: sg-search-loading 1s ease-in-out infinite; }
@keyframes sg-search-loading { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.sg-search__icon { display: inline-flex; flex-shrink: 0; color: var(--sg-primary); }
.sg-search__icon svg { width: 22px; height: 22px; }
.sg-search input.sg-search__input { flex: 1; min-width: 0; height: auto; padding: 6px 0; border: 0; outline: 0; box-shadow: none; background: transparent; font-family: var(--sg-font-body); font-size: 18px; color: var(--sg-ink); }
.sg-search__input::-webkit-search-cancel-button { display: none; }
.sg-search .sg-search__close { flex-shrink: 0; padding: 4px 9px; border: 1px solid var(--sg-line); border-radius: 6px; background: var(--sg-bg-alt); font-size: 12px; line-height: 1.4; color: var(--sg-muted); cursor: pointer; }
.sg-search__results { max-height: min(60vh, 520px); overflow-y: auto; }
.sg-search__results:empty { display: none; }
.sg-search__list { margin: 0; padding: 8px; list-style: none; }
.sg-search__msg { margin: 0; padding: 24px 20px; font-size: 15px; color: var(--sg-muted); }
.sg-search__all { display: block; padding: 14px 20px; border-top: 1px solid var(--sg-line); background: var(--sg-bg-alt); color: var(--sg-primary); font-weight: 700; font-size: 14px; text-decoration: none; }
.sg-search__all:hover { background: var(--sg-sky-50); }

/* Stavka rezultata (prozor + stranica) */
.sg-result { display: flex; align-items: center; gap: 16px; padding: 12px; border-radius: 10px; color: inherit; text-decoration: none; transition: background-color .15s; }
.sg-result:hover, .sg-result.is-active { background: var(--sg-sky-50); }
.sg-result__thumb { flex-shrink: 0; width: 56px; height: 56px; overflow: hidden; border-radius: 8px; background: var(--sg-bg-alt); }
.sg-result__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sg-result__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sg-result__type { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sg-primary); }
.sg-result__title { font-family: var(--sg-font-head); font-size: 15.5px; font-weight: 700; line-height: 1.35; color: var(--sg-ink); }
.sg-result__summary { font-size: 14px; line-height: 1.45; color: var(--sg-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sg-result mark { padding: 0 .1em; border-radius: 3px; background: rgba(161, 218, 248, .55); color: inherit; }

/* Stranica rezultata */
.sg-search-page__form { display: flex; width: 100%; max-width: 640px; margin: 0 0 14px; padding: 6px; border: 1px solid var(--sg-line); border-radius: 999px; background: #fff; box-shadow: var(--sg-shadow); }
.sg-search-page__form:focus-within { border-color: var(--sg-primary); }
.sg-search-page__form input[type="search"] { flex: 1; min-width: 0; height: auto; padding: 0 18px; border: 0; outline: 0; box-shadow: none; background: transparent; font-size: 16px; }
.sg-search-page__form button { padding: 12px 26px; border: 0; border-radius: 999px; background: var(--sg-primary); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; transition: background-color .2s; }
.sg-search-page__form button:hover { background: var(--sg-primary-700); }
.sg-search-page__count { margin: 0 0 22px; font-size: 14px; color: var(--sg-muted); }
.sg-search-page__list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.sg-search-page__list .sg-result { padding: 16px; border: 1px solid var(--sg-line); background: #fff; }
.sg-search-page__list .sg-result:hover { border-color: #cfe0ec; background: #f7fbfe; }
.sg-search-page__list .sg-result__thumb { width: 84px; height: 84px; }
.sg-search-page__list .sg-result__title { font-size: 18px; }
.sg-search-page__empty { padding: 40px 20px; border-radius: 12px; background: var(--sg-bg-alt); text-align: center; color: var(--sg-muted); }
.sg-search-page__empty p { margin: 0 0 6px; }
.sg-search-page__pag { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 32px; }
.sg-search-page__pag .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 10px; border-radius: 8px; background: var(--sg-bg-alt); color: var(--sg-ink); text-decoration: none; font-weight: 600; }
.sg-search-page__pag .page-numbers.current { background: var(--sg-primary); color: #fff; }
@media (max-width: 480px) {
  .sg-search-page__list .sg-result__thumb { width: 60px; height: 60px; }
  .sg-search-page__form button { padding-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .sg-search__backdrop, .sg-search__panel { transition: none; }
  .sg-search.is-loading .sg-search__form::after { animation: none; }
}

/* Polje bez okvira (pregazi globalni stil inputa iz teme) */
.sg-search .sg-search__form input.sg-search__input[type=search] { flex: 1 1 auto !important; width: auto !important; min-width: 0 !important; height: auto !important; margin: 0 !important; padding: 8px 0 8px 14px !important; border: 0 !important; border-radius: 0 !important; outline: 0 !important; box-shadow: none !important; background: transparent !important; font-size: 18px !important; line-height: 1.4 !important; }
.sg-search .sg-search__form:focus-within { border-bottom-color: var(--sg-primary); }

.sg-search .sg-search__form .sg-search__icon { margin-right: 4px; }
