/* =========================================================
   BF Sortiment-Filter / Sidebar (namespaced)
   Mobile: Hybrid-Docking (bar wird beim Andocken fixed)
   Desktop/Tablet: KEIN Sticky mehr (läuft normal im Flow)
========================================================= */

/* Stabilisiert Layout bei Scrollbars (reduziert "Verrutschen") */
html{ scrollbar-gutter: stable; }

/* Globale Variablen */
:root{
  --bf-header-offset: 72px;     /* Fallback, wird per JS dynamisch gesetzt */
  --bf-togglebar-h: 76px;       /* Fallback, wird per JS dynamisch gesetzt */
  --bf-gap: 10px;
  --bf-sb-pad: 12px;
}

/* =========================================================
   BF Filter (namespaced)
========================================================= */
.bf-sf{
  --bf-green:#057652;
  --bf-text:#111;
  --bf-muted:#777;
  --bf-border:#cfcfcf;
  --bf-bg:#fff;
  --bf-shadow:0 12px 30px rgba(0,0,0,0.08);

  font-size: clamp(0.85rem, 0.8rem + 0.3vw, 1.0rem);
  font-family: "Jost-Medium";
  font-weight: normal;
  line-height: clamp(1.4rem, 1.25rem + 0.5vw, 1.6rem);
  letter-spacing: clamp(0.03rem, 0.02rem + 0.25vw, 0.1rem);
}

.sidebar .bf-sf{
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Card */
.bf-sf__card{
  background: var(--bf-bg);
  border-radius: 1.25rem;
  box-shadow: var(--bf-shadow);
  padding: 1.25rem 1.1rem 1.1rem;
  color: var(--bf-text);
}

/* Header */
.bf-sf__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  margin-bottom:1rem;
}

.bf-sf__title{
  font-family: "Jost-Medium";
  font-weight: normal;
  font-size: 1.05rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Badge / Merkzettel */
.bf-sf__badge{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  min-width: 2.2rem;
}

.bf-sf__count{
  position:absolute;
  top:-0.9rem;
  left:-1.35rem;
  background:#59BE49;
  color:#fff;
  font-size:0.8rem;
  width:2.4rem;
  height:1.4rem;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:600;
  box-shadow: 0 0 0 2px #fff;
}

/* Optional (wenn du es nutzt) */
.bf-sf__hamburger{
  width:1.8rem;
  height:1.6rem;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}
.bf-sf__hamburger span{
  display:block;
  height:3px;
  border-radius:999px;
  background: var(--bf-green);
}

/* Search */
.bf-sf__search{ margin-bottom: 1rem; }
.bf-sf__searchInner{
  border-radius:999px;
  border:2px solid #444;
  padding:0.55rem 0.85rem;
  display:flex;
  align-items:center;
  gap:0.6rem;
  background: transparent;
}
.bf-sf__searchInner input{
  flex: 1;
  line-height: 1;
  padding: 0;
  border:none;
  outline:none;
  width:100%;
  min-width:0;
  font-size:1rem;
  background:transparent;
  color:inherit;
}
.bf-sf__searchInner input::placeholder{ color: var(--bf-muted); }
.bf-sf__searchIcon{
  display:flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  flex-shrink:0;
}
.bf-sf__searchIcon img{ display:block; height:1.25rem; width:auto; }

/* Kategorienbereich: nicht zwangsweise scrollen */
.bf-sf__scroll{
  max-height: none;
  overflow: visible;
}

/* Accordion */
.bf-sf__cat{
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--bf-border);
  padding-bottom: 1rem;
}
.bf-sf__cat:last-of-type{
  border-bottom:none;
  margin-bottom:0;
  padding-bottom:0;
}

.bf-sf__cat summary{
  list-style:none;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:0.75rem;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.16em;
  font-size:0.9rem;
  outline:none;
}
.bf-sf__cat summary::-webkit-details-marker{ display:none; }

.bf-sf__cat summary:focus-visible{
  outline: 3px solid var(--bf-text);
  outline-offset: 4px;
  border-radius: 0.5rem;
}

.bf-sf__ind{
  position:relative;
  width:1.7rem;
  height:1.7rem;
  border-radius:50%;
  border:2px solid var(--bf-text);
  flex-shrink:0;
}
.bf-sf__cat[open] .bf-sf__ind{ border-color: var(--bf-green); }
.bf-sf__cat[open] .bf-sf__ind::before{
  content:"";
  position:absolute;
  inset:4px;
  border-radius:50%;
  background: var(--bf-green);
}

