/* =============================================================================
   ElementorPlus — Mini Carrinho (carrinho suspenso)
   Botão de carrinho com contador que abre um painel com os itens, subtotal e os
   botões "Ver carrinho" e "Finalização de compra".
   - Desktop: painel tipo dropdown ancorado no botão.
   - Mobile: drawer lateral em tela cheia com overlay.
   Escopado em .epmc-wrap / .epmc-panel. Prefixo: epmc-.
   ============================================================================= */

.epmc-wrap {
	--epmc-accent: #2563eb;
	--epmc-accent-hover: #1d4ed8;
	--epmc-panel-bg: #10141c;
	--epmc-surface-2: #171d28;
	--epmc-text: #ffffff;
	--epmc-muted: #9aa4b2;
	--epmc-border: rgba(255, 255, 255, 0.1);
	--epmc-badge: #ff3b3b;
	--epmc-icon-size: 24px;
	--epmc-panel-width: 380px;
	/* Ocupa a largura do widget e alinha o botão via justify-content (controle
	   "Alinhamento"). O botão em si tem tamanho automático, então NÃO estica
	   nem invade o widget vizinho. */
	display: flex;
	align-items: center;
	justify-content: flex-start;
	width: 100%;
	box-sizing: border-box;
}

.epmc-wrap *,
.epmc-wrap *::before,
.epmc-wrap *::after {
	box-sizing: border-box;
}

/* ── Botão (gatilho) com badge ───────────────────────────────────────────────── */
.epmc-wrap .epmc-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 8px;
	background: transparent;
	border: none;
	border-radius: 10px;
	color: var(--epmc-text);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	line-height: 0;
	transition: background-color 0.18s ease, color 0.18s ease;
}
.epmc-wrap .epmc-btn:hover {
	background: rgba(255, 255, 255, 0.08);
	color: var(--epmc-text);
}
.epmc-wrap .epmc-btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5);
}

.epmc-icon {
	display: inline-flex;
	flex: 0 0 auto;
}
.epmc-icon svg {
	width: var(--epmc-icon-size);
	height: var(--epmc-icon-size);
	display: block;
}

.epmc-label {
	font-size: 15px;
	font-weight: 700;
	line-height: 1;
}

/* Selo com a contagem de itens */
.epmc-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--epmc-badge);
	color: #fff;
	font-size: 11px;
	font-weight: 800;
	line-height: 1;
	border-radius: 999px;
	pointer-events: none;
}
.epmc-badge.is-hidden { display: none; }

/* "Pulso" quando o número muda */
.epmc-badge.epmc-bump { animation: epmc-bump 0.4s ease; }
@keyframes epmc-bump {
	0%   { transform: scale(1); }
	40%  { transform: scale(1.35); }
	100% { transform: scale(1); }
}

.epmc-sr {
	position: absolute;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ── Overlay (fundo escuro atrás do painel) ──────────────────────────────────── */
.epmc-overlay {
	position: fixed;
	inset: 0;
	z-index: 99990;
	background: rgba(3, 6, 12, 0.55);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}
.epmc-wrap.is-open .epmc-overlay,
.epmc-portal.is-open .epmc-overlay {
	opacity: 1;
	visibility: visible;
}

/* ── Painel (gaveta lateral fixa à direita, de cima a baixo) ─────────────────── */
/* Em qualquer tela o painel é uma gaveta colada na borda direita, ocupando toda
   a altura, que desliza da direita para a esquerda ao abrir. */
.epmc-panel {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 99991;
	width: var(--epmc-panel-width);
	max-width: 100vw;
	height: 100%;
	display: flex;
	flex-direction: column;
	background: var(--epmc-panel-bg);
	border-left: 1px solid var(--epmc-border);
	box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5);
	color: var(--epmc-text);
	visibility: hidden;
	transform: translateX(100%);
	transition: transform 0.3s cubic-bezier(.4, 0, .2, 1), visibility 0.3s ease;
	overflow: hidden;
}

.epmc-wrap.is-open .epmc-panel,
.epmc-portal.is-open .epmc-panel {
	visibility: visible;
	transform: translateX(0);
}

/* ── Cabeçalho do painel ─────────────────────────────────────────────────────── */
.epmc-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 18px 12px;
	border-bottom: 1px solid var(--epmc-border);
}
.epmc-head-title {
	margin: 0;
	font-size: 16px;
	font-weight: 800;
	line-height: 1.2;
	color: var(--epmc-text);
}
/* Botão de fechar (X). Forçamos o visual em TODOS os estados com !important
   porque o tema/Elementor costuma pintar <button> de rosa (fundo e borda) no
   hover/focus/active — mesma abordagem usada no menu mobile e na wishlist. */
