/* ============================================
   Filter Sidebar Toggle
   ============================================ */

/* ── Desktop: sidebar collapses via width (enables CSS transition) ── */
@media screen and (min-width: 769px) {
  .page-sidebar {
    overflow: hidden;
    transition:
      width 0.38s cubic-bezier(0.4, 0, 0.2, 1),
      min-width 0.38s cubic-bezier(0.4, 0, 0.2, 1),
      padding-left 0.38s cubic-bezier(0.4, 0, 0.2, 1),
      padding-right 0.38s cubic-bezier(0.4, 0, 0.2, 1),
      opacity 0.3s ease;
  }

  .page-sidebar.sidebar-is-hidden {
    width: 0 !important;
    min-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    opacity: 0;
    pointer-events: none;
  }

  /* ── Content expands when sidebar hidden ── */
  .page-content.-with-left-sidebar {
    transition:
      width 0.38s cubic-bezier(0.4, 0, 0.2, 1),
      padding-left 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .page-content.-with-left-sidebar.sidebar-hidden {
    width: 100% !important;
    padding-left: 0 !important;
  }
}

/* ── Grid columns (same breakpoint as theme: min-width 1181px) ── */
/* .columns-lg-3 is a class ON .page-content itself, not a child */
@media screen and (min-width: 1181px) {
  .page-content.-with-left-sidebar.columns-lg-3.sidebar-hidden .woo-products,
  .page-content.-with-left-sidebar.columns-3.sidebar-hidden .woo-products {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .page-content.-with-left-sidebar.columns-lg-3.sidebar-open .woo-products,
  .page-content.-with-left-sidebar.columns-3.sidebar-open .woo-products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* ── Filter toggle bar ── */
.filter-toggle-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  transition: background 0.2s;
  white-space: nowrap;
}

.filter-toggle-btn:hover {
  background: #333;
}

.filter-toggle-btn.is-active {
  background: #333;
}

.filter-count-badge {
  display: none;
  background: #fff;
  color: #111;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.filter-count-badge.visible {
  display: inline-flex;
}

/* ── Active filter pills (shown when sidebar is hidden) ── */
.active-filters-preview {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 12px;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 12px;
  line-height: 1.4;
  color: #333;
}

.active-filter-pill .pill-remove {
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.15s;
  margin-left: 1px;
}

.active-filter-pill .pill-remove:hover {
  opacity: 1;
}

.active-filter-reset {
  font-size: 12px;
  color: #666;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 2px;
  white-space: nowrap;
}

.active-filter-reset:hover {
  color: #111;
}

/* ── Mobile backdrop (hidden on desktop) ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

@media screen and (min-width: 769px) {
  .sidebar-backdrop {
    display: none !important;
  }
}

/* ── Close button inside sidebar (mobile only) ── */
.sidebar-close-btn {
  display: none;
  width: 100%;
  padding: 12px 16px;
  background: #f5f5f5;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

.sidebar-close-btn:hover {
  background: #eaeaea;
}

/* ── Теги товара под кратким описанием ── */
.parfclub-product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.parfclub-product-tag {
  display: inline-block;
  padding: 4px 10px;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  border-radius: 20px;
  font-size: 12px;
  color: #555;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.parfclub-product-tag:hover {
  background: #111;
  border-color: #111;
  color: #fff;
}

/* ── Mobile: sidebar as fixed overlay, slides in from left ── */
@media (max-width: 768px) {
  .page-sidebar {
    position: fixed !important;
    top: 90px;
    left: 0;
    width: 90vw !important;
    max-width: 360px;
    height: calc(100vh - 90px) !important;
    z-index: 9999;
    overflow-y: auto !important;
    background: #fff;
    padding: 20px 16px !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
    transform: translateX(-110%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .page-sidebar.sidebar-is-open {
    transform: translateX(0) !important;
  }

  .sidebar-close-btn {
    display: block;
  }

  body.sidebar-overlay-open {
    overflow: hidden;
  }
}