.bf-sf__sub{
  margin: 0.75rem 0 0 3.05rem;
  padding:0;
  list-style:none;
  display:flex;
  flex-direction:column;
  gap:0.35rem;
  font-size:1rem;
  line-height:1.35;
}
.bf-sf__sub .is-highlight{
  color: var(--bf-green);
  font-weight:600;
}

/* Warenkorb-Icon */
.bf-sf__icon{
  display:block;
  width:2.2rem;
  height:2.2rem;
  background: url("../gfx/bf-img/icons/merkzettel.svg") no-repeat center / contain;
}

/* Optional: respektiert reduzierte Bewegung */
@media (prefers-reduced-motion: reduce){
  .bf-sb__scroll{ scroll-behavior: auto; }
}

/* =========================================================
   Toggle: keine umlaufende Linie
========================================================= */
.bf-sb-toggle{
  border: none !important;
  outline: none;
  box-shadow: none;
}
.bf-sb-toggle:focus,
.bf-sb-toggle:focus-visible{
  outline: none !important;
}

/* =========================================================
   Mobile: Toggle-Optik + Hybrid-Docking
========================================================= */
@media (max-width: 991.98px){

  /* Bar: viewportbreit (auch wenn in .container/.col) */
  .bf-sb__bar{
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 0.75rem 1rem;
    box-sizing: border-box;
    background: transparent;
    position: static;
    z-index: 1;
  }

  /* Button: Icon + Text nebeneinander */
  .bf-sb-toggle{
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;

    min-height: 72px;
    padding: 1.05rem 1.5rem;

    border: 0;
    border-radius: 999px;

    background: #057652;
    color: #fff;

    font-family: "Jost-Medium","Jost",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
    font-weight: normal;

    text-transform: uppercase;
    letter-spacing: 0.07em;
    line-height: 1.1;

    box-shadow: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .bf-sb-toggle:focus-visible{
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,255,255,.35);
  }

  .bf-sb-toggle__icon{
    width: 1.85rem;
    height: 1.85rem;
    flex: 0 0 auto;
    background: url("../gfx/bf-img/icons/hamburger-white.svg") no-repeat center / contain;
  }

  .bf-sb-toggle[aria-expanded="true"] .bf-sb-toggle__icon{
    background-image: url("../gfx/bf-img/icons/close-white.svg");
  }

  .bf-sb-toggle__label{
    white-space: nowrap;
    text-align: left;
    font-size: clamp(0.95rem, 0.88rem + 0.5vw, 1.15rem);
    letter-spacing: 0.07em;
  }

  /* Scrollbereich: erst im Docking-Zustand aktiv */
  .bf-sb__scroll{
    overflow: visible;
    padding-top: 0;
    max-height: none;
  }

  /* Docking: Bar wird fixed, darf nicht schrumpfen */
  .bf-sb.is-docked .bf-sb__bar{
    position: fixed;
    top: var(--bf-header-offset);
    left: 0;
    right: 0;

    width: 100vw;
    max-width: 100vw;

    z-index: 1030;

    padding-left: 1rem;
    padding-right: 1rem;
  }

  .bf-sb.is-docked .bf-sb__scroll{
    overflow: auto;
    -webkit-overflow-scrolling: touch;

    padding-top: calc(var(--bf-togglebar-h) + 8px);
    max-height: calc(100vh - var(--bf-header-offset));
  }
}

/* =========================================================
   Desktop/Tablet: ausdrücklich KEIN Sticky mehr
========================================================= */
@media (min-width: 992px){

  /* Mobile-Bar auf Desktop unsichtbar */
  .bf-sb__bar{
    display: none !important;
  }

  /* Wrapper/Scroll: normaler Flow */
  .bf-sb__scroll{
    overflow: visible !important;
    max-height: none !important;
    padding-top: 0 !important;
  }

  /* Sidebar: sicher keine Sticky/Fixed Reste */
  #sidebar,
  .sidebar{
    position: static !important;
    top: auto !important;
    bottom: auto !important;
  }

  /* falls irgendwo inline transform gesetzt wurde */
  #sidebar[style]{
    transform: none !important;
  }
}
