/**
 * Styles for the B2B header that aren't covered by the Tailwind CDN build.
 */

/* ─── Variáveis globais de layout ──────────────────────────────────────────
   Altere apenas aqui para mudar a largura máxima em todo o site.
   Deve coincidir com max-w-7xl do Tailwind (80rem = 1280px).            */
:root {
	--evo-max-w: 80rem; /* 1280px */
	/* Valor inicial calculado estaticamente para evitar CLS antes do JS rodar.
	   Mobile (<768): barra gradiente h-16 (64px) + busca mobile (56px) + chips (53px) = 173px
	   JS atualiza para a altura real medida; se bater com a estimativa, CLS = 0. */
	--evo-header-h: 173px;
}

@media (min-width: 768px) {
	/* Desktop: barra gradiente h-20 (80px) + chips (53px) = 133px. Sem busca mobile. */
	:root { --evo-header-h: 133px; }
}

/* ─── Auto-hide header ──────────────────────────────────────────────────────
   A barra preta (#evo-topbar) é um elemento normal fora do #masthead e rola
   com a página. O #masthead (nav vermelho + chips) fica fixo logo abaixo da
   topbar enquanto ela é visível; após sair do viewport, cola em top:0.
   JS atualiza masthead.style.top frame a frame; este CSS é o fallback.     */
#masthead {
	position: fixed !important;
	top: var(--evo-topbar-h, 0px);
	left: 0;
	right: 0;
	transform: translateY(0);
	transition: transform 320ms cubic-bezier(0.4, 0, 0.2, 1),
	            box-shadow 320ms ease;
	will-change: transform;
}

#masthead.header-hidden {
	transform: translateY(-100%);
	box-shadow: none !important;
}

/* Compensate for fixed positioning so content is not hidden under the header */
#page {
	padding-top: var(--evo-header-h);
}

/* WP Admin bar: fallback até o JS definir masthead.style.top */
.admin-bar #masthead                         { top: calc(var(--evo-topbar-h, 0px) + 32px); }
@media screen and (max-width: 782px) {
	.admin-bar #masthead                     { top: calc(var(--evo-topbar-h, 0px) + 46px); }
}

/* Container padrão: mesma largura do header, pode ser usado como classe
   em blocos Gutenberg (campo "CSS adicional") ou em qualquer template.  */
.evo-container {
	max-width: var(--evo-max-w);
	margin-left: auto;
	margin-right: auto;
	padding-left: 1.5rem;
	padding-right: 1.5rem;
}

.bg-brand-gradient {
	background: linear-gradient(rgb(151, 8, 42) 0%, rgb(179, 9, 49) 100%);
}

.scrollbar-hide::-webkit-scrollbar {
	display: none;
}

.scrollbar-hide {
	-ms-overflow-style: none;
	scrollbar-width: none;
}

#masthead .custom-logo {
	object-fit: contain;
}

#mobile-menu.is-open {
	display: block;
}

/* ============================================================
   Instant Search (autocomplete) dropdown
   ============================================================ */

.evo-search-wrap {
	position: relative;
}

.evo-search-results {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 60;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
	max-height: 70vh;
	overflow-y: auto;
	padding: 0.5rem 0;
}

.evo-search-group + .evo-search-group {
	border-top: 1px solid #eef0f2;
	margin-top: 0.25rem;
	padding-top: 0.25rem;
}

.evo-search-group__label {
	margin: 0;
	padding: 0.4rem 1rem 0.25rem;
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #94a3b8;
}

.evo-search-ver-mais {
	display: block;
	padding: 0.5rem 1rem;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #2563eb;
	text-decoration: none;
	border-top: 1px solid #eef0f2;
	margin-top: 0.25rem;
}

.evo-search-ver-mais:hover {
	background: #f1f5f9;
	text-decoration: underline;
}

.evo-search-result {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.5rem 1rem;
	text-decoration: none;
	color: inherit;
	transition: background 0.12s;
}

.evo-search-result:hover,
.evo-search-result:focus {
	background: #f8fafc;
}

.evo-search-result--product {
	flex-direction: column;
	align-items: stretch;
	gap: 0.375rem;
	padding-top: 0.4rem;
	padding-bottom: 0.4rem;
}

.evo-search-result__link {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	text-decoration: none;
	color: inherit;
}

