/* =============================================================================
   ElementorPlus — Product Grid (WooCommerce)
   Card estilo pôster: capa vertical, selo de desconto no topo e, no rodapé
   sobre a imagem, categoria + preço (antigo riscado + atual) e botão de
   carrinho circular. Grade controlada por variáveis CSS (sem !important).
   ============================================================================= */

.eppg-wrapper {
	width: 100%;
	box-sizing: border-box;
	padding-left: 60px;  /* espaçamento lateral padrão (ajustável no editor) */
	padding-right: 60px;
}

@media (max-width: 1024px) {
	.eppg-wrapper { padding-left: 30px; padding-right: 30px; }
}
@media (max-width: 767px) {
	.eppg-wrapper { padding-left: 16px; padding-right: 16px; }
}

/* ── Grade ──────────────────────────────────────────────────────────────────── */
.eppg-wrapper .eppg-grid {
	--eppg-cols: 6;
	--eppg-gap: 16px;
	display: grid;
	grid-template-columns: repeat(var(--eppg-cols), minmax(0, 1fr));
	gap: var(--eppg-gap);
	width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
	box-sizing: border-box;
	align-items: start; /* cada card mantém a altura da sua própria imagem */
}

/* ── Card ───────────────────────────────────────────────────────────────────── */
.eppg-wrapper .eppg-card {
	--eppg-radius: 8px;
	--eppg-btn-size: 42px;
	display: block;
	min-width: 0;
	box-sizing: border-box;
}

/* (content-visibility foi removido: em alguns navegadores mobile ele
   interferia no toque dos botões dentro do card. O ganho de performance já vem
   do blur reduzido e dos observers do Swiper desligados no frontend.) */

/* ── Mídia (pôster) — TODO o conteúdo do card fica DENTRO dela ──────────────── */
/* Todos os cards no MESMO tamanho (proporção 2:3, padrão de capa de DVD) e a
   imagem SEMPRE INTEIRA (contain), sem cortar topo/base. Quando a proporção da
   capa difere de 2:3, a sobra é preenchida por um blur da PRÓPRIA imagem — não
   parece borda, parece parte da capa (mesmo truque de Netflix/Prime). */
.eppg-wrapper .eppg-card-media {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 2 / 3;
	overflow: hidden;
	border-radius: var(--eppg-radius);
}

/* Fallback p/ navegadores sem aspect-ratio (celulares antigos): sem isto, a
   moldura fica com altura 0 e a imagem (position:absolute) some — o card
   parecia "sem fundo". O padding-top de 150% reproduz a proporção 2:3. */
@supports not (aspect-ratio: 1 / 1) {
	.eppg-wrapper .eppg-card-media {
		height: 0;
		padding-top: 150%;
	}
}

/* Fundo: cópia borrada da capa preenchendo toda a moldura. Blur MODERADO
   (14px) — o blur pesado (30px) multiplicado por dezenas de cards era uma das
   principais causas de engasgo ao rolar no celular. */
.eppg-wrapper .eppg-card-media::before {
	content: "";
	position: absolute;
	top: 0; right: 0; bottom: 0; left: 0; /* em vez de inset:0 (mais compatível) */
	background-image: var(--eppg-bg, none);
	background-size: cover;
	background-position: center;
	filter: blur(14px) brightness(0.92) saturate(1.1);
	transform: scale(1.2);
	z-index: 0;
}

/* Imagem inteira, centralizada, por cima do fundo borrado */
.eppg-wrapper .eppg-card-img {
	position: absolute;
	top: 0; right: 0; bottom: 0; left: 0;
	z-index: 1;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
	object-fit: contain;
	object-position: center;
	display: block;
}