.epmc-close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border-radius: 50%;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.18s ease, color 0.18s ease;
}
.epmc-wrap .epmc-close,
.epmc-wrap .epmc-close:hover,
.epmc-wrap .epmc-close:focus,
.epmc-wrap .epmc-close:active,
.epmc-wrap .epmc-close:visited,
.epmc-portal .epmc-close,
.epmc-portal .epmc-close:hover,
.epmc-portal .epmc-close:focus,
.epmc-portal .epmc-close:active,
.epmc-portal .epmc-close:visited {
	background: rgba(255, 255, 255, 0.06) !important;
	background-color: rgba(255, 255, 255, 0.06) !important;
	color: var(--epmc-muted) !important;
	border: 0 !important;
	box-shadow: none !important;
	outline: none;
}
.epmc-wrap .epmc-close:hover,
.epmc-portal .epmc-close:hover {
	background: rgba(255, 255, 255, 0.14) !important;
	background-color: rgba(255, 255, 255, 0.14) !important;
	color: var(--epmc-text) !important;
}
.epmc-wrap .epmc-close:focus-visible,
.epmc-portal .epmc-close:focus-visible {
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5) !important;
}
.epmc-close svg { width: 16px; height: 16px; display: block; }

/* ── Lista de itens (rolável) ────────────────────────────────────────────────── */
.epmc-items {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 6px 8px;
}

.epmc-item {
	display: grid;
	grid-template-columns: 72px 1fr auto;
	align-items: center;
	gap: 14px;
	padding: 12px 10px;
	border-radius: 10px;
	transition: background-color 0.15s ease;
}
.epmc-item + .epmc-item { border-top: 1px solid var(--epmc-border); }
.epmc-item.is-removing { opacity: 0.5; pointer-events: none; }

.epmc-thumb {
	width: 72px;
	height: 104px;
	border-radius: 8px;
	overflow: hidden;
	background: #0b0e14;
	flex: 0 0 auto;
}
.epmc-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.epmc-thumb--placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #1f2937, #0b0e14);
}

.epmc-info { min-width: 0; }
.epmc-title {
	display: block;
	margin: 0 0 4px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--epmc-text);
	text-decoration: none;
	/* Máx. 2 linhas com reticências. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
a.epmc-title:hover { color: var(--epmc-text); text-decoration: underline; }

.epmc-line {
	font-size: 13px;
	font-weight: 700;
	color: var(--epmc-accent);
	line-height: 1.2;
}
.epmc-line .epmc-qty { color: var(--epmc-muted); font-weight: 600; }

/* Botão remover (X). Visual neutro em TODOS os estados — nada de rosa/vermelho.
   Forçamos com !important para vencer o tema, que pinta <button> de rosa e cujo
   :hover ficava "grudado" no mobile após o toque. */
.epmc-remove {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border-radius: 50%;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.epmc-wrap .epmc-remove,
.epmc-wrap .epmc-remove:hover,
.epmc-wrap .epmc-remove:focus,
.epmc-wrap .epmc-remove:active,
.epmc-wrap .epmc-remove:visited,
.epmc-portal .epmc-remove,
.epmc-portal .epmc-remove:hover,
.epmc-portal .epmc-remove:focus,
.epmc-portal .epmc-remove:active,
.epmc-portal .epmc-remove:visited {
	background: transparent !important;
	background-color: transparent !important;
	border: 1px solid var(--epmc-border) !important;
	color: var(--epmc-muted) !important;
	box-shadow: none !important;
	outline: none;
}
/* Realce só em dispositivos com mouse real (evita hover "preso" no toque):
   apenas clareia o fundo/cor, sem virar vermelho. */
@media (hover: hover) {
	.epmc-wrap .epmc-remove:hover,
	.epmc-portal .epmc-remove:hover {
		background: rgba(255, 255, 255, 0.12) !important;
		background-color: rgba(255, 255, 255, 0.12) !important;
		border-color: rgba(255, 255, 255, 0.28) !important;
		color: var(--epmc-text) !important;
	}
}
.epmc-wrap .epmc-remove:focus-visible,
.epmc-portal .epmc-remove:focus-visible {
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5) !important;
}
.epmc-remove svg { width: 12px; height: 12px; display: block; }