.evo-search-result--product .evo-search-result__thumb {
	width: 32px;
	height: 32px;
	border-radius: 6px;
	object-fit: contain;
	background: #f1f5f9;
	flex-shrink: 0;
}

.evo-search-result__actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.4rem;
}

.evo-search-qty {
	display: flex;
	align-items: stretch;
	border: 1px solid #e2e8f0;
	border-radius: 7px;
	background: #f8fafc;
	height: 22px;
	overflow: hidden;
	flex-shrink: 0;
}

.evo-search-qty button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 100%;
	border: none;
	background: none;
	color: #64748b;
	font-weight: 700;
	font-size: 0.6875rem;
	line-height: 1;
	cursor: pointer;
	transition: color 0.12s, background 0.12s;
}

.evo-search-qty button:hover {
	color: #97082a;
	background: #f1f5f9;
}

.evo-search-qty .qty-input {
	width: 22px;
	height: 100%;
	border: none;
	background: transparent;
	color: #0f172a;
	text-align: center;
	font-size: 0.6875rem;
	font-weight: 600;
	line-height: 1;
	padding: 0;
	-moz-appearance: textfield;
}

.evo-search-qty .qty-input::-webkit-inner-spin-button,
.evo-search-qty .qty-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.evo-search-buy-btn {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 22px;
	border-radius: 7px;
	background: #0f172a;
	color: #fff;
	flex-shrink: 0;
	transition: background 0.12s;
}

.evo-search-buy-btn:hover {
	background: #97082a;
}

.evo-search-buy-btn.loading {
	color: transparent;
	pointer-events: none;
}

.evo-search-buy-btn.loading * {
	opacity: 0;
}

.evo-search-buy-btn.loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0.7rem;
	height: 0.7rem;
	margin: -0.35rem 0 0 -0.35rem;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: evo-search-spinner 0.6s linear infinite;
}

@keyframes evo-search-spinner {
	to { transform: rotate(360deg); }
}

.evo-search-buy-btn.btn-success-state,
.evo-search-buy-btn.added {
	background: #10b981;
}

/* WC appends a "View cart" text link right after the button on success — no room for it here. */
.evo-search-result__actions .added_to_cart {
	display: none;
}

.evo-search-result__body {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
}

.evo-search-result__title {
	font-size: 0.8125rem;
	font-weight: 600;
	color: #0f172a;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.evo-search-result__sku {
	font-size: 0.6875rem;
	color: #94a3b8;
}

.evo-search-result__price {
	font-size: 0.8125rem;
	font-weight: 700;
	color: #97082a;
	flex-shrink: 0;
	white-space: nowrap;
}

.evo-search-result--shortcut .evo-search-result__title {
	font-weight: 600;
	color: #0f172a;
	flex: 1;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.evo-search-result__thumb--round {
	width: 28px;
	height: 28px;
	border-radius: 6px;
	object-fit: contain;
	background: #f1f5f9;
	border: 1px solid #eef0f2;
	flex-shrink: 0;
}

.evo-search-result__shortcut-label {
	font-size: 0.6875rem;
	font-weight: 600;
	color: #97082a;
	white-space: nowrap;
}

.evo-search-empty {
	margin: 0;
	padding: 1rem;
	font-size: 0.8125rem;
	color: #94a3b8;
	text-align: center;
}

/* ============================================================
   Search results page — featured brand/category card + fallback notice
   ============================================================ */

.evo-search-featured {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 0.625rem;
	margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
	.evo-search-featured {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (min-width: 1280px) {
	.evo-search-featured {
		grid-template-columns: repeat(4, 1fr);
	}
}

.evo-search-featured__card {
	display: flex;
	align-items: center;
	gap: 0.875rem;
	padding: 0.875rem 1rem;
	border-radius: 12px;
	background: #fff;
	border: 1px solid #e2e8f0;
	text-decoration: none;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.evo-search-featured__card:hover {
	border-color: #97082a;
	box-shadow: 0 6px 16px -4px rgba(151, 8, 42, 0.18);
}

.evo-search-featured__media {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 10px;
	background: #f8fafc;
	color: #97082a;
	flex-shrink: 0;
	overflow: hidden;
}

.evo-search-featured__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.evo-search-featured__body {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
}

.evo-search-featured__kicker {
	font-size: 0.625rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #94a3b8;
}

.evo-search-featured__title {
	font-size: 0.9375rem;
	font-weight: 700;
	color: #0f172a;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.evo-search-featured__cta {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	font-size: 0.75rem;
	font-weight: 700;
	color: #97082a;
	white-space: nowrap;
	flex-shrink: 0;
}

.evo-search-fallback-notice {
	margin: 0 0 1rem;
	padding: 0.75rem 1rem;
	border-radius: 10px;
	background: #fdf2f3;
	border: 1px solid #f6d3d6;
	color: #97082a;
	font-size: 0.8125rem;
	font-weight: 600;
}

/* ============================================================
   Sidebar lateral
   ============================================================ */
#sidebar-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	z-index: 9998;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.32s ease;
}
#sidebar-overlay.open {
	opacity: 1;
	pointer-events: all;
}

#sidebar {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: 100vw;
	background: #ffffff;
	z-index: 9999;
	transform: translateX(-100%);
	transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
	display: flex;
	flex-direction: column;
}
#sidebar.open {
	transform: translateX(0);
}
@media (min-width: 768px) {
	#sidebar {
		width: 320px;
		max-width: 88vw;
		box-shadow: 4px 0 32px rgba(0, 0, 0, 0.18);
	}
}