.eppg-wrapper .eppg-card-img--placeholder {
	position: absolute;
	top: 0; right: 0; bottom: 0; left: 0;
	z-index: 1;
	background: linear-gradient(135deg, #1f2937, #111827);
}

/* ── Brilho tipo reflexo de espelho ao passar o mouse ───────────────────────── */
.eppg-wrapper--shine .eppg-card-media::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 50%;
	height: 100%;
	z-index: 2;
	pointer-events: none;
	background: linear-gradient(
		120deg,
		rgba(255, 255, 255, 0) 0%,
		rgba(255, 255, 255, 0.35) 50%,
		rgba(255, 255, 255, 0) 100%
	);
	/* Anima via transform (composited) em vez de 'left' (repaint) — mais leve. */
	transform: translateX(-150%) skewX(-20deg);
	opacity: 0;
}

/* No hover, o reflexo varre a capa da esquerda para a direita (uma vez) */
.eppg-wrapper--shine .eppg-card-media:hover::after {
	opacity: 1;
	animation: eppg-shine 0.85s ease;
}

@keyframes eppg-shine {
	0%   { transform: translateX(-150%) skewX(-20deg); }
	100% { transform: translateX(250%) skewX(-20deg); }
}

/* Acessibilidade: respeita quem prefere menos animação */
@media (prefers-reduced-motion: reduce) {
	.eppg-wrapper--shine .eppg-card-media:hover::after {
		animation: none;
		opacity: 0;
	}
}

/* ── Coração de favorito (topo direito — oposto ao badge) ───────────────────── */
/* Regras autossuficientes: garantem posição/visual do coração mesmo que o CSS
   "wishlist-core" não tenha carregado (independe do handle epbc-wishlist-core). */
.eppg-wrapper .eppg-card-media .epbc-wl-heart--float {
	position: absolute;
	top: 10px;
	right: 10px;
	left: auto;
	z-index: 9; /* acima do gradiente/overlay e do link esticado (z-index:3) */
	pointer-events: auto; /* recebe o toque/clique no mobile */
	touch-action: manipulation; /* sem atraso de toque; evita gesto capturar */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 28px;
	height: 28px;
	padding: 0;
	margin: 0;
	background: rgba(8, 10, 15, 0.55); /* fundo compacto de volta */
	border: none;                      /* sem moldura quadrada herdada do tema */
	border-radius: 50%;
	color: #ffffff;                    /* neutro: branco quando NÃO favoritado */
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	outline: none;                     /* remove o retângulo de foco padrão */
	box-shadow: none;
	line-height: 0;
	transition: background-color 0.18s ease, transform 0.15s ease;
}

/* Favoritado: coração vermelho preenchido. */
.eppg-wrapper .eppg-card-media .epbc-wl-heart--float.is-fav {
	color: #ff4d6d;
}

/* Foco acessível: anel redondo discreto (em vez do retângulo do navegador) */
.eppg-wrapper .eppg-card-media .epbc-wl-heart--float:focus {
	outline: none;
}
.eppg-wrapper .eppg-card-media .epbc-wl-heart--float:focus-visible {
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.eppg-wrapper .eppg-card-media .epbc-wl-heart--float:hover {
	background: rgba(8, 10, 15, 0.75);
	transform: scale(1.1);
	color: #ffffff; /* não muda para rosa no hover */
}
.eppg-wrapper .eppg-card-media .epbc-wl-heart--float.is-fav:hover {
	color: #ff4d6d; /* favoritado continua vermelho no hover */
}

.eppg-wrapper .eppg-card-media .epbc-wl-heart--float svg {
	width: 15px;
	height: 15px;
	display: block;
	pointer-events: none;
}

.eppg-wrapper .eppg-card-media .epbc-wl-heart .epwl-heart-outline { display: block; }
.eppg-wrapper .eppg-card-media .epbc-wl-heart .epwl-heart-fill    { display: none; }
.eppg-wrapper .eppg-card-media .epbc-wl-heart.is-fav .epwl-heart-outline { display: none; }
.eppg-wrapper .eppg-card-media .epbc-wl-heart.is-fav .epwl-heart-fill    { display: block; }

/* ── Selo de desconto (topo esquerdo) ───────────────────────────────────────── */
.eppg-wrapper .eppg-badge {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 4;
	display: inline-block;
	padding: 4px 11px;
	background: #ff3b3b;
	color: #fff;
	font-size: 13px;
	font-weight: 800;
	line-height: 1.2;
	border-radius: 999px;
	box-shadow: 0 3px 10px rgba(255, 59, 59, 0.4);
	pointer-events: none;
}

/* ── Título (abaixo da imagem, fora do pôster) ──────────────────────────────── */
.eppg-wrapper .eppg-title-bar {
	margin-top: 10px;
	text-align: left;
}

.eppg-wrapper .eppg-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0;
	color: #ffffff;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	text-decoration: none;
}

