/* Desktop Filters Panel */
.ewf-desktop-panel {
    background: #ffffff;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

/* Hide empty desktop panel and its parent container */
.ewf-desktop-panel:empty,
.ewf-desktop-panel:not(:has(.ewf-filter-group)) {
    display: none;
}

/* Hide parent Elementor container if panel is empty */
.elementor-widget-ewf_desktop_filters:has(.ewf-desktop-panel:empty),
.elementor-widget-ewf_desktop_filters:has(.ewf-desktop-panel:not(:has(.ewf-filter-group))) {
    display: none;
}

/* Also hide the entire sidebar column if it only contains empty filter widget */
.elementor-column:has(> .elementor-widget-wrap > .elementor-widget-ewf_desktop_filters:only-child .ewf-desktop-panel:empty),
.elementor-column:has(> .elementor-widget-wrap > .elementor-widget-ewf_desktop_filters:only-child .ewf-desktop-panel:not(:has(.ewf-filter-group))) {
    display: none !important;
}

/* Sticky sidebar for desktop */
@media (min-width: 768px) {
    .ewf-desktop-panel {
        position: sticky;
        top: 20px;
        max-height: 85vh;
        overflow-y: auto;
    }
}

.ewf-filter-group {
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 15px;
}

.ewf-filter-group:last-of-type {
    border-bottom: none;
}

.ewf-filter-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #333;
}

.ewf-filter-toggle {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: color 0.2s;
}

.ewf-filter-toggle:hover {
    color: #04C3C4;
}

.ewf-filter-toggle.active {
    color: #04C3C4;
}

.ewf-toggle-icon {
    font-size: 20px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

.ewf-filter-options {
    margin-top: 10px;
}

.ewf-filter-item {
    display: flex;
    align-items: center;
    padding: 6px 0;
    cursor: pointer;
    transition: color 0.2s;
}

.ewf-filter-item:hover {
    color: #04C3C4;
}

.ewf-filter-item input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

/* Price Filter */
.ewf-price-filter {
    padding: 10px 0;
}

#ewf-price-slider,
#ewf-mobile-price-slider {
    margin: 20px 0;
}

.ewf-price-values {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-top: 10px;
}

/* noUiSlider overrides */
.noUi-connect {
    background: #04C3C4;
}

.noUi-handle {
    border: 2px solid #04C3C4;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.noUi-handle:before,
.noUi-handle:after {
    display: none;
}

/* Apply/Reset Buttons */
.ewf-apply-btn,
.ewf-reset-btn,
.ewf-mobile-apply-btn,
.ewf-mobile-reset-btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.ewf-apply-btn,
.ewf-mobile-apply-btn {
    background: #04C3C4;
    color: #fff;
}

.ewf-apply-btn:hover,
.ewf-mobile-apply-btn:hover {
    background: #03A9AA;
}

.ewf-reset-btn,
.ewf-mobile-reset-btn {
    background: #f5f5f5;
    color: #333;
}

.ewf-reset-btn:hover,
.ewf-mobile-reset-btn:hover {
    background: #e0e0e0;
}

/* Mobile Widget */
.ewf-mobile-widget {
    position: relative;
}

/* ВАЖНО: Всегда рендерить в DOM, даже если скрыто */
.ewf-mobile-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: #04C3C4;
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

/* Скрыть на desktop, но оставить в DOM! */
@media (min-width: 768px) {
    .ewf-mobile-trigger {
        display: none !important;
    }
    
    .ewf-mobile-widget {
        visibility: hidden;
        position: absolute;
        pointer-events: none;
    }
}

.ewf-mobile-trigger:hover {
    background: #03A9AA;
}

.ewf-mobile-trigger svg {
    width: 20px;
    height: 20px;
}

.ewf-mobile-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #fff;
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 9999;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.ewf-mobile-panel.active {
    transform: translateY(0);
}

.ewf-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}

.ewf-mobile-header h2 {
    font-size: 18px;
    margin: 0;
    color: #333;
}

.ewf-mobile-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ewf-mobile-close svg {
    width: 24px;
    height: 24px;
    stroke: #333;
}

.ewf-mobile-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.ewf-mobile-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 10px;
}