#sidebar-body {
	overflow-y: auto;
	flex: 1;
}
#sidebar-body::-webkit-scrollbar { width: 4px; }
#sidebar-body::-webkit-scrollbar-track { background: #f1f5f9; }
#sidebar-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

/* Categorias expansíveis no sidebar */
.cat-arrow { transition: transform 0.25s ease; }
.cat-item.open .cat-arrow { transform: rotate(90deg); }
.cat-sub {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.cat-item.open .cat-sub { max-height: 500px; }

/* Card de promoção no sidebar */
.evo-sidebar-promo {
	background: linear-gradient(135deg, #97082a 0%, #ed1b24 100%);
	border-radius: 14px;
	padding: 16px;
	color: white;
	position: relative;
	overflow: hidden;
}
.evo-sidebar-promo::before {
	content: '';
	position: absolute;
	top: -20px;
	right: -20px;
	width: 100px;
	height: 100px;
	background: rgba(255, 255, 255, 0.08);
	border-radius: 50%;
	pointer-events: none;
}
.evo-sidebar-promo::after {
	content: '';
	position: absolute;
	bottom: -30px;
	right: 20px;
	width: 80px;
	height: 80px;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 50%;
	pointer-events: none;
}

/* ============================================================
   Dropdown de departamentos (desktop)
   ============================================================ */
#dept-wrapper { position: relative; }
#dept-dropdown {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	width: 260px;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-8px);
	transition: opacity 0.22s ease, transform 0.22s ease;
	z-index: 200;
}
#dept-dropdown.open {
	opacity: 1;
	pointer-events: all;
	transform: translateY(0);
}

/* ============================================================
   Dropdown do usuário (desktop)
   ============================================================ */
#user-wrapper { position: relative; }
#user-dropdown {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: 210px;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-8px);
	transition: opacity 0.22s ease, transform 0.22s ease;
	z-index: 200;
}
#user-dropdown.open {
	opacity: 1;
	pointer-events: all;
	transform: translateY(0);
}
.evo-user-dd-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 14px;
	font-size: 13px;
	color: #374151;
	text-decoration: none;
	transition: background 0.15s, color 0.15s;
}
.evo-user-dd-item:hover {
	background: #f9fafb;
	color: #ed1b24;
}
.evo-user-dd-item--danger { color: #ef4444; font-weight: 600; }
.evo-user-dd-item--danger:hover { background: #fef2f2; color: #dc2626; }

/* iOS Safari auto-zooms any input with font-size < 16px on focus.
   Setting 1rem (16px) here prevents that without changing the layout. */
#search-desktop,
#search-mobile {
	font-size: 1rem;
}

/* Sticky subbar: fallback de top até o JS calcular o bottom real do masthead */
.evo-sticky-subbar {
	top: var(--evo-header-h, 4rem);
}

/* Fundo preto para overscroll iOS não mostrar branco abaixo do footer */
html { background-color: #000000; }

/* Clearance para a ilha flutuante não cobrir conteúdo no mobile */
@media (max-width: 640px) {
	body { padding-bottom: 96px; }
}
