/* Estilos do filtro MyP e do layout responsivo do archive. */

/* O filtro customizado substitui a sidebar padrão do Astra/WooCommerce. */
.ast-container .secondary {
	display: none !important;
}

.myp-filters-sidebar {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.myp-filters-sidebar-shell {
	position: relative;
	min-width: 0;
	transition: flex-basis 0.25s ease, max-width 0.25s ease, min-width 0.25s ease,
		transform 0.25s ease, visibility 0.25s ease;
}

.myp-filters-toggle,
.myp-filters-close,
.myp-filters-open {
	font: inherit;
}

.myp-filters-toggle,
.myp-filters-close {
	display: none;
}

.myp-filters-open,
.myp-filters-open:hover,
.myp-filters-open:active,
.myp-filters-open:focus,
.myp-filters-open:focus-visible {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-height: 38px;
	padding: 0.35rem 0.25rem;
	border: 0 !important;
	border-radius: 0;
	background: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
	color: #176b70 !important;
	font-weight: 600;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.myp-filters-open-icon {
	display: block;
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.9;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.myp-toolbar-items {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
}

.myp-toolbar-items .custom-product-count {
	display: inline-block;
	margin: 0 !important;
	padding: 0 !important;
}

.myp-filter-block {
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.05);
	border-radius: 4px;
	padding: 0.75rem 1rem;
}

.myp-filter-title {
	margin: 0 0 0.5rem;
	font-size: 0.95rem;
	font-weight: 600;
}

.myp-filter-options {
	list-style: none;
	margin: 0;
	padding: 0;
}

.myp-filter-option {
	margin-bottom: 0.25rem;
}

.myp-filter-option label {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 0.4rem;
	font-size: 0.9rem;
}

.myp-filter-term-image {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	margin: 0 4px;
	flex-shrink: 0;
}

.myp-filter-option-count {
	color: #666;
	font-size: 0.8rem;
	margin-left: auto;
}

.myp-filter-actions {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

.myp-filter-actions .myp-filter-apply,
.myp-filter-actions .myp-filter-clear {
	display: inline-block;
	width: 100%;
	text-align: center;
}

.myp-filter-actions .myp-filter-apply {
	background-image: linear-gradient(to right, #00a7ac, #2ad0d5, #00a7ac) !important;
	border: none;
	color: #fff;
}

.myp-filter-actions .myp-filter-clear {
	background-image: linear-gradient(to right, #e0e0e0, #f5f5f5, #e0e0e0) !important;
	border: none;
	color: #444 !important;
}

/* Slider de valores. */

.myp-price-filter {
	margin-top: 0.5rem;
}

.myp-price-range-track {
	position: relative;
	height: 4px;
	background-color: #e0e0e0;
	border-radius: 2px;
	margin: 0.75rem 0 0.5rem;
}

.myp-price-range-bar {
	position: absolute;
	height: 4px;
	left: 0;
	right: 0;
	border-radius: 2px;
	background-image: linear-gradient(to right, #00a7ac, #2ad0d5, #00a7ac);
}

.myp-price-range-handle {
	position: absolute;
	top: 50%;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #8fd4d6;
	border: 2px solid #00a7ac;
	box-shadow: 0 0 4px rgba(0, 0, 0, 0.15);
	transform: translate(-50%, -50%);
	cursor: pointer;
}

.myp-price-values {
	display: flex;
	justify-content: space-between;
	font-size: 0.85rem;
	color: #444;
}

/* Desktop: sidebar inline e grade com área previsível. */

@media (min-width: 1200px) {
	.myp-filters-open {
		display: none;
	}

	html.myp-filtro-precollapsed .myp-filters-open {
		display: inline-flex;
	}

	.myp-archive-layout {
		display: flex;
		align-items: flex-start;
		gap: 1.5rem;
	}

	.myp-archive-layout.has-sidebar .myp-filters-sidebar-shell {
		flex: 0 0 clamp(240px, 18vw, 280px);
		max-width: 280px;
		min-width: 240px;
		position: sticky;
		top: 1rem;
		align-self: flex-start;
	}

	.myp-archive-layout .myp-filters-sidebar {
		max-height: calc(100vh - 2rem);
		overflow-y: auto;
	}

	.myp-archive-layout .myp-archive-products {
		flex: 1 1 0;
		min-width: 0;
	}

	.myp-archive-layout.has-sidebar .myp-filters-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		position: absolute;
		top: .75rem;
		right: -16px;
		z-index: 3;
		width: 32px;
		height: 32px;
		padding: 0;
		border: 1px solid rgba(0, 0, 0, 0.12);
		border-radius: 8px;
		background: #fff;
		color: #111;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
		cursor: pointer;
	}

	.myp-filters-toggle-icon {
		display: inline-block;
		width: 15px;
		height: 15px;
		line-height: 0;
	}

	.myp-filters-toggle-icon svg {
		display: block;
		width: 17px;
		height: 17px;
		fill: none;
		stroke: currentColor;
		stroke-width: 2.4;
		stroke-linecap: round;
		stroke-linejoin: round;
		transition: transform 0.2s ease;
	}

	.myp-filters-toggle.is-collapsed .myp-filters-toggle-icon svg {
		transform: scaleX(-1);
	}

	.myp-archive-layout.is-collapsed,
	html.myp-filtro-precollapsed .myp-archive-layout.has-sidebar {
		gap: 0.75rem;
	}

	.myp-archive-layout.is-collapsed .myp-filters-sidebar-shell,
	html.myp-filtro-precollapsed .myp-archive-layout.has-sidebar .myp-filters-sidebar-shell {
		flex-basis: 0;
		max-width: 0;
		min-width: 0;
		overflow: visible;
	}

	.myp-archive-layout.is-collapsed .myp-filters-sidebar,
	html.myp-filtro-precollapsed .myp-archive-layout.has-sidebar .myp-filters-sidebar {
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transform: translateX(-12px);
	}

	.myp-archive-layout.is-collapsed .myp-filters-toggle,
	html.myp-filtro-precollapsed .myp-archive-layout.has-sidebar .myp-filters-toggle {
		display: none;
	}

	.myp-archive-layout.no-sidebar .myp-archive-products {
		flex-basis: 100%;
		max-width: 100%;
	}
}

/* Tablet e mobile: drawer lateral sem alterar a grade de produtos. */

@media (max-width: 1199px) {
	.myp-archive-layout {
		display: block;
	}

	.myp-archive-layout .myp-archive-products {
		width: 100%;
	}

	.myp-filters-sidebar-shell {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		/* Fica acima do header mobile (9999) e da busca abaixo do header (9980). */
		z-index: 10001;
		width: min(420px, 92vw);
		max-width: 100%;
		padding: 1rem;
		background: #fff;
		box-shadow: -8px 0 28px rgba(0, 0, 0, 0.16);
		transform: translateX(100%);
		visibility: hidden;
		pointer-events: none;
		overflow: hidden;
	}

	.myp-archive-layout.is-drawer-open .myp-filters-sidebar-shell {
		transform: translateX(0);
		visibility: visible;
		pointer-events: auto;
	}

	.myp-archive-layout.is-drawer-open .myp-filters-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 10000;
		background: rgba(0, 0, 0, 0.42);
	}

	.myp-filters-sidebar {
		height: 100%;
		max-height: none;
		overflow-y: auto;
		padding-bottom: 1rem;
	}

	.myp-filters-close {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		margin: 0 0 1rem;
		padding: 0.65rem 0.75rem;
		border: 1px solid rgba(0, 0, 0, 0.12);
		border-radius: 4px;
		background: #fff;
		color: #111;
		font-weight: 600;
		cursor: pointer;
	}

	.myp-filters-close:hover,
	.myp-filters-close:active,
	.myp-filters-close:focus,
	.myp-filters-close:focus-visible {
		background: transparent !important;
		background-image: none !important;
		box-shadow: none !important;
	}

	.myp-filters-toggle {
		display: none !important;
	}

	.myp-filters-backdrop {
		display: none;
	}

	.myp-filters-open {
		min-height: 40px;
	}

	body.myp-filters-lock {
		overflow: hidden;
	}
}

@media (max-width: 767px) {
	.myp-filters-sidebar-shell {
		width: min(420px, calc(100vw - 12px));
		padding: 0.75rem;
	}

	.myp-toolbar-items {
		width: 100%;
		justify-content: space-between;
	}

	.myp-toolbar-items .custom-product-count {
		font-size: 13px;
		margin-right: 0.75rem !important;
	}

	.myp-filter-actions {
		position: sticky;
		bottom: 0;
		padding-top: 0.75rem;
		background: #fff;
	}
}

.myp-filters-backdrop[hidden] {
	display: none !important;
}

@media (max-width: 921px) {
	#primary,
	#secondary {
		padding: 0.5em 0;
	}
}
