/* === ELENYS – Mobile side filter (clean, desktop-safe) === */

/* ---------- MOBILNÍ VERZE ---------- */
@media (max-width: 991.98px){
  :root{
    --rf-z: 10040;          /* z-index panelu */
    --rf-w: 86vw;           /* šířka panelu (můžeš změnit) */
    --rf-bg: #fff;          /* pozadí panelu */
    --rf-tab-bg: #f7c200;   /* žlutá záložky */
    --rf-tab-fg: #000;      /* barva textu na záložce */
  }

  /* Boční záložka „FILTR“ – 14px */
  .rf-tab{
    position: fixed;
    right: 0;
    top: 40%;
    transform: translateY(-50%);
    z-index: var(--rf-z);
    background: var(--rf-tab-bg);
    color: var(--rf-tab-fg);
    font: 600 14px/1.1 system-ui, -apple-system, Segoe UI, Roboto, Arial;
    padding: 6px 6px;
    border-radius: 10px 0 0 10px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: .04em;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    cursor: pointer;
    user-select: none;
  }

  /* Overlay */
  .rf-overlay{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: calc(var(--rf-z) - 1);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
  }
  body.rf-open .rf-overlay{ opacity: 1; pointer-events: auto; }

  /* Panel = #filters-wrapper (bez přesunu DOM)
     FLEX layout = žádné „bílé dno“, scrolluje jen obsah (když je dlouhý) */
  #filters-wrapper{
    position: fixed;
    top: 0; right: 0;
    height: 100dvh;
    max-height: 100dvh;
    width: var(--rf-w); max-width: 480px;
    background: var(--rf-bg);
    box-shadow: -16px 0 32px rgba(0,0,0,.18);
    z-index: var(--rf-z);
    transform: translateX(100%);
    transition: transform .28s ease;

    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0;
  }
  body.rf-open #filters-wrapper{ transform: translateX(0); }

  /* Horní lišta se zavíracím tlačítkem (pevná) */
  #filters-wrapper .rf-close{
    position: sticky;
    top: 0; right: 0; left: 0;
    background: #fff;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 12px;
    z-index: 1;
    flex: 0 0 auto;
  }
  #filters-wrapper .rf-close button{
    appearance: none;
    border: 1px solid #ddd;
    background: #fafafa;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font: 500 14px system-ui, -apple-system, Segoe UI, Roboto, Arial;
  }

  /* Vnitřek filtru – jediné scrollovací místo */
  #filters-wrapper .filters-wrapper{
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 0;
    margin-bottom: 0;
  }

  /* Zviditelnění obsahu filtru i když šablona používá „unveil“ */
  body.rf-open #filters-wrapper #filters{
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  /* Skryj interní „Otevřít filtr“ v panelu (máme vlastní záložku) */
  #filters-wrapper .filters-unveil-button-wrapper{
    display: none !important;
  }

  /* Ořež spodní rezervy typických bloků (proti „bílému dnu“) */
  #filters-wrapper .filter-sections,
  #filters-wrapper .filter-section,
  #filters-wrapper form,
  #filters-wrapper fieldset,
  #filters-wrapper .filter-section-count,
  #filters-wrapper .filter-total-count{
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }
}

/* ---------- DESKTOP RESET (jistota) ---------- */
@media (min-width: 992px){
  .rf-tab, .rf-overlay, #filters-wrapper .rf-close{
    display: none !important;
  }
  #filters-wrapper{
    position: static !important;
    right: auto !important;
    width: auto !important;
    height: auto !important;
    box-shadow: none !important;
    transform: none !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
  }
  body.rf-open #filters-wrapper{ transform: none !important; }
}
