/*
 * Filtros do catálogo em folha no celular (09/11). Carregado só com
 * TRIANGULO_FILTROS_PAINEL = true; ver inc/filtros-painel.php.
 * Tudo depende de body.tem-filtros-folha (posta pelo JS): sem JS, nada muda.
 */

@media (max-width: 1023px) {
	/* ---------- Barra "Filtrar", presa sob o topo enquanto se rola a lista ---------- */
	body.tem-filtros-folha .filtros-barra {
		position: sticky;
		top: 84px;
		z-index: 20;
		margin: 0 calc(var(--gutter, 16px) * -1) var(--e-4);
		padding: 10px var(--gutter, 16px);
		background: rgba(15, 15, 14, 0.94);
		-webkit-backdrop-filter: blur(10px);
		backdrop-filter: blur(10px);
		border-bottom: 1px solid rgba(241, 236, 227, 0.1);
	}

	.filtros-barra__botao {
		display: inline-flex;
		align-items: center;
		gap: 10px;
		min-height: 44px;
		padding: 0 18px;
		border: 1px solid rgba(241, 236, 227, 0.32);
		border-radius: 50px;
		background: none;
		color: #f1ece3;
		font: inherit;
		font-size: 15px;
		font-weight: 500;
		cursor: pointer;
	}

	.filtros-barra__botao:hover,
	.filtros-barra__botao:focus-visible {
		border-color: #f1ece3;
	}

	.filtros-barra__botao svg {
		color: #d7b47e;
	}

	.filtros-barra__conta {
		padding: 2px 9px;
		border-radius: 50px;
		background: #d7b47e;
		color: #1a140b;
		font-size: 12.5px;
		font-weight: 700;
	}

	.filtros-barra__conta[hidden] {
		display: none;
	}

	/* ---------- O painel sai do fluxo e vira a folha ---------- */
	body.tem-filtros-folha .catalogo__filtros {
		display: none;
	}

	body.tem-filtros-folha.filtros-abertos .catalogo__filtros {
		position: fixed;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 110;
		display: flex;
		flex-direction: column;
		max-height: 88vh;
		max-height: 88dvh;
		border-top: 1px solid rgba(241, 236, 227, 0.14);
		border-radius: 16px 16px 0 0;
		background: #151513;
		box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.6);
		animation: filtros-sobe 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
	}

	@keyframes filtros-sobe {
		from {
			transform: translateY(40px);
			opacity: 0;
		}
	}

	@media (prefers-reduced-motion: reduce) {
		body.tem-filtros-folha.filtros-abertos .catalogo__filtros {
			animation: none;
		}
	}

	/* O "Filtrar por" do details some: a folha tem título próprio. */
	body.tem-filtros-folha .filtros-painel__resumo {
		display: none;
	}

	body.tem-filtros-folha .filtros-painel,
	body.tem-filtros-folha.tema-escuro .filtros-painel {
		flex: 1;
		min-height: 0;
		margin: 0;
		padding: 0 20px 8px;
		border: 0;
		border-radius: 0;
		background: none;
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	.filtros-folha__cabeca {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 14px 12px 10px 20px;
		border-bottom: 1px solid rgba(241, 236, 227, 0.1);
	}

	/* Puxador visual da folha. */
	.filtros-folha__cabeca::before {
		content: "";
		position: absolute;
		top: 6px;
		left: 50%;
		width: 40px;
		height: 4px;
		border-radius: 2px;
		background: rgba(241, 236, 227, 0.25);
		transform: translateX(-50%);
	}

	.filtros-folha__titulo {
		margin: 0;
		color: #f4efe6;
		font-size: 20px;
		font-weight: 500;
	}

	.filtros-folha__fechar {
		width: 44px;
		height: 44px;
		border: 0;
		border-radius: 50%;
		background: none;
		color: #f1ece3;
		font-size: 28px;
		line-height: 1;
		cursor: pointer;
	}

	.filtros-folha__fechar:hover,
	.filtros-folha__fechar:focus-visible {
		background: rgba(241, 236, 227, 0.1);
	}

	.filtros-folha__pe {
		display: flex;
		align-items: center;
		gap: 16px;
		padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
		border-top: 1px solid rgba(241, 236, 227, 0.1);
		background: #151513;
	}

	.filtros-folha__limpar {
		color: #e6e0d6;
		font-size: 15px;
		text-decoration: underline;
		text-underline-offset: 3px;
		white-space: nowrap;
	}

	.filtros-folha__ver {
		flex: 1;
		justify-content: center;
		min-height: 50px;
	}

	/* ---------- Fundo escuro atrás da folha ---------- */
	.filtros-fundo {
		position: fixed;
		inset: 0;
		z-index: 105;
		background: rgba(0, 0, 0, 0.6);
	}

	.filtros-fundo[hidden] {
		display: none;
	}

	body.filtros-abertos {
		overflow: hidden;
	}

	body.filtros-abertos .whatsapp,
	body.filtros-abertos .caixa-aviso {
		display: none;
	}
}

/* No desktop (barra lateral), nada disso aparece. */
@media (min-width: 1024px) {
	.filtros-barra,
	.filtros-folha__cabeca,
	.filtros-folha__pe,
	.filtros-fundo {
		display: none !important;
	}
}
