/**
 * SuperNetwork Filtros — front
 * Sidebar lateral + responsivo.
 */

.snf-filters {
  --snf-bg: #f3f4f6;
  --snf-surface: #ffffff;
  --snf-border: #e5e7eb;
  --snf-text: #111827;
  --snf-muted: #6b7280;
  --snf-accent: #0ea5e9;
  --snf-accent-soft: #e0f2fe;
  --snf-selected: #111827;
  --snf-selected-text: #ffffff;
  --snf-radius: 14px;
  --snf-shadow: 0 1px 2px rgba(17, 24, 39, 0.06);

  box-sizing: border-box;
  width: 100%;
  margin: 0 0 1.5rem;
  padding: 1rem 1.1rem 1.15rem;
  background: var(--snf-bg);
  border: 1px solid var(--snf-border);
  border-radius: calc(var(--snf-radius) + 2px);
  color: var(--snf-text);
  font-family: inherit;
}

.snf-filters *,
.snf-filters *::before,
.snf-filters *::after {
  box-sizing: border-box;
}

/* Toggle mobile (escondido no desktop) */
.snf-filters__toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--snf-border);
  border-radius: 12px;
  background: var(--snf-surface);
  color: var(--snf-text);
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
}

.snf-filters__toggle-label {
  flex: 1;
}

.snf-filters__toggle-badge {
  min-width: 1.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--snf-selected);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.snf-filters__toggle-icon {
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-top: -0.25rem;
}

.snf-filters.is-open .snf-filters__toggle-icon {
  transform: rotate(-135deg);
  margin-top: 0.15rem;
}

.snf-filters__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.snf-filters__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--snf-text);
}

.snf-filters__clear {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--snf-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.snf-filters__clear:hover,
.snf-filters__clear:focus {
  color: var(--snf-accent);
  border-color: currentColor;
}

.snf-filters__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.snf-filters__item {
  margin: 0;
}

.snf-filters__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.5rem 0.85rem;
  background: var(--snf-surface);
  border: 1px solid var(--snf-border);
  border-radius: 999px;
  color: var(--snf-text);
  text-decoration: none;
  box-shadow: var(--snf-shadow);
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
  cursor: pointer;
}

.snf-filters__btn:hover {
  border-color: #9ca3af;
  transform: translateY(-1px);
  color: var(--snf-text);
}

.snf-filters__btn:focus-visible {
  outline: 2px solid var(--snf-accent);
  outline-offset: 2px;
}

.snf-filters__item.is-selected .snf-filters__btn {
  background: var(--snf-selected);
  border-color: var(--snf-selected);
  color: var(--snf-selected-text);
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.16);
}

.snf-filters__logo {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  flex: 0 0 auto;
}

.snf-filters__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.snf-filters__name {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
}

.snf-filters__count {
  min-width: 1.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--snf-accent-soft);
  color: #0369a1;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.snf-filters__item.is-selected .snf-filters__count {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.snf-filters__check {
  display: inline-flex;
  line-height: 0;
}

.snf-filters__status {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--snf-muted);
}

.snf-filters.is-loading {
  opacity: 0.72;
  pointer-events: none;
}

.snf-filters__empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--snf-muted);
  line-height: 1.45;
}

/* Lista vertical (sidebar) */
.snf-layout-list .snf-filters__list {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.45rem;
}

.snf-layout-list .snf-filters__btn {
  width: 100%;
  border-radius: 12px;
  justify-content: flex-start;
}

.snf-layout-list .snf-filters__count {
  margin-left: auto;
}

.snf-layout-list .snf-filters__check {
  margin-left: 0.15rem;
}

/* Grid logos */
.snf-layout-grid .snf-filters__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.65rem;
}

.snf-layout-grid .snf-filters__btn {
  width: 100%;
  min-height: 96px;
  border-radius: var(--snf-radius);
  flex-direction: column;
  justify-content: center;
  padding: 0.85rem 0.6rem;
  text-align: center;
}

.snf-layout-grid .snf-filters__logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
}

.snf-layout-grid .snf-filters__item {
  position: relative;
}

.snf-layout-grid .snf-filters__item.is-selected .snf-filters__check {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* ========== Layout lateral na categoria ========== */
.snf-shop-layout--sidebar {
  display: grid;
  grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
  gap: 1.75rem 2rem;
  align-items: start;
  width: 100%;
  margin: 0 0 2rem;
}

.snf-shop-layout__filters {
  min-width: 0;
}

.snf-shop-layout__filters .snf-filters {
  position: sticky;
  top: 1rem;
  margin: 0;
}

.snf-shop-layout__content {
  min-width: 0;
}

.snf-filters--sidebar .snf-filters__header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--snf-border);
}

/* Desktop: esconde botão toggle; body sempre visível */
@media (min-width: 901px) {
  .snf-filters--sidebar .snf-filters__toggle {
    display: none !important;
  }

  .snf-filters--sidebar .snf-filters__body {
    display: block !important;
  }
}

/* Tablet / mobile: empilha e vira accordion */
@media (max-width: 900px) {
  .snf-shop-layout--sidebar {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .snf-shop-layout__filters {
    order: -1;
  }

  .snf-shop-layout__filters .snf-filters {
    position: static;
    padding: 0;
    background: transparent;
    border: none;
  }

  .snf-filters--sidebar .snf-filters__toggle {
    display: inline-flex;
  }

  .snf-filters--sidebar .snf-filters__body {
    display: none;
    margin-top: 0.65rem;
    padding: 1rem;
    background: var(--snf-bg);
    border: 1px solid var(--snf-border);
    border-radius: var(--snf-radius);
  }

  .snf-filters--sidebar.is-open .snf-filters__body {
    display: block;
  }

  .snf-filters--sidebar .snf-filters__header .snf-filters__title {
    display: none;
  }
}

/* Chips no mobile (modo horizontal legado) */
@media (max-width: 640px) {
  .snf-layout-chips .snf-filters__list {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .snf-layout-chips .snf-filters__btn {
    white-space: nowrap;
  }
}
