/* ==========================================================================
   Felgen-Filter CSS - prok-raeder.de
   Compact horizontal filter bar, dropdown panels, active states,
   mobile fullscreen overlay, AJAX loading states.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. FILTER BAR (desktop)
   -------------------------------------------------------------------------- */

.felgen-filter-row {
  display: flex !important;
  flex-wrap: wrap;
  gap: 0;
  padding: 0;
  margin: 0 !important;
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 6px;
}

/* Bootstrap column reset inside the filter row */
.felgen-filter-row > .col-sm,
.felgen-filter-row > [class*="col-"] {
  flex: 1 1 auto !important;
  width: 0 !important;
  max-width: none !important;
  min-width: 0 !important;
  padding: 0 !important;
}

/* --------------------------------------------------------------------------
   2. FILTER BUTTONS
   -------------------------------------------------------------------------- */

.felgen-filter-row .dropdown {
  position: relative;
}

.felgen-filter-row .dropbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 44px;
  padding: 6px 4px;
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.2px;
  color: #555;
  background: transparent;
  border: none;
  border-right: 1px solid #e8e8e8;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  white-space: normal;
  word-break: break-word;
  line-height: 1.25;
}

/* Rounded corners on first/last */
.felgen-filter-row > :first-child .dropbtn {
  border-radius: 6px 0 0 6px;
}
.felgen-filter-row > :nth-child(10) .dropbtn,
.felgen-filter-row > :last-child .dropbtn {
  border-right: none;
  border-radius: 0 6px 6px 0;
}


/* Chevron indicator */
.felgen-filter-row .dropbtn::after {
  content: '';
  display: inline-block;
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 3.5px solid #aaa;
  transition: transform 0.2s, border-color 0.2s;
}

/* Hover */
.felgen-filter-row .dropbtn:hover {
  background: #eee;
  color: #222;
}
.felgen-filter-row .dropbtn:hover::after {
  border-top-color: #666;
}

/* Open state */
.felgen-filter-row .dropdown.active .dropbtn {
  background: #333;
  color: #fff;
}
.felgen-filter-row .dropdown.active .dropbtn::after {
  border-top-color: #fff;
  transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   3. ACTIVE FILTER INDICATOR ON BUTTON
   When a non-default filter is selected, the dropdown gets .has-active-filter.
   Button text is replaced by JS; here we style the visual cue.
   -------------------------------------------------------------------------- */

.felgen-filter-row .dropdown.has-active-filter .dropbtn {
  color: #c0392b;
  font-weight: 700;
}
.felgen-filter-row .dropdown.has-active-filter .dropbtn::after {
  border-top-color: #c0392b;
}
.felgen-filter-row .dropdown.has-active-filter .dropbtn:hover {
  color: #a93226;
}

/* Small dot under the button text when filter is active */
.felgen-filter-row .dropdown.has-active-filter .dropbtn::before {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c0392b;
}

/* --------------------------------------------------------------------------
   4. DROPDOWN PANELS
   -------------------------------------------------------------------------- */

.dropdown-content {
  display: none;
  position: absolute;
  z-index: 1050;
  top: calc(100% + 2px);
  left: 0;
  min-width: 180px;
  max-width: 260px;
  max-height: 300px;
  overflow-y: auto;
  padding: 6px 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  -webkit-overflow-scrolling: touch;
}

.dropdown-content.show {
  display: block;
  animation: ffFadeIn 0.12s ease-out;
}

@keyframes ffFadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Right-align dropdowns for the last few columns to prevent overflow */
.felgen-filter-row > :nth-child(n+7) .dropdown-content {
  left: auto;
  right: 0;
}

/* --------------------------------------------------------------------------
   5. DROPDOWN LIST ITEMS
   -------------------------------------------------------------------------- */

.dropdown-content ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dropdown-content ul li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dropdown-content ul li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  color: #333;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.3;
  transition: background-color 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-content ul li a:hover {
  background: #f5f5f5;
  color: #000;
}

/* --------------------------------------------------------------------------
   6. ACTIVE ITEMS INSIDE DROPDOWNS
   Visual indicator for currently selected filter values.
   -------------------------------------------------------------------------- */

.dropdown-content ul li a.active {
  background: #f0f7ff;
  color: #1a5276;
  font-weight: 600;
  position: relative;
  padding-left: 28px;
}

/* Checkmark before active items */
.dropdown-content ul li a.active::before {
  content: '\2713';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  color: #1a5276;
}

.dropdown-content ul li a.active:hover {
  background: #dbeafe;
}

/* --------------------------------------------------------------------------
   6b. GRÖSSEN-FILTER: Flex-Badges mit farbigem Rand
   -------------------------------------------------------------------------- */

#zollgroessenDropdown ul {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 10px;
}
#zollgroessenDropdown ul li a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 4px 10px;
  border-radius: 20px; border: 2px solid #ddd;
  font-weight: 600; font-size: 13px; text-align: center;
  transition: border-color 0.15s, color 0.15s;
}
#zollgroessenDropdown ul li a:hover { border-color: #999; background: #f5f5f5; }
#zollgroessenDropdown ul li a.active {
  border-color: #1a5276; border-width: 3px; color: #1a5276;
  background: #f0f7ff; font-weight: 700; padding-left: 10px;
}
#zollgroessenDropdown ul li a.active::before { content: none; display: none; }
#zollgroessenDropdown ul li a.active:hover { border-color: #0d3b5c; background: #dbeafe; }

