/* Korak 12: mobilni javni portal i kontekstualni fiksni filteri. */
@media(max-width:760px) {
  /* Javni portal: tri prečice; na detalju oglasa samo dve ispod kontaktnih akcija. */
  body:not(.portal-mode-seller):not(.search-with-fixed-filters) { padding-bottom: calc(76px + env(safe-area-inset-bottom)) !important; }
  body:not(.portal-mode-seller):has(.listing-page) { padding-bottom: calc(166px + env(safe-area-inset-bottom)) !important; }
  .mobile-nav.compact-public-nav {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    height: calc(66px + env(safe-area-inset-bottom)) !important;
    padding: 3px 6px env(safe-area-inset-bottom) !important;
    border-top: 1px solid #dce7e1;
    background: rgba(255,255,255,.98);
  }
  .mobile-nav.compact-public-nav.compact-listing-nav { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
  .mobile-nav.compact-public-nav a {
    display:flex !important; flex-direction:column !important; justify-content:center !important;
    gap:2px !important; min-width:0 !important; min-height:50px;
    font-size:11px !important; font-weight:650; line-height:1.25;
  }
  .mobile-nav.compact-public-nav a span { font-size:21px !important; line-height:1 !important; }
  body:has(.listing-page) .mobile-listing-contact { bottom: calc(73px + env(safe-area-inset-bottom)) !important; }
  /* Na rezultatima samo JEDNA fiksna traka: Početna, Pretraga i Filteri. */
  body.search-with-fixed-filters { padding-bottom: calc(78px + env(safe-area-inset-bottom)) !important; }
  .mobile-search-filter-bar {
    position: fixed; z-index:105; left:0; right:0; bottom:0;
    display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-items:center;
    gap:4px; min-height:calc(68px + env(safe-area-inset-bottom));
    background:#fff; border-top:1px solid #d7e3dd;
    padding:6px 10px calc(6px + env(safe-area-inset-bottom));
    box-shadow:0 -5px 20px rgb(0 0 0 / 8%);
  }
  .mobile-search-filter-bar a, .mobile-search-filter-bar button {
    display:flex; flex-direction:column; justify-content:center; align-items:center;
    gap:2px; min-width:0; min-height:52px; margin:0; padding:5px 7px;
    border:0; border-radius:12px; background:transparent;
    font:inherit; font-size:11px; font-weight:700; color:#254b3f;
    text-decoration:none; line-height:1.25;
  }
  .mobile-search-filter-bar a span, .mobile-search-filter-bar button span {
    font-size:21px; line-height:22px;
  }
  .mobile-search-filter-bar button {background:#e9f3ef;color:#155642;cursor:pointer}
  .mobile-search-filter-bar button[aria-expanded="true"] {background:#d7e9e0}
  .mobile-search-filter-bar a:focus-visible, .mobile-search-filter-bar button:focus-visible {
    outline:2px solid #176b52;outline-offset:-2px;
  }
  .mobile-search-filter-bar[hidden] {display:none !important}
  /* Pozadina iza mobilnih filtera: ne prekriva sam formular. */
  body.filters-open { overflow: hidden; }
  .mobile-filters-scrim {
    position: fixed;
    inset: 0;
    z-index: 115;
    background: rgb(8 21 18 / 52%);
    border: 0;
    border-radius: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .mobile-filters-scrim[hidden] { display: none !important; }
  body.filters-open .mobile-filters-scrim {
    opacity: 1;
    pointer-events: auto;
  }
  .results-layout > .filters {
    z-index: 120;
    max-height: min(85dvh, 780px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
  .results-layout > .filters .filter-head button {
    min-width: 44px;
    min-height: 44px;
  }
}
@media(min-width:761px) { .mobile-search-filter-bar {display:none !important;} }
@media(prefers-reduced-motion:reduce){.mobile-filters-scrim{transition:none}}

/* Landscape: navigacija i kontakt traka ostaju u dva nepreklopljena reda. */
@media(max-width:760px) and (orientation:landscape) and (max-height:650px) {
  .mobile-nav.compact-public-nav { height:44px !important; padding:1px 4px !important; }
  .mobile-nav.compact-public-nav a { min-height:40px; font-size:9px !important; gap:0 !important; }
  .mobile-nav.compact-public-nav a span { font-size:16px !important; }
  body:has(.listing-page) .mobile-listing-contact {bottom:46px !important;}
  .mobile-search-filter-bar {min-height:46px;padding:2px 8px;}
  .mobile-search-filter-bar a,.mobile-search-filter-bar button {min-height:39px;gap:0;font-size:9px;}
  .mobile-search-filter-bar a span,.mobile-search-filter-bar button span {font-size:16px;line-height:17px;}
}

/* Korak 12b: pet podesivih stavki + zasebno dugme Filteri na rezultatima. */
@media (max-width:760px) {
  .mobile-nav.configurable-public-nav {
    display:grid !important;
    grid-template-columns:repeat(var(--mobile-nav-count, 5), minmax(0,1fr)) !important;
    height:calc(66px + env(safe-area-inset-bottom)) !important;
    padding:3px 4px env(safe-area-inset-bottom) !important;
    background:rgba(255,255,255,.98);
    border-top:1px solid #dce7e1;
  }
  .mobile-nav.configurable-public-nav a {
    display:flex !important; flex-direction:column; align-items:center;
    justify-content:center; gap:2px !important;
    padding:3px 1px; min-width:0; min-height:46px;
    text-align:center; text-decoration:none; font-size:10px !important;
    line-height:1.2; overflow:hidden;
  }
  .mobile-nav.configurable-public-nav a span {font-size:20px !important;line-height:1.1 !important}
  body:not(.portal-mode-seller) {padding-bottom:calc(77px + env(safe-area-inset-bottom)) !important}
  body:has(.listing-page) .mobile-listing-contact {bottom:calc(73px + env(safe-area-inset-bottom)) !important}
  body:not(.portal-mode-seller):has(.listing-page) {padding-bottom:calc(170px + env(safe-area-inset-bottom)) !important}
  body.search-with-fixed-filters {padding-bottom:calc(85px + env(safe-area-inset-bottom)) !important}
  .mobile-search-filter-bar {
    position:fixed;z-index:105;right:14px;left:auto;bottom:calc(74px + env(safe-area-inset-bottom));
    display:block;min-height:0;height:auto;padding:0;border:0;background:transparent;box-shadow:none;
  }
  .mobile-search-filter-bar button {
    display:flex;flex-direction:row;gap:8px;align-items:center;
    min-height:46px;min-width:100px;padding:8px 16px;
    border:1px solid #bbd8cb;border-radius:24px;
    background:#145743;color:#fff;font-size:13px;font-weight:800;
    box-shadow:0 3px 12px rgba(0,0,0,.2);
  }
  .mobile-search-filter-bar button span {font-size:19px;line-height:1}
  .mobile-search-filter-bar button[aria-expanded="true"] {background:#0d4938;color:#fff}
}
@media (max-width:760px) and (orientation:landscape) and (max-height:650px) {
  .mobile-nav.configurable-public-nav {height:44px !important;padding:1px 4px !important}
  .mobile-nav.configurable-public-nav a {min-height:38px;font-size:8px !important;gap:0 !important}
  .mobile-nav.configurable-public-nav a span {font-size:15px !important}
  .mobile-search-filter-bar {bottom:calc(49px + env(safe-area-inset-bottom))}
  .mobile-search-filter-bar button {min-height:38px;min-width:90px;font-size:11px;padding:5px 10px}
  body:has(.listing-page) .mobile-listing-contact {bottom:46px !important}
}