.eppg-wrapper .eppg-title:hover {
	color: #ffffff;
	text-decoration: none;
}

/* Sem overlay/faixa: o preço já tem sombra de texto para legibilidade. */
.eppg-wrapper .eppg-overlay {
	display: none;
}

/* ── Link "stretched": capa clicável, MAS começando abaixo da zona dos botões ─ */
/* Antes cobria a capa inteira (inset:0) e no MOBILE roubava o toque do coração,
   abrindo a página do produto. Agora o link começa 52px abaixo do topo, então a
   faixa superior (onde ficam o coração e o selo) fica livre para o toque. */
.eppg-wrapper .eppg-card-link {
	position: absolute;
	top: 52px;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 3;
	display: block;
	font-size: 0;
	text-decoration: none;
}

/* ── Rodapé: info à esquerda, botão à direita ───────────────────────────────── */
.eppg-wrapper .eppg-footer {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 4;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 8px;
	padding: 12px;
	pointer-events: none; /* só o botão volta a receber cliques */
}

.eppg-wrapper .eppg-info {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	min-width: 0;
	overflow: hidden;
}

/* Categoria — badge com fundo translúcido cinza/preto */
.eppg-wrapper .eppg-tag {
	display: inline-block;
	max-width: 100%;
	margin: 0 0 5px;
	padding: 2px 8px;
	font-size: 10px;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: 0.02em;
	color: #f0f0f0;
	background: rgba(20, 20, 20, 0.7); /* opaco o bastante p/ dispensar blur no mobile */
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 6px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Bloco de preços — badge escura translúcida para o preço ganhar destaque */
.eppg-wrapper .eppg-prices {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	line-height: 1.05;
	padding: 5px 10px;
	background: rgba(10, 10, 12, 0.72);
	border-radius: 8px;
}

/* backdrop-filter (blur) é caro no mobile e multiplica por card. Só aplicamos
   em telas grandes com ponteiro fino (desktop), onde o custo é aceitável. */
@media (min-width: 1025px) and (hover: hover) {
	.eppg-wrapper .eppg-tag {
		background: rgba(20, 20, 20, 0.55);
		backdrop-filter: blur(4px);
		-webkit-backdrop-filter: blur(4px);
	}
	.eppg-wrapper .eppg-prices {
		background: rgba(10, 10, 12, 0.6);
		backdrop-filter: blur(5px);
		-webkit-backdrop-filter: blur(5px);
	}
}

.eppg-wrapper .eppg-price-old {
	margin: 0;
	font-size: 11px;
	font-weight: 600;
	color: #ff4d4d; /* preço antigo em vermelho */
	text-decoration: line-through;
}

.eppg-wrapper .eppg-price {
	margin: 0;
	font-size: 20px;
	font-weight: 900;
	line-height: 1.15;
	color: #ffffff; /* preço atual em branco */
	white-space: nowrap;
	letter-spacing: -0.01em;
}

.eppg-wrapper .eppg-card--sale .eppg-price {
	color: #ffffff; /* mantém branco também quando em promoção */
}

/* O markup de preço do WooCommerce herda cor/tamanho dos wrappers acima */
.eppg-wrapper .eppg-price .woocommerce-Price-amount,
.eppg-wrapper .eppg-price bdi,
.eppg-wrapper .eppg-price-old .woocommerce-Price-amount,
.eppg-wrapper .eppg-price-old bdi {
	color: inherit;
	font-size: inherit;
	font-weight: inherit;
	background: transparent;
	text-decoration: inherit;
}

/* ── Botão de carrinho circular ─────────────────────────────────────────────── */
.eppg-wrapper .eppg-btn {
	flex: 0 0 auto;
	pointer-events: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--eppg-btn-size, 42px);
	height: var(--eppg-btn-size, 42px);
	padding: 0;
	margin: 0;
	background: #2563eb;
	color: #fff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	text-decoration: none;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
	transition: background-color 0.2s ease;
	/* Zera a aparência nativa quando o botão é um <button> (modo toggle). */
	-webkit-appearance: none;
	appearance: none;
	font: inherit;
	line-height: 0;
}