.ewf-mobile-footer button {
    flex: 1;
}

.ewf-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.ewf-mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sort Pills Widget */
.ewf-sort-pills {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ewf-sort-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.ewf-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 30px;
    background: #fff;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
}

.ewf-pill:hover {
    border-color: #04C3C4;
    color: #04C3C4;
}

.ewf-pill.active {
    background: #04C3C4;
    border-color: #04C3C4;
    color: #fff;
}

/* =========================
   1) Сделать блок фильтров шире
   ========================= */

.ewf-desktop-panel{
  width: 100%;
  max-width: 420px;
}

@media (min-width: 1024px){
  .elementor-widget-ewf_desktop_filters{
    width: 100%;
  }
}

/* =========================
   2) Более красивый ползунок цены (noUiSlider)
   ========================= */

#ewf-price-slider .noUi-base,
#ewf-mobile-price-slider .noUi-base{
  height: 8px;
}

#ewf-price-slider.noUi-target,
#ewf-mobile-price-slider.noUi-target{
  height: 8px;
  border: none;
  border-radius: 999px;
  background: #f1f3f5;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}

#ewf-price-slider .noUi-connect,
#ewf-mobile-price-slider .noUi-connect{
  border-radius: 999px;
  background: #04C3C4;
}

#ewf-price-slider .noUi-handle,
#ewf-mobile-price-slider .noUi-handle{
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid #04C3C4;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  cursor: grab;
  top: -7px;
  right: -11px;
}

#ewf-price-slider .noUi-handle:before,
#ewf-price-slider .noUi-handle:after,
#ewf-mobile-price-slider .noUi-handle:before,
#ewf-mobile-price-slider .noUi-handle:after{
  display: none;
}

#ewf-price-slider .noUi-handle:hover,
#ewf-mobile-price-slider .noUi-handle:hover{
  transform: scale(1.05);
}

#ewf-price-slider .noUi-handle:active,
#ewf-mobile-price-slider .noUi-handle:active{
  cursor: grabbing;
  transform: scale(1.08);
}

#ewf-price-slider .noUi-handle:focus,
#ewf-mobile-price-slider .noUi-handle:focus{
  outline: none;
  box-shadow: 0 0 0 6px rgba(4,195,196,0.18), 0 6px 18px rgba(0,0,0,0.12);
}

.ewf-price-values{
  gap: 10px;
  align-items: center;
}

.ewf-price-values span{
  padding: 6px 10px;
  border-radius: 10px;
  background: #f7f7f7;
  border: 1px solid #eee;
  line-height: 1;
}

/* Responsive */
@media (max-width: 767px) {
    .ewf-desktop-panel {
        position: static;
        max-height: none;
    }
    
    .ewf-sort-pills {
        justify-content: center;
    }
}

/* Кнопка "Filteri" в Sort Pills — только на мобиле */
.ewf-mobile-trigger-pill { 
  display: none !important; 
}

@media (max-width: 767px){
  .ewf-mobile-trigger-pill { 
    display: inline-flex !important; 
  }
}

/* ====== Красивые поля Min/Max ====== */

.ewf-price-inputs{
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.ewf-price-input{
  appearance: textfield;
  -webkit-appearance: none;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid #e6e6e6;
  background: linear-gradient(#fff, #fbfbfb);
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  font-size: 14px;
  font-weight: 700;
  color: #333;
  letter-spacing: 0.2px;
}

.ewf-price-input::-webkit-outer-spin-button,
.ewf-price-input::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}

.ewf-price-input::placeholder{
  color: #aaa;
  font-weight: 600;
}

.ewf-price-input:focus{
  outline: none;
  border-color: #04C3C4;
  box-shadow: 0 0 0 5px rgba(4,195,196,0.18), 0 10px 26px rgba(0,0,0,0.08);
}

.ewf-price-sep{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #f4f4f4;
  border: 1px solid #e9e9e9;
  color: #666;
  font-weight: 800;
  user-select: none;
}

@media (max-width: 767px){
  .ewf-price-input{
    height: 42px;
    border-radius: 12px;
  }
}

/* Убираем старый вывод диапазона цен (span-ы), оставляем только инпуты */
.ewf-price-values{
  display: none !important;
}