/* ================================================================
   search-persistent.css — Pazar.top
   Desktop  : tražilica centrirana u headeru, uvijek vidljiva
   Mobilni  : lupa → klik → panel se spušta s animacijom + overlay
   ================================================================ */

/* ── GLOBALNI DEFAULT: lupa sakrivena, panel skriven ────────── */
.mob-search-btn {
  display: none !important;
}
#mob-search-panel {
  display: none;
}
#mob-search-overlay {
  display: none;
}

/* ── DESKTOP ≥ 769px ─────────────────────────────────────────── */
@media (min-width: 769px) {
  #main-header .header-search {
    display: flex !important;
    flex: 1;
    max-width: 500px;
    border-radius: 999px;
    border: 1.5px solid #e2e8f0;
    overflow: hidden;
    background: #f8fafc;
    align-items: stretch;
    transition: border-color .2s, box-shadow .2s, background .2s;
  }

  #main-header .header-search:focus-within {
    border-color: #007BFF;
    box-shadow: 0 0 0 3px rgba(0,123,255,.13);
    background: #fff;
  }

  #main-header .header-search input {
    flex: 1;
    padding: .55rem 1.1rem;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    color: #1a1a2e;
    min-width: 0;
  }

  #main-header .header-search input::placeholder {
    color: #9ca3af;
  }

  #main-header .header-search button {
    padding: .5rem 1rem;
    background: linear-gradient(90deg, #007BFF, #00C2FF);
    color: #fff;
    border: none;
    border-radius: 0 999px 999px 0;
    font-size: 16px;
    cursor: pointer;
    transition: filter .15s;
    display: flex;
    align-items: center;
    gap: .3rem;
    white-space: nowrap;
  }

  #main-header .header-search button:hover {
    filter: brightness(1.08);
  }
}

/* ── MOBILNI ≤ 768px ─────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Visina headera — kompaktan jedan red */
  :root {
    --header-h: 58px !important;
  }

  body {
    padding-top: 58px !important;
  }

  #main-header {
    height: 58px !important;
    min-height: 58px !important;
    padding: 0 .7rem !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
    gap: .2rem !important;
    align-items: center;
  }

  #main-header .logo {
    flex: 1 1 auto;
    min-width: 0;
  }

  #main-header .logo svg {
    height: 32px !important;
  }

  .header-right {
    gap: .15rem !important;
  }

  /* Desktop search: skriven na mobilnom */
  #main-header .header-search {
    display: none !important;
  }

  /* ── Lupa dugme: vidljiva samo na mobilnom ── */
  .mob-search-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #374151;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s, color .15s;
  }

  .mob-search-btn:hover {
    background: #f1f5f9;
  }

  .mob-search-btn.open {
    background: #dbeafe;
    color: #1d4ed8;
  }

  .mob-search-btn svg {
    width: 20px;
    height: 20px;
    display: block;
    pointer-events: none;
  }

  /* ── Overlay (taman pozadina iza panela) ── */
  #mob-search-overlay {
    display: block;
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15,23,42,.5);
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: opacity .2s ease;
  }

  #mob-search-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* ── Search panel: spušta se animirano ── */
  #mob-search-panel {
    display: block;
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    z-index: 1101;
    background: #fff;
    border-bottom: 2px solid #dbeafe;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    transform: translateY(-110%);
    opacity: 0;
    pointer-events: none;
    transition: transform .23s cubic-bezier(.4,0,.2,1),
                opacity .18s ease;
    will-change: transform, opacity;
  }

  #mob-search-panel.open {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto;
  }

  /* Forma unutar panela */
  #mob-search-panel form {
    display: flex;
    align-items: center;
    padding: .65rem .85rem;
    gap: 0;
  }

  #mob-search-panel input[type=text] {
    flex: 1;
    font-size: 16px;
    line-height: 1.5;
    padding: .65rem 1rem;
    border: 1.5px solid #d1d5db;
    border-right: none;
    border-radius: 10px 0 0 10px;
    outline: none;
    background: #f8fafc;
    color: #1a1a2e;
    -webkit-appearance: none;
    transition: border-color .18s, box-shadow .18s;
  }

  #mob-search-panel input[type=text]:focus {
    border-color: #007BFF;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,123,255,.1);
  }

  #mob-search-panel input[type=text]::placeholder {
    color: #9ca3af;
  }

  #mob-search-panel button[type=submit] {
    padding: .65rem 1.1rem;
    background: linear-gradient(90deg, #007BFF, #00C2FF);
    color: #fff;
    border: none;
    border-radius: 0 10px 10px 0;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .35rem;
    font-weight: 600;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: filter .15s;
  }

  #mob-search-panel button[type=submit]:active {
    filter: brightness(.92);
  }
}

/* ── EXTRA MALI ≤ 380px ─────────────────────────────────────── */
@media (max-width: 380px) {
  #main-header {
    padding: 0 .5rem !important;
  }

  #main-header .logo svg {
    height: 28px !important;
  }

  .mob-search-btn {
    width: 34px !important;
    height: 34px !important;
  }
}

/* ── Sakrij header tražilicu na početnoj stranici ────────────────
   (homepage ima svoju veliku tražilicu u hero sekciji)          */
body.page-home #main-header .header-search {
  display: none !important;
}

/* ── DODATNO: na HOME stranici sakrij i mobilnu lupu + panel + overlay ── */
@media (max-width: 768px) {
  body.page-home .mob-search-btn,
  body.page-home #mob-search-panel,
  body.page-home #mob-search-overlay {
    display: none !important;
  }
}