.eppg-wrapper .eppg-btn:hover {
	background: #1d4ed8;
	color: #fff;
}

/* Enquanto a requisição AJAX do toggle está em andamento: gira a cesta e trava. */
.eppg-wrapper .eppg-btn--loading {
	opacity: 0.75;
	pointer-events: none;
}
.eppg-wrapper .eppg-btn--loading .eppg-cart-icon,
.eppg-wrapper .eppg-btn--loading .eppg-check-icon {
	animation: eppg-spin 0.7s linear infinite;
}

/* Ícones: escalam com o botão, mas com teto para não ficarem gigantes */
.eppg-wrapper .eppg-cart-icon,
.eppg-wrapper .eppg-btn .eppg-check-icon {
	width: 48%;
	height: 48%;
	max-width: 24px;
	max-height: 24px;
	display: block;
	pointer-events: none;
}

/* Por padrão, o check dentro do botão fica escondido — aparece só "no carrinho" */
.eppg-wrapper .eppg-btn .eppg-check-icon {
	display: none;
}

/* Estado "no carrinho": cor definida pelo controle "Fundo quando no Carrinho"
   (fallback verde). Troca o ícone de cesta pelo check. Cobre o carregamento
   (.eppg-btn--in-cart) e o pós-AJAX (.added). */
.eppg-wrapper .eppg-btn--in-cart,
.eppg-wrapper .eppg-btn.added,
.eppg-wrapper .eppg-btn--in-cart:hover,
.eppg-wrapper .eppg-btn.added:hover {
	background: #22c55e;
}
.eppg-wrapper .eppg-btn--in-cart .eppg-cart-icon,
.eppg-wrapper .eppg-btn.added .eppg-cart-icon {
	display: none;
}
.eppg-wrapper .eppg-btn--in-cart .eppg-check-icon,
.eppg-wrapper .eppg-btn.added .eppg-check-icon {
	display: block;
}

/* Estados do AJAX add-to-cart do WooCommerce */
.eppg-wrapper .eppg-btn.loading {
	opacity: 0.75;
	pointer-events: none;
}
.eppg-wrapper .eppg-btn.loading .eppg-cart-icon {
	animation: eppg-spin 0.7s linear infinite;
}
@keyframes eppg-spin {
	to { transform: rotate(360deg); }
}

/* Esconde o link "Ver carrinho" que o Woo injeta após o botão AJAX */
.eppg-wrapper a.added_to_cart {
	display: none !important;
}

/* ── Popup (toast) sobre a imagem ao adicionar/remover do carrinho ──────────── */
.eppg-wrapper .eppg-toast {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 6;
	width: max-content;
	max-width: calc(100% - 32px); /* folga das laterais: nunca cola nas bordas */
	padding: 8px 14px;
	background: rgba(12, 14, 18, 0.88);
	color: #ffffff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.25;
	text-align: center;
	white-space: normal; /* quebra em cards estreitos em vez de estourar */
	border-radius: 16px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	pointer-events: none;
	box-sizing: border-box;
	/* Estado inicial (escondido): levemente acima e transparente. */
	opacity: 0;
	transform: translate(-50%, -60%) scale(0.9);
	transition: opacity 0.28s ease, transform 0.28s ease;
}