/* ── Rodapé (subtotal + ações) ───────────────────────────────────────────────── */
.epmc-foot {
	flex: 0 0 auto;
	padding: 14px 18px 16px;
	border-top: 1px solid var(--epmc-border);
	background: var(--epmc-surface-2);
}
.epmc-subtotal {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}
.epmc-subtotal-label {
	font-size: 14px;
	font-weight: 700;
	color: var(--epmc-text);
}
.epmc-subtotal-value {
	font-size: 18px;
	font-weight: 900;
	color: var(--epmc-text);
}
.epmc-subtotal-value .woocommerce-Price-amount { color: inherit; }

.epmc-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.epmc-wrap .epmc-action,
.epmc-portal .epmc-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 12px 16px;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	border-radius: 10px;
	text-decoration: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
/* "Ver carrinho": secundário (contorno). */
.epmc-wrap .epmc-action--cart,
.epmc-portal .epmc-action--cart {
	color: var(--epmc-text);
	background: transparent;
	border: 1px solid var(--epmc-border);
}
.epmc-wrap .epmc-action--cart:hover,
.epmc-portal .epmc-action--cart:hover {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.28);
	color: var(--epmc-text);
}
/* "Finalização de compra": primário (destaque). */
.epmc-wrap .epmc-action--checkout,
.epmc-portal .epmc-action--checkout {
	color: #fff;
	background: var(--epmc-accent);
	border: 1px solid var(--epmc-accent);
}
.epmc-wrap .epmc-action--checkout:hover,
.epmc-portal .epmc-action--checkout:hover {
	background: var(--epmc-accent-hover);
	border-color: var(--epmc-accent-hover);
	color: #fff;
}

/* ── Estado vazio ────────────────────────────────────────────────────────────── */
.epmc-empty {
	display: none;
	padding: 36px 20px;
	text-align: center;
	color: var(--epmc-muted);
	font-size: 14px;
}
.epmc-wrap.is-empty .epmc-items,
.epmc-wrap.is-empty .epmc-foot,
.epmc-portal.is-empty .epmc-items,
.epmc-portal.is-empty .epmc-foot { display: none; }
.epmc-wrap.is-empty .epmc-empty,
.epmc-portal.is-empty .epmc-empty { display: block; }

/* ── Estado carregando ───────────────────────────────────────────────────────── */
.epmc-wrap.is-loading .epmc-items,
.epmc-portal.is-loading .epmc-items { opacity: 0.55; }

/* ── Mobile: a gaveta ocupa quase toda a largura da tela ─────────────────────── */
@media (max-width: 767px) {
	.epmc-panel {
		width: min(88vw, 400px);
	}
}

/* Trava o scroll do fundo quando o painel está aberto (classe no <body>). */
body.epmc-lock { overflow: hidden; }

/* ── Portal (container no <body>) ────────────────────────────────────────────
   Para que o painel/overlay NÃO fiquem presos ao contexto de empilhamento do
   cabeçalho (header sticky/fixed) — o que fazia widgets vizinhos, como o botão
   de favoritos, aparecerem por cima — o JS move o overlay + painel para este
   container anexado diretamente ao <body>. Assim eles ficam acima de tudo.

   Os valores das variáveis (cores/largura) são copiados do .epmc-wrap para este
   container inline pelo JS, para manter a aparência escolhida no widget. */
.epmc-portal {
	--epmc-accent: #2563eb;
	--epmc-accent-hover: #1d4ed8;
	--epmc-panel-bg: #10141c;
	--epmc-surface-2: #171d28;
	--epmc-text: #ffffff;
	--epmc-muted: #9aa4b2;
	--epmc-border: rgba(255, 255, 255, 0.1);
	--epmc-badge: #ff3b3b;
	--epmc-panel-width: 380px;
}
.epmc-portal *,
.epmc-portal *::before,
.epmc-portal *::after {
	box-sizing: border-box;
}

/* No editor do Elementor: o painel e o overlay (position:fixed) não devem ser
   renderizados, senão aparecem sobre a tela/outros widgets no preview. Só o
   botão fica visível para posicionar/estilizar. */
.epmc-wrap--editor .epmc-panel,
.epmc-wrap--editor .epmc-overlay {
	display: none !important;
}

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

/* Acessibilidade: respeita quem prefere menos animação */
@media (prefers-reduced-motion: reduce) {
	.epmc-panel,
	.epmc-overlay,
	.epmc-btn,
	.epmc-badge,
	.epmc-action,
	.epmc-remove { transition: none; }
	.epmc-badge.epmc-bump { animation: none; }
}
