.filtro-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 99999;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.filtro-modal.open { display: flex; }

.filtro-modal-content {
  background: #fff;
  width: 100%;
  max-height: 85vh;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
}

.filtro-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.filtro-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.filtro-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  padding: 4px;
}

.filtro-modal-close svg { width: 24px; height: 24px; }

.filtro-modal-body {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}

.filtro-grupo {
  margin-bottom: 1.25rem;
}

.filtro-grupo-titulo {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 0.5rem;
}

.filtro-opcoes {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filtro-opcao {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #555;
  cursor: pointer;
}

.filtro-opcao input {
  accent-color: #FFB800;
}

.filtro-modal-footer {
  display: flex;
  gap: 8px;
  padding: 1rem;
  border-top: 1px solid #eee;
  position: sticky;
  bottom: 0;
  background: #fff;
}

.filtro-btn-limpar,
.filtro-btn-aplicar {
  flex: 1;
  padding: 0.7rem;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.filtro-btn-limpar {
  background: #f5f5f5;
  color: #666;
}

.filtro-btn-aplicar {
  background: #FFB800;
  color: #111;
}

/* ── Badge de Filtros no Botão (mobile) ── */
.filtro-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  background: #999;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.filtro-badge.has-filters {
  background: #e74c3c;
}

/* ── Chips de Filtros Ativos (mobile only) ── */
.filtro-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

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

.filtro-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 0;
  font-size: 0.78rem;
  color: #333;
  white-space: nowrap;
}

.filtro-chip-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

.filtro-chip-close:hover {
  color: #e74c3c;
}

.filtro-chip-close svg {
  width: 12px;
  height: 12px;
}

@media screen and (min-width: 1024px) {
  .filtro-modal {
    align-items: center;
  }

  .filtro-modal-content {
    width: 450px;
    max-height: 70vh;
    border-radius: 16px;
  }
}

/* ── Sidebar Filtros (Desktop) ── */
.filtro-sidebar {
  display: none;
}

/* Modal: visivel apenas em mobile */
@media screen and (min-width: 769px) {
  .filtro-modal {
    display: none !important;
  }
}

/* Sidebar: visivel apenas em desktop */
@media screen and (min-width: 769px) {
  .filtro-sidebar {
    display: flex;
    flex-direction: column;
    align-self: flex-start;
    width: 240px;
    flex-shrink: 0;
    background: #fff;
    padding: 0;
  }

  .filtro-sidebar-header {
    flex-shrink: 0;
    padding: 14px 0 12px;
    border-bottom: none;
    margin-bottom: 0;
  }

  .filtro-sidebar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin: 0;
    line-height: 1.2;
  }

  .filtro-sidebar-content {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 8px;
  }

  .filtro-sidebar .filtro-grupo {
    margin-bottom: 1.25rem;
  }

  .filtro-sidebar .filtro-grupo:not(:has(input:checked)) .filtro-grupo-limpar {
    opacity: 0;
    pointer-events: none;
  }

  .filtro-sidebar .filtro-grupo-titulo {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    margin: 0;
  }

  .filtro-grupo-linha {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
  }

  .filtro-grupo-limpar {
    background: none;
    border: none;
    font-size: 0.65rem;
    color: #bbb;
    cursor: pointer;
    padding: 2px 2px;
    font-family: inherit;
    font-weight: 400;
    transition: opacity 0.2s ease;
  }

  .filtro-grupo-limpar:hover {
    color: #e74c3c;
  }

  .filtro-sidebar .filtro-opcoes {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }

  .filtro-sidebar .filtro-opcao {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #555;
    cursor: pointer;
  }

  .filtro-sidebar .filtro-opcao-texto {
    flex: 1;
  }

  .filtro-sidebar .filtro-opcao-x {
    display: none;
    width: 16px;
    height: 16px;
    border: none;
    background: none;
    cursor: pointer;
    color: #999;
    padding: 0;
    flex-shrink: 0;
  }

  .filtro-sidebar .filtro-opcao-x svg {
    width: 12px;
    height: 12px;
  }

  .filtro-sidebar .filtro-opcao-x:hover {
    color: #e74c3c;
  }

  .filtro-sidebar .filtro-opcao:has(input:checked) .filtro-opcao-x {
    display: flex;
  }

  .filtro-sidebar .filtro-opcao input {
    accent-color: #FFB800;
  }

  .filtro-sidebar-actions {
    display: flex;
    gap: 8px;
    padding-top: 0.75rem;
    border-top: none;
  }

  .filtro-sidebar-actions .filtro-btn-limpar,
  .filtro-sidebar-actions .filtro-btn-aplicar {
    flex: 1;
    padding: 0.6rem;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
  }

  .filtro-sidebar-actions .filtro-btn-limpar {
    background: #f5f5f5;
    color: #666;
  }

  .filtro-sidebar-actions .filtro-btn-aplicar {
    background: #FFB800;
    color: #111;
  }

  .filtro-sidebar-actions .filtro-btn-aplicar {
    display: none;
  }

  .loja-products-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
  }

  .loja-products-main {
    flex: 1;
    min-width: 0;
  }

  .products-header-filter {
    display: none;
  }
}