/* --------------------------------------------------------------------------
   7. FARBEN (COLOR) IMAGES IN DROPDOWNS
   -------------------------------------------------------------------------- */

.dropdown-content ul li a img {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  border: 1px solid #ddd;
  object-fit: cover;
  vertical-align: middle;
  flex-shrink: 0;
}

.dropdown-content ul li a.active img {
  border-color: #1a5276;
  box-shadow: 0 0 0 2px #1a5276;
}

/* --------------------------------------------------------------------------
   7b. FARBEN-GRID
   -------------------------------------------------------------------------- */

#colourDropdown ul {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 6px; padding: 10px;
}
#colourDropdown ul li a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 6px; border-radius: 6px; gap: 2px;
}
#colourDropdown ul li a img { width: 30px; height: 30px; border-radius: 4px; }
#colourDropdown ul li a.active {
  background: #f0f7ff; padding-left: 6px; border: 2px solid #1a5276;
}
#colourDropdown ul li a.active::before { content: none; display: none; }
#colourDropdown.dropdown-content { min-width: 260px; }

/* --------------------------------------------------------------------------
   8. HERSTELLER SEARCH INPUT
   -------------------------------------------------------------------------- */

.dropdown-content input[type="text"] {
  display: block;
  width: calc(100% - 16px);
  padding: 7px 10px;
  margin: 4px 8px 6px;
  font-size: 13px;
  border: 1px solid #ddd;
  border-radius: 4px;
  outline: none;
  box-sizing: border-box;
  background: #fafafa;
}
.dropdown-content input[type="text"]:focus {
  border-color: #999;
  background: #fff;
}

/* --------------------------------------------------------------------------
   9. SELECT BOXES (Sommer/Winter, Sortierung)
   -------------------------------------------------------------------------- */

.select_box {
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #555;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   10. FILTER RESET / ACTIVE FILTER PILLS
   -------------------------------------------------------------------------- */

.box-filter-ruecksetzen {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
  float: none !important;
  position: static !important;
}

.box-filter-ruecksetzen a {
  text-decoration: none;
}

.box-filter-ruecksetzen .top_property.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #555;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 20px;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  cursor: pointer;
  line-height: 1.4;
  position: relative;
}

/* Override old css-012022.css ::before SVG X icon */
.box-filter-ruecksetzen span::before,
.box-filter-ruecksetzen .top_property.active-filter::before {
  content: none !important;
  display: none !important;
  background-image: none !important;
}

/* Single "x" indicator at the end of removable pills */
.box-filter-ruecksetzen .top_property.active-filter::after {
  content: '\00d7';
  font-size: 14px;
  font-weight: 700;
  color: #999;
  margin-left: 2px;
  transition: color 0.15s;
}

.box-filter-ruecksetzen a:hover .top_property.active-filter {
  background: #fce4e4;
  border-color: #e74c3c;
  color: #c0392b;
}
.box-filter-ruecksetzen a:hover .top_property.active-filter::after {
  color: #c0392b;
}

/* --------------------------------------------------------------------------
   10b. EMPTY RESULTS MESSAGE
   -------------------------------------------------------------------------- */

.felgen-no-results {
  text-align: center;
  padding: 40px 20px;
  color: #777;
  font-size: 15px;
  line-height: 1.6;
}
.felgen-no-results strong {
  display: block;
  font-size: 17px;
  color: #444;
  margin-bottom: 8px;
}

/* --------------------------------------------------------------------------
   11. SCROLLBAR
   -------------------------------------------------------------------------- */

.dropdown-content::-webkit-scrollbar { width: 4px; }
.dropdown-content::-webkit-scrollbar-track { background: transparent; }
.dropdown-content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* --------------------------------------------------------------------------
   12. LOADING STATE
   -------------------------------------------------------------------------- */

.felgen-filter-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}
.felgen-filter-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.5);
  z-index: 100;
}