.eppg-wrapper .eppg-toast--show {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

/* Acento por ação: verde ao adicionar, vermelho ao remover. */
.eppg-wrapper .eppg-toast--added {
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(34, 197, 94, 0.9) inset;
}
.eppg-wrapper .eppg-toast--removed {
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(255, 77, 77, 0.9) inset;
}
/* Falha (erro de rede, nonce expirado, produto indisponível). */
.eppg-wrapper .eppg-toast--error {
	background: rgba(153, 27, 27, 0.96);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(220, 38, 38, 0.9) inset;
}

@media (prefers-reduced-motion: reduce) {
	.eppg-wrapper .eppg-toast {
		transition: opacity 0.2s ease;
		transform: translate(-50%, -50%);
	}
	.eppg-wrapper .eppg-toast--show {
		transform: translate(-50%, -50%);
	}
}

/* ── Aviso (editor) ─────────────────────────────────────────────────────────── */
.eppg-notice {
	padding: 16px 20px;
	border: 1px dashed rgba(0, 0, 0, 0.2);
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.03);
	color: #666;
	font-size: 14px;
}

/* ── Responsivo: fallback caso os controles do Elementor não injetem ────────── */
@media (max-width: 1024px) {
	.eppg-wrapper .eppg-grid { --eppg-cols: 3; }
}
@media (max-width: 767px) {
	.eppg-wrapper .eppg-grid { --eppg-cols: 2; }
	.eppg-wrapper .eppg-footer { padding: 10px; }
	.eppg-wrapper .eppg-price  { font-size: 16px; }
	.eppg-wrapper .eppg-tag    { font-size: 12px; }
}

/* =============================================================================
   MODO CARROSSEL (uma linha, Swiper)
   ============================================================================= */
.eppg-wrapper--carousel .eppg-carousel {
	position: relative;
	width: 100%;
}

.eppg-wrapper--carousel .eppg-swiper {
	width: 100%;
	overflow: hidden;
}

/* Cada slide é um card; largura definida pelo Swiper (slidesPerView) */
.eppg-wrapper--carousel .swiper-slide {
	height: auto;
	box-sizing: border-box;
}

/* Fallback quando o Swiper não carrega: vira uma faixa rolável na horizontal */
.eppg-wrapper--carousel.eppg-no-swiper .swiper-wrapper {
	display: flex;
	gap: 16px;
	overflow-x: auto;
}
.eppg-wrapper--carousel.eppg-no-swiper .swiper-slide {
	flex: 0 0 auto;
	width: 220px;
}

/* ── Setas de navegação (círculo translúcido preto sobre as bordas) ─────────── */
.eppg-wrapper--carousel .eppg-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	/* Dimensão FIXA do círculo (não depende de padding/herança do tema). */
	width: 32px !important;
	height: 32px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: none !important;
	flex: 0 0 auto;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	padding: 0 !important;
	margin: 0;
	box-sizing: border-box;
	line-height: 0;
	background: rgba(0, 0, 0, 0.6);
	border: none;
	border-radius: 50%;
	color: #ffffff;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: transform 0.15s ease, background-color 0.2s ease, opacity 0.15s ease;
}

.eppg-wrapper--carousel .eppg-nav:hover {
	background: rgba(0, 0, 0, 0.7);
	transform: translateY(-50%) scale(1.1);
}

.eppg-wrapper--carousel .eppg-nav svg {
	width: 16px;  /* ajustável pelo controle "Tamanho da Seta" */
	height: 16px;
	display: block;
	flex: 0 0 auto;
}

/* Setas coladas nas bordas internas, sobre as capas (layout tipo Netflix). */
.eppg-wrapper--carousel .eppg-nav-prev {
	left: 8px;
}
.eppg-wrapper--carousel .eppg-nav-next {
	right: 8px;
}

/* Estado desabilitado (só ocorre sem loop) — some, mas não colapsa layout. */
.eppg-wrapper--carousel .eppg-nav.swiper-button-disabled {
	opacity: 0;
	pointer-events: none;
}

@media (max-width: 767px) {
	.eppg-wrapper--carousel .eppg-nav { padding: 8px; }
	.eppg-wrapper--carousel .eppg-nav-prev { left: 4px; }
	.eppg-wrapper--carousel .eppg-nav-next { right: 4px; }
}
