/* =============================================
   ADVANCEFILTER — SIDEBAR VERSION
   Цвета из сайта: #ec882d (оранж), #db4616 (красн-оранж),
   #f7f3ea (бежевый), #403e3f (тёмный текст), #3b96b0 (голубой)
   ============================================= */

/* Оверлей при открытии сайдбара */
.af-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.af-overlay.af-overlay--visible {
  opacity: 1;
}

/* ---- SIDEBAR ---- */
.af-sidebar {
  position: fixed;
  top: 0;
  right: -420px;
  width: 390px;
  max-width: 95vw;
  height: 100%;
  background: #fff;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
  font-family: inherit;
}
.af-sidebar.af-sidebar--open {
  right: 0;
}

/* ---- ШАПКА САЙДБАРА ---- */
.af-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid #e8e4da;
  flex-shrink: 0;
  background: #fff;
}
.af-sidebar__title {
  font-size: 16px;
  font-weight: 700;
  color: #403e3f;
  display: flex;
  align-items: center;
  gap: 8px;
}
.af-sidebar__title svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.af-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ec882d;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  line-height: 1;
  transition: all 0.2s ease;
}
.af-badge--hidden {
  display: none;
}
.af-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.af-reset-btn {
  font-size: 12px;
  color: #3b96b0;
  background: none;
  border: none;
  border-bottom: 1px dashed #3b96b0;
  cursor: pointer;
  padding: 0;
  line-height: 1.4;
  transition: opacity 0.2s;
  display: none;
}
.af-reset-btn:hover {
  opacity: 0.7;
}
.af-reset-btn--visible {
  display: inline;
}
.af-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f7f3ea;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
  color: #403e3f;
  padding:0;
}
.af-close-btn:hover {
  background: #eae5d8;
}
.af-close-btn svg {
  width: 14px;
  height: 14px;
}

/* ---- ТЕЛО САЙДБАРА (скролл) ---- */
.af-sidebar__body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
  -webkit-overflow-scrolling: touch;
}
.af-sidebar__body::-webkit-scrollbar {
  width: 4px;
}
.af-sidebar__body::-webkit-scrollbar-track {
  background: #f7f3ea;
}
.af-sidebar__body::-webkit-scrollbar-thumb {
  background: #cac7c2;
  border-radius: 4px;
}

/* ---- БЛОК ЦЕНЫ ---- */
.af-price-block {
  padding: 18px 0 14px;
  border-bottom: 1px solid #f0ece3;
}
.af-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

/* Слайдер цены */
.af-price-slider-wrap {
  padding: 4px 4px 0;
}
#af-price-slider {
  height: 4px;
  border: none;
  background: #e9e5da;
  border-radius: 2px;
  margin-bottom: 14px;
  position: relative;
}
#af-price-slider .ui-slider-range {
  background: #ec882d;
  border-radius: 2px;
}
#af-price-slider .ui-slider-handle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #ec882d;
  top: -7px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-left: -9px;
}
#af-price-slider .ui-slider-handle:focus,
#af-price-slider .ui-slider-handle:hover {
  border-color: #db4616;
  box-shadow: 0 0 0 3px rgba(236,136,45,0.18);
}
#af-price-slider .ui-slider-handle.ui-state-active {
  border-color: #db4616;
  box-shadow: 0 0 0 5px rgba(236,136,45,0.15);
}
.af-price-inputs {
  display: flex;
  gap: 10px;
  align-items: center;
}
.af-price-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.af-price-field label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.af-price-field input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  color: #403e3f;
  background: #fafafa;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.af-price-field input:focus {
  border-color: #ec882d;
  background: #fff;
  outline: none;
}
.af-price-sep {
  color: #ccc;
  font-size: 18px;
  margin-top: 16px;
  flex-shrink: 0;
}

/* ---- ГРУППЫ ЧЕКБОКСОВ ---- */
.af-group {
  padding: 16px 0 12px;
  border-bottom: 1px solid #f0ece3;
}
.af-group:last-child {
  border-bottom: none;
}

/* ---- КАСТОМНЫЕ ЧЕКБОКСЫ ---- */
.af-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 176px;
  overflow-y: auto;
  padding-right: 4px;
}
.af-checkbox-list::-webkit-scrollbar {
  width: 3px;
}
.af-checkbox-list::-webkit-scrollbar-thumb {
  background: #d5d0c8;
  border-radius: 3px;
}
.af-checkbox-list input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.af-checkbox-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  color: #403e3f;
  font-size: 13px;
  line-height: 1.3;
  user-select: none;
  position: relative;
}
.af-checkbox-list label:hover {
  background: #f7f3ea;
}
.af-checkbox-list label::before {
  content: '';
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  border: 1.5px solid #cac7c2;
  border-radius: 4px;
  background: #fff;
  transition: all 0.15s ease;
  box-sizing: border-box;  
}
.af-checkbox-list input[type="checkbox"]:checked + label::before {
  background: #ec882d;
  border-color: #ec882d;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1' stroke='%23fff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px 9px;
}
.af-checkbox-list input[type="checkbox"]:checked + label {
  color: #403e3f;
  font-weight: 600;
}

/* ---- ПОДВАЛ САЙДБАРА ---- */
.af-sidebar__footer {
  padding: 14px 20px;
  border-top: 1px solid #e8e4da;
  flex-shrink: 0;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.af-submit-btn {
  flex: 1;
  padding: 11px 20px;
  background: #ec882d;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
}
.af-submit-btn:hover {
  background: #db4616;
}
.af-submit-btn:active {
  transform: scale(0.98);
}
.af-selected-count {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

/* ---- КНОПКА ОТКРЫТИЯ (заменяет .advancefilter__short-toggle) ---- */
.advancefilter__short {
  background: #fff;
  border: 1px solid #e8d5b8;
  border-left: 4px solid #ec882d;
  border-radius: 6px;
  padding: 11px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  transition: box-shadow 0.2s ease;
}
.advancefilter__short:hover {
  box-shadow: 0 2px 10px rgba(236, 136, 45, 0.15);
}
.advancefilter__short-title {
  display: inline-block;
  vertical-align: middle;
  font-size: 13px;
  color: #888;
  cursor: default;
}

.advancefilter__short-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  background: #ec882d;
  color: #fff;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.advancefilter__short-toggle:hover {
  background: #db4616;
}
.af-toggle-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #3d7e91;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  line-height: 1;
  display: none;
}
.af-toggle-badge--visible {
  display: inline-flex;
}

/* Скрываем старый полный блок — он нам не нужен */
.advancefilter__full {
  display: none !important;
}




/* ---- МОБИЛЬНАЯ АДАПТАЦИЯ ---- */
@media (max-width: 1023px) {
  .advancefilter__short-title {
    display: block;
  }
  .advancefilter__short-toggle {
    float: none;
  }
}
@media (max-width: 767px) {
  .af-sidebar {
    width: 100%;
    max-width: 100%;
    right: -100%;
  }
  .af-sidebar.af-sidebar--open {
    right: 0;
  }
  .advancefilter__short-title {
    display: none;
  }  
  .advancefilter__short-toggle {
    float: none;
    display: inline-flex !important;
  }
}