/* Spinner on the product grid during load */
.products_category.felgen-filter-loading::after {
  background: rgba(255, 255, 255, 0.7) url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><circle cx="20" cy="20" r="16" fill="none" stroke="%23ccc" stroke-width="3"/><circle cx="20" cy="20" r="16" fill="none" stroke="%23333" stroke-width="3" stroke-dasharray="80" stroke-dashoffset="60"><animateTransform attributeName="transform" type="rotate" from="0 20 20" to="360 20 20" dur="0.8s" repeatCount="indefinite"/></circle></svg>') center center no-repeat;
}

/* --------------------------------------------------------------------------
   13. TOGGLE SWITCHES (ABE, Wintergeeignet)
   -------------------------------------------------------------------------- */

.felgen-toggles { display:flex; align-items:center; gap:0; padding:6px 0; }
.felgen-toggle { display:inline-flex; align-items:center; gap:8px; padding:8px 14px; }
.felgen-sort-select { display:inline-flex; align-items:center; gap:8px; margin-left:auto; padding:8px 0; }
.felgen-sort-select select { padding:5px 10px; font-size:13px; border:1px solid #ddd; border-radius:4px; background:#fff; color:#555; cursor:pointer; }
.felgen-toggle-label { font-size:11px; font-weight:600; text-transform:uppercase; white-space:nowrap; color:#555; cursor:pointer; }
.felgen-toggle input { display:none; }
.felgen-toggle-slider { width:36px; height:20px; background:#ccc; border-radius:10px; position:relative; cursor:pointer; transition:background .2s; flex-shrink:0; }
.felgen-toggle-slider::after { content:''; position:absolute; width:16px; height:16px; background:#fff; border-radius:50%; top:2px; left:2px; transition:transform .2s; }
.felgen-toggle input:checked + .felgen-toggle-slider { background:#1a5276; }
.felgen-toggle input:checked + .felgen-toggle-slider::after { transform:translateX(16px); }

/* --------------------------------------------------------------------------
   14. MOBILE ELEMENTS (hidden on desktop)
   -------------------------------------------------------------------------- */

.felgen-mobile-trigger-container,
.felgen-mobile-header,
.felgen-mobile-apply {
  display: none;
}

/* Sort overlay (mobile bottom-sheet) */
.felgen-sort-overlay { position:fixed; bottom:0; left:0; right:0; background:#fff; z-index:10000; border-radius:16px 16px 0 0; box-shadow:0 -4px 20px rgba(0,0,0,.15); transform:translateY(100%); transition:transform .3s; }
.felgen-sort-overlay.open { transform:translateY(0); }
.felgen-sort-overlay .sort-header { display:flex; justify-content:space-between; align-items:center; padding:16px; border-bottom:1px solid #eee; font-weight:700; }
.felgen-sort-overlay .sort-header button { background:none; border:none; font-size:24px; cursor:pointer; padding:0 4px; color:#333; }
.felgen-sort-overlay ul { list-style:none; padding:0; margin:0; }
.felgen-sort-overlay ul li { padding:14px 16px; cursor:pointer; border-bottom:1px solid #f5f5f5; }
.felgen-sort-overlay ul li.active { color:#1a5276; font-weight:700; }
.felgen-sort-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.3); z-index:9999; }

/* ==========================================================================
   TABLET (769px - 991px)
   ========================================================================== */

@media (min-width: 769px) and (max-width: 991px) {
  .felgen-filter-row .dropbtn {
    min-height: 40px;
    font-size: 10px;
    padding: 4px 3px;
    letter-spacing: 0;
  }
}

/* ==========================================================================
   MOBILE (<= 768px)
   ========================================================================== */

@media (max-width: 768px) {

  /* Mobile trigger buttons */
  .felgen-mobile-trigger-container {
    display: flex;
    gap: 8px;
    padding: 10px 0;
  }
  .felgen-mobile-trigger-container button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .felgen-mobile-trigger-container button:active {
    background: #f5f5f5;
    border-color: #999;
  }

  /* Toggles row on mobile */
  .felgen-toggles { padding:8px 0; }
  .felgen-sort-select { display:none; }

  /* Hide desktop bar */
  .felgen-filter-row {
    display: none !important;
    border: none;
    border-radius: 0;
    background: none;
  }

  /* ---- FULLSCREEN OVERLAY ---- */

  .felgen-filter-row.mobile-open {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    background: #fff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 90px 0;
    animation: ffSlideUp 0.25s ease-out;
  }

  @keyframes ffSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  .filter-noscroll {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
  }

  /* Overlay header */
  .felgen-filter-row.mobile-open .felgen-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    flex: 0 0 auto;
  }

  .felgen-mobile-title {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    color: #333;
  }

  .felgen-mobile-close {
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #333;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 50%;
  }
  .felgen-mobile-close:active { background: #f2f2f2; }

  /* Accordion layout for columns */
  .felgen-filter-row.mobile-open > .col-sm,
  .felgen-filter-row.mobile-open > [class*="col-"],
  .felgen-filter-row.mobile-open > .dropdown {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    padding: 0 !important;
  }

  .felgen-filter-row.mobile-open .dropdown {
    border-bottom: 1px solid #f0f0f0;
  }

  /* Accordion button styling */
  .felgen-filter-row.mobile-open .dropbtn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: auto;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    color: #333;
    background: transparent;
    border: none;
    border-radius: 0;
    min-height: 48px;
    text-align: left;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  /* Active filter indicator on mobile buttons */
  .felgen-filter-row.mobile-open .dropdown.has-active-filter .dropbtn {
    color: #c0392b;
  }
  .felgen-filter-row.mobile-open .dropdown.has-active-filter .dropbtn::before {
    display: none;
  }

  .felgen-filter-row.mobile-open .dropbtn::after {
    margin: 0;
    border-top-color: #999;
  }
  .felgen-filter-row.mobile-open .dropbtn:hover {
    background: transparent;
    color: #333;
  }

  /* Active accordion item (open) */
  .felgen-filter-row.mobile-open .dropdown.active .dropbtn {
    background: #333;
    color: #fff;
    padding: 14px 16px;
  }
  .felgen-filter-row.mobile-open .dropdown.active .dropbtn::after {
    border-top-color: #fff;
    transform: rotate(180deg);
  }

  /* Dropdown as inline panel */
  .felgen-filter-row.mobile-open .dropdown-content {
    position: static;
    min-width: 100%;
    max-width: 100%;
    max-height: none;
    overflow: visible;
    margin: 0;
    padding: 4px 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: #f8f8f8;
    animation: none;
  }
  .felgen-filter-row.mobile-open .dropdown-content.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    height: auto !important;
  }

  .felgen-filter-row.mobile-open .dropdown-content ul {
    display: block !important;
    max-height: 45vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
  }

  .felgen-filter-row.mobile-open .dropdown-content ul li {
    display: list-item !important;
  }

  .felgen-filter-row.mobile-open .dropdown-content ul li a {
    display: flex !important;
    padding: 12px 16px;
    min-height: 44px;
    font-size: 14px;
    white-space: normal;
    color: #333;
    overflow: visible;
  }

  /* Active items in mobile dropdowns */
  .felgen-filter-row.mobile-open .dropdown-content ul li a.active {
    padding-left: 32px;
  }

  /* Color images in mobile */
  .felgen-filter-row.mobile-open .dropdown-content ul li a img {
    width: 28px;
    height: 28px;
  }

  /* Mobile: Größen-Filter Badges */
  .felgen-filter-row.mobile-open #zollgroessenDropdown ul {
    display: flex !important; flex-wrap: wrap; gap: 8px; padding: 12px;
  }
  .felgen-filter-row.mobile-open #zollgroessenDropdown ul li a {
    min-width: 48px; height: 48px; font-size: 15px; padding: 4px 12px;
  }
  .felgen-filter-row.mobile-open #zollgroessenDropdown ul li a.active {
    padding-left: 12px;
  }

  /* Mobile: Farben-Grid */
  .felgen-filter-row.mobile-open #colourDropdown ul {
    display: grid !important; grid-template-columns: repeat(5, 1fr); gap: 10px; padding: 12px;
  }
  .felgen-filter-row.mobile-open #colourDropdown ul li a img {
    width: 36px; height: 36px;
  }
  .felgen-filter-row.mobile-open #colourDropdown ul li a.active {
    padding-left: 6px;
  }

  .felgen-filter-row.mobile-open .dropdown-content input[type="text"] {
    padding: 12px;
    font-size: 16px;
    margin: 8px 12px;
    border-radius: 6px;
    width: calc(100% - 24px);
  }

  /* Sticky apply button */
  .felgen-filter-row.mobile-open .felgen-mobile-apply {
    display: block;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #eee;
    z-index: 10;
    flex: 0 0 auto;
  }

  .felgen-mobile-apply button {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: #333;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .felgen-mobile-apply button:active { background: #555; }

  /* Filter reset pills: horizontal scroll on mobile */
  .box-filter-ruecksetzen {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 4px;
    gap: 6px;
  }
  .box-filter-ruecksetzen .top_property.active-filter {
    white-space: nowrap;
    flex-shrink: 0;
  }
}
