/**
 * Mobilni layout: kategorije sakrivene, minimal header na odabranim stranicama,
 * kolaps pretrage na početnoj, sprečavanje iOS zoom-a na inputima (font ≥16px).
 */

@media (max-width: 768px) {
  /* Samo desktop traka kategorija sakrivena — drawer ima kopiju menija */
  .menubar-div.pv-category-strip.pv-strip-desktop {
    display: none !important;
  }

  /* Minimal header (oglas, user panel): samo sticky logo + Nazad — prazan <header> se ne prikazuje */
  .pv-fixed-header--mobile-minimal .pv-fixed-header-inner-desktop,
  .pv-fixed-header--mobile-minimal > .menubar-div.pv-category-strip {
    display: none !important;
  }

  .pv-fixed-shell > .pv-fixed-header--mobile-minimal.pv-fixed-header {
    display: none !important;
  }

  /* Ista tamna traka kao glavni header (.pv-fixed-header); poravnanje kao container */
  .pv-mobile-sticky-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 1300;
    min-height: 56px;
    padding-top: 8px;
    padding-bottom: 8px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    background: linear-gradient(180deg, #1b2430, #131a23);
    border-bottom: 1px solid #2a3748;
    box-shadow: 0 8px 22px rgba(10, 15, 25, 0.35);
    backdrop-filter: blur(2px);
  }

  .pv-mobile-sticky-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;
  }

  .pv-mobile-sticky-logo img {
    display: block;
    height: 40px;
    width: auto;
    max-height: 40px;
    filter: brightness(1.05);
  }

  .pv-mobile-back-btn {
    appearance: none;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 88px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.08);
    color: #dce7f7;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    box-sizing: border-box;
  }

  .pv-mobile-back-btn:active {
    background: rgba(255, 255, 255, 0.15);
  }

  a.pv-mobile-back-btn {
    text-decoration: none;
    color: #dce7f7;
  }

  a.pv-mobile-back-btn:hover {
    color: #fff;
  }

  /* Dugme „Kategorije“ u header redu — iznad savijenog auth reda, uvek klikabilno */
  .pv-fixed-header-inner-desktop {
    position: relative;
    z-index: 2;
  }

  .pv-header-categories-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 25;
    margin-left: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.08);
    color: #dce7f7;
    cursor: pointer;
    font-family: inherit;
  }

  .pv-header-logo-link {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
  }

  .pv-fixed-header--mobile-minimal .pv-header-categories-btn {
    display: none !important;
  }

  /*
   * Zatvoren drawer: samo [hidden] (ne :not(.is-open) — inače „treperi“ između skidanja hidden i dodavanja klase).
   * Nemoj linkovati CSS/theme.css paralelno sa modern-unified — ima zastarela .pv-fixed-header pravila.
   */
  #pv-mobile-nav-drawer[hidden] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .pv-mobile-nav-drawer.is-open:not([hidden]) {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 2600;
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
    transition: opacity 0.2s ease;
  }

  .pv-mobile-nav-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 25, 0.55);
    opacity: 0;
    transition: opacity 0.22s ease;
  }

  .pv-mobile-nav-drawer.is-open .pv-mobile-nav-drawer-backdrop {
    opacity: 1;
  }

  .pv-mobile-nav-drawer-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    max-height: min(88vh, 640px);
    display: flex;
    flex-direction: column;
    padding-top: 6px;
    background: linear-gradient(180deg, #1b2430, #131a23);
    border-bottom: 1px solid #2a3748;
    border-radius: 0 0 14px 14px;
    box-shadow: 0 16px 40px rgba(10, 15, 25, 0.45);
    transform: translateY(-105%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
  }

  .pv-mobile-nav-drawer.is-open .pv-mobile-nav-drawer-panel {
    transform: translateY(0);
  }

  .pv-mobile-nav-drawer-close {
    appearance: none;
    border: 0;
    background: transparent;
    color: #dce7f7;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
  }

  .pv-mobile-nav-drawer-close:active {
    background: rgba(255, 255, 255, 0.08);
  }

  /* Jedno × dugme — bez duplog naslova „Kategorije“ (to je već dugme u headeru) */
  .pv-mobile-nav-drawer-close--floating {
    position: absolute;
    top: 6px;
    right: 8px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    margin: 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    font-size: 22px;
    line-height: 1;
  }

  .pv-mobile-nav-drawer-close--floating:active {
    background: rgba(255, 255, 255, 0.14);
  }

  .pv-mobile-nav-drawer-body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 0 14px;
    flex: 1;
    min-height: 0;
  }

  .pv-mobile-nav-drawer-body .menubar-div.pv-category-strip {
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .pv-mobile-nav-drawer-body .pv-topnav .pv-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px 14px;
  }

  .pv-mobile-nav-drawer-body .pv-menu-group {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(122, 163, 215, 0.18);
    background: rgba(255, 255, 255, 0.04);
  }

  .pv-mobile-nav-drawer-body .pv-menu-dropdown-trigger {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 12px;
    font-size: 14px;
    color: #dce7f7;
    border-radius: 0;
    border: 0;
    background: rgba(255, 255, 255, 0.06);
  }

  /* Podmeni u draweru — samo kad je grupa otvorena (tap); bez hover „lepataka“ */
  .pv-mobile-nav-drawer-body .pv-submenu {
    position: static !important;
    display: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: rgba(0, 0, 0, 0.15) !important;
    padding: 4px 0 8px !important;
    max-height: none !important;
    pointer-events: auto !important;
  }

  .pv-mobile-nav-drawer-body .pv-menu-group.is-open > .pv-submenu {
    display: block !important;
  }

  .pv-mobile-nav-drawer-body .pv-menu-group:hover .pv-submenu {
    opacity: 1 !important;
    transform: none !important;
  }

  .pv-mobile-nav-drawer-body .pv-submenu a {
    display: block;
    padding: 8px 14px;
    color: #dce7f7;
    font-size: 14px;
  }

  .pv-mobile-nav-drawer-body .pv-menu > li > a {
    display: block;
    padding: 10px 12px;
    color: #dce7f7;
    border-radius: 10px;
    border: 1px solid rgba(122, 163, 215, 0.18);
    background: rgba(255, 255, 255, 0.04);
  }

  /* iPhone/iPad: spreči automatski zoom u inputima (<16px često trigguje zoom) */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="search"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Kolaps pretrage — forma u aside-u; dugme je u .pv-home-search-sticky-bar ispod headera */
  .pv-home-search-collapse .pv-home-sidebar {
    display: none !important;
  }

  .pv-home-search-collapse.is-open .pv-home-sidebar {
    display: block !important;
  }

  /* Sticky traka „Pretraga“ odmah ispod zaglavlja (zaglavlje ~92px na početnoj) */
  .pv-home-search-sticky-bar {
    display: none;
    position: sticky;
    top: 98px;
    z-index: 1185;
    margin: 0;
    padding: 6px 0 0;
    background: linear-gradient(180deg, #f8fafc 0%, #eef3fa 100%);
    border-bottom: 1px solid rgba(21, 59, 109, 0.12);
    box-shadow: 0 6px 16px rgba(15, 40, 70, 0.08);
  }

  .pv-home-page .pv-home-search-sticky-bar {
    display: block;
  }

  .pv-home-search-sticky-bar__inner {
    padding: 8px 0 12px;
  }

  .pv-home-search-sticky-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.02em;
    border-radius: 14px;
    border: 1px solid rgba(32, 132, 243, 0.35);
    background: linear-gradient(180deg, #ffffff 0%, #f0f6ff 55%, #e8f2ff 100%);
    color: #0f3d7a;
    cursor: pointer;
    font-family: inherit;
    box-shadow:
      0 4px 14px rgba(32, 100, 200, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.95);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  }

  .pv-home-search-sticky-btn:active {
    transform: scale(0.99);
  }

  .pv-home-search-sticky-btn__icon {
    display: flex;
    color: #2084f3;
  }

  .pv-home-search-sticky-btn__icon svg {
    display: block;
  }

  .pv-home-search-sticky-btn__text {
    flex: 1;
    text-align: center;
  }

  .pv-home-search-sticky-btn::after {
    content: "";
    display: inline-block;
    margin-left: auto;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 7px solid #153b6d;
    transition: transform 0.2s ease;
  }

  .pv-home-search-sticky-btn.is-open::after {
    transform: rotate(180deg);
  }

  /* Header red: Kategorije | Prijava | Registracija (ili Moj nalog + poruke) */
  .pv-home-page .pv-fixed-header--home-toolbar .grid_4.right {
    display: none !important;
  }

  .pv-home-page .pv-fixed-header--home-toolbar .pv-fixed-header-inner-desktop {
    flex-wrap: wrap;
    align-items: center;
  }

  .pv-home-header-toolbar {
    order: 2;
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    padding-top: 8px;
    margin-top: 2px;
    border-top: 1px solid rgba(122, 163, 215, 0.22);
    box-sizing: border-box;
  }

  .pv-home-header-toolbar .pv-header-nav-btn,
  .pv-home-header-toolbar .pv-header-nav-btn--categories {
    flex: 1 1 0;
    min-width: 0;
    margin-left: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.07);
    color: #eaf2ff;
    cursor: pointer;
    font-family: inherit;
    box-sizing: border-box;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }

  .pv-home-header-toolbar .pv-header-nav-btn--categories {
    border-color: rgba(147, 197, 253, 0.45);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.35) 0%, rgba(37, 99, 235, 0.22) 100%);
    color: #f0f7ff;
  }

  .pv-home-header-toolbar .pv-header-nav-btn--ghost {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.05);
    color: #dce7f7;
  }

  .pv-home-header-toolbar .pv-header-nav-btn--accent {
    border-color: rgba(52, 211, 153, 0.55);
    background: linear-gradient(180deg, #34d399 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
  }

  .pv-home-header-toolbar .pv-header-nav-msg {
    position: relative;
    flex: 0 0 52px;
    width: 52px;
    min-width: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: #c7e2ff;
    text-decoration: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .pv-home-header-toolbar .pv-header-nav-msg--has-unread {
    border-color: rgba(251, 191, 36, 0.55);
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.12) 100%);
    color: #fff7ed;
  }

  .pv-home-header-toolbar .pv-header-nav-msg__icon {
    display: flex;
  }

  .pv-home-header-toolbar .pv-header-nav-msg__icon svg {
    display: block;
  }

  .pv-home-header-toolbar .pv-header-nav-msg__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 900;
    line-height: 20px;
    text-align: center;
    border-radius: 999px;
    background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    border: 2px solid #1b2430;
  }

  /* Početna: forma pretrage ispod sticky trake */

  .pv-home-page .pv-home-hero .pv-home-eyebrow,
  .pv-home-page .pv-home-hero .pv-home-title,
  .pv-home-page .pv-home-hero .pv-home-subtitle,
  .pv-home-page .pv-home-hero .pv-home-feature-badges,
  .pv-home-page .pv-home-hero .pv-home-trust-note,
  .pv-home-page .pv-home-hero-actions .google-auth-button {
    display: none !important;
  }

  .pv-home-page .pv-home-hero {
    margin: 0 0 8px;
  }

  .pv-home-page .pv-home-hero-inner {
    padding: 0;
    min-height: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .pv-home-page .pv-home-hero-actions {
    margin-top: 0;
    justify-content: center;
    min-height: 0;
  }

  /* Ista svetla traka kao .pv-oglas-mobile-cta ispod „Pošalji poruku“ na oglasu */
  .pv-home-page .pv-home-hero-new-ad-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1180;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    box-sizing: border-box;
    padding: 10px max(14px, env(safe-area-inset-left)) calc(12px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right));
    margin: 0;
    border-radius: 0;
    background: rgba(252, 253, 255, 0.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(21, 59, 109, 0.14);
    box-shadow: 0 -8px 28px rgba(15, 35, 55, 0.1);
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .pv-home-page .pv-home-hero-new-ad-sheet .submit-button.pv-home-hero-new-ad {
    position: static;
    width: 100%;
    margin: 0;
    min-height: 46px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: normal;
    text-align: center;
    border-radius: 999px;
    box-shadow: 0 8px 22px rgba(32, 132, 243, 0.35);
  }

  .pv-home-page .pv-home-hero-new-ad-sheet .submit-button.pv-home-hero-new-ad:hover {
    box-shadow: 0 10px 24px rgba(32, 132, 243, 0.38);
  }

  .pv-home-page .pv-home-hero-new-ad-note {
    color: #5f758f;
    font-size: 12px;
    margin: 0;
  }

  .pv-home-page .pv-home-main-column {
    padding-bottom: calc(108px + env(safe-area-inset-bottom));
  }

  /* User panel — dugmad kod oglasa u koloni */
  .pv-userpanel-ad-card .pv-userpanel-ad-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
  }

  .pv-userpanel-ad-card .pv-userpanel-ad-actions a.submit-button,
  .pv-userpanel-ad-card .pv-userpanel-ad-actions button.submit-button {
    flex: 1 1 auto;
    min-width: calc(50% - 8px);
    text-align: center;
    box-sizing: border-box;
  }

  .pv-userpanel-ad-card .tabel_text2 p {
    margin-bottom: 0;
  }

  .pv-userpanel-ad-card .tabel_text_desno {
    display: block;
    margin-top: 8px;
  }
}

@media (min-width: 769px) {
  .pv-mobile-sticky-bar {
    display: none !important;
  }

  .pv-fixed-header--mobile-minimal .pv-fixed-header-inner-desktop {
    display: flex !important;
  }

  .pv-home-search-sticky-bar {
    display: none !important;
  }

  .pv-home-page .pv-fixed-header--home-toolbar .grid_4.right {
    display: flex !important;
  }

  .pv-fixed-header--home-toolbar .pv-home-header-toolbar {
    display: contents;
  }

  .pv-fixed-header--home-toolbar .pv-home-header-toolbar .pv-header-nav-btn--ghost,
  .pv-fixed-header--home-toolbar .pv-home-header-toolbar .pv-header-nav-btn--accent,
  .pv-fixed-header--home-toolbar .pv-home-header-toolbar .pv-header-nav-msg {
    display: none !important;
  }

  .pv-fixed-header--home-toolbar .pv-home-header-toolbar .js-pv-header-categories-open {
    margin-left: 8px;
  }
}

