/* ============================================================
   Ferremaq – Cabecero personalizado
   ============================================================ */

:root {
	--fmq-blue: #144177;
	--fmq-yellow: #ffcf19;
	--fmq-white: #ffffff;
	--fmq-header-font: 'Montserrat', sans-serif;
	/* Logo: ~150px en pantallas grandes, se reduce en pantallas pequeñas */
	--fmq-logo-offset: clamp(12px, 5vw + 28px, 150px);
}

/* Ocultar cabecero Astra cuando el personalizado está activo */
body.fmq-custom-header-active #masthead,
body.fmq-custom-header-active #ast-desktop-header,
body.fmq-custom-header-active #ast-mobile-header,
body.fmq-custom-header-active .ast-mobile-header-wrap,
body.fmq-custom-header-active .ast-above-header-wrap,
body.fmq-custom-header-active .ast-below-header-wrap,
body.fmq-custom-header-active .ast-header-break-point .main-header-bar-wrap {
	display: none !important;
}

/* ── Aislar cabecero de estilos WooCommerce (.woocommerce-page img { max-width:100% }) ── */

body.woocommerce-page .fmq-header img:not(.fmq-header__logo-img),
body.woocommerce .fmq-header img:not(.fmq-header__logo-img),
.woocommerce-page .fmq-header img:not(.fmq-header__logo-img) {
	max-width: none !important;
	width: auto !important;
	height: auto !important;
}

body.woocommerce-page .fmq-header .fmq-header__logo-img,
body.woocommerce .fmq-header .fmq-header__logo-img,
.fmq-header__logo-img {
	display: block;
	height: 56px !important;
	width: auto !important;
	max-width: 200px !important;
	object-fit: contain;
	object-position: left center;
	/* Logo blanco → azul #144177 */
	filter: brightness(0) saturate(100%) invert(13%) sepia(30%) saturate(2878%) hue-rotate(199deg) brightness(95%) contrast(90%);
}

body.woocommerce-page .fmq-header .fmq-header__search-input,
body.woocommerce .fmq-header .fmq-header__search-input {
	width: auto !important;
	max-width: none !important;
	float: none !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	background: transparent !important;
}

body.woocommerce-page .fmq-header button,
body.woocommerce .fmq-header button,
body.woocommerce-page .fmq-header .fmq-header__search-btn,
body.woocommerce .fmq-header .fmq-header__search-btn {
	float: none !important;
	background: none !important;
	border: none !important;
	box-shadow: none !important;
}

/* Font Awesome dentro del cabecero (compatible con FA5 de Elementor) */
.fmq-header .fas,
.fmq-header .fab,
.fmq-header .fa-solid,
.fmq-header .fa-brands {
	display: inline-block;
	font-style: normal;
	font-variant: normal;
	line-height: 1;
	text-rendering: auto;
	-webkit-font-smoothing: antialiased;
}

.fmq-header .fas,
.fmq-header .fa-solid {
	font-family: "Font Awesome 5 Free", "Font Awesome 6 Free";
	font-weight: 900;
}

.fmq-header .fab,
.fmq-header .fa-brands {
	font-family: "Font Awesome 5 Brands", "Font Awesome 6 Brands";
	font-weight: 400;
}

.fmq-header {
	font-family: var(--fmq-header-font);
	position: relative;
	z-index: 9999;
	width: 100%;
	max-width: none;
	box-sizing: border-box;
}

/* ── Barra superior (amarilla) ─────────────────────────────── */

.fmq-header__top {
	background-color: var(--fmq-yellow);
	padding: 10px 0;
}

.fmq-header__top-inner {
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 0 36px;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(220px, 360px) minmax(0, 1fr);
	align-items: center;
	column-gap: 24px;
	min-height: 56px;
	box-sizing: border-box;
}

.fmq-header__top-left {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 0;
	width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

.fmq-header__logo-link {
	flex-shrink: 0;
	display: block;
	text-decoration: none;
	line-height: 0;
	max-width: 200px;
	margin-left: var(--fmq-logo-offset);
}

.fmq-header__tagline {
	color: var(--fmq-blue);
	font-size: 18px;
	font-weight: 600;
	margin: 0;
	margin-left: auto;
	padding-right: 8px;
	white-space: nowrap;
	flex-shrink: 0;
}

/* ── Buscador ──────────────────────────────────────────────── */

.fmq-header__search-wrap--desktop {
	width: 100%;
	max-width: 360px;
	min-width: 0;
	padding: 0;
	box-sizing: border-box;
	justify-self: center;
}

.fmq-header__search-form {
	display: flex;
	align-items: center;
	background: var(--fmq-white);
	border-radius: 999px;
	padding: 4px 6px 4px 20px;
	overflow: hidden;
}

.fmq-header__search-input {
	flex: 1;
	border: none !important;
	background: transparent !important;
	font-family: var(--fmq-header-font);
	font-size: 14px;
	color: #333;
	outline: none !important;
	box-shadow: none !important;
	min-width: 0;
	padding: 8px 0;
	-webkit-appearance: none;
	appearance: none;
	border-radius: 0;
}

.fmq-header__search-input:focus,
.fmq-header__search-input:focus-visible {
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	background: transparent !important;
}

.fmq-header__search-input::-webkit-search-decoration,
.fmq-header__search-input::-webkit-search-cancel-button,
.fmq-header__search-input::-webkit-search-results-button,
.fmq-header__search-input::-webkit-search-results-decoration {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}

.fmq-header__search-input::placeholder {
	color: #999;
}

.fmq-header__search-btn {
	background: none;
	border: none;
	cursor: pointer;
	color: #555;
	font-size: 16px;
	padding: 8px 14px;
	line-height: 1;
	transition: color 0.2s;
}

.fmq-header__search-btn:hover {
	color: var(--fmq-blue);
}

/* ── Acciones (WhatsApp, cuenta, carrito, menú) ───────────── */

.fmq-header__actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	width: 100%;
	max-width: 520px;
	min-width: 0;
	padding-left: 8px;
	box-sizing: border-box;
}

.fmq-header__whatsapp,
.fmq-header__account {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--fmq-blue);
	text-decoration: none;
	font-size: 18px;
	font-weight: 600;
	white-space: nowrap;
	transition: opacity 0.2s;
}

.fmq-header__whatsapp:hover,
.fmq-header__account:hover {
	opacity: 0.75;
}

.fmq-header__whatsapp i {
	font-size: 22px;
}

/* Botón flotante de WhatsApp (visible en todas las páginas) */
.fmq-header__whatsapp-float {
	position: fixed;
	right: clamp(12px, 2vw, 32px);
	bottom: clamp(24px, 4vw, 32px);
	z-index: 9990;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 18px;
	background: #25d366;
	color: var(--fmq-white);
	text-decoration: none;
	border-radius: 999px;
	font-family: var(--fmq-header-font);
	font-size: clamp(11px, 1.4vw, 14px);
	font-weight: 600;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	transition: background 0.2s ease, transform 0.2s ease;
	max-width: calc(100% - 24px);
}

.fmq-header__whatsapp-float:hover {
	background: #1ebe57;
	transform: translateY(-1px);
	color: var(--fmq-white);
}

.fmq-header__whatsapp-float i {
	font-size: 22px;
	flex-shrink: 0;
}

.fmq-header__cart {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--fmq-blue);
	text-decoration: none;
	font-size: 22px;
	padding: 4px;
	transition: opacity 0.2s;
}

.fmq-header__cart:hover {
	opacity: 0.75;
}

.fmq-header__cart-count {
	position: absolute;
	top: -2px;
	right: -6px;
	background: var(--fmq-blue);
	color: var(--fmq-white);
	font-size: 11px;
	font-weight: 700;
	min-width: 18px;
	height: 18px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	padding: 0 4px;
}

/* Botón hamburguesa (solo móvil) */
.fmq-header__toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 40px;
	height: 40px;
	padding: 8px;
	background: none;
	border: none;
	cursor: pointer;
	flex-shrink: 0;
}

.fmq-header__toggle-bar {
	display: block;
	width: 24px;
	height: 2px;
	background: var(--fmq-blue);
	border-radius: 2px;
	transition: transform 0.25s, opacity 0.25s;
}

.fmq-header__toggle.is-open .fmq-header__toggle-bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.fmq-header__toggle.is-open .fmq-header__toggle-bar:nth-child(2) {
	opacity: 0;
}

.fmq-header__toggle.is-open .fmq-header__toggle-bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* ── Barra de navegación (azul) ────────────────────────────── */

.fmq-header__nav {
	background-color: var(--fmq-blue);
	position: relative;
	z-index: 10001;
}

.fmq-header__nav-list {
	list-style: none;
	margin: 0;
	padding: 0 28px;
	width: 100%;
	max-width: none;
	box-sizing: border-box;
	display: flex;
	align-items: stretch;
	justify-content: stretch;
	flex-wrap: nowrap;
}

.fmq-header__nav-item {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 0;
	min-width: 0;
	position: relative;
}

.fmq-header__nav-item:not(:last-child)::after {
	content: '';
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 1px;
	height: 18px;
	background: rgba(255, 255, 255, 0.45);
	transition: opacity 0.15s;
}

.fmq-header__nav-item:hover::after,
.fmq-header__nav-item:focus-within::after {
	opacity: 0;
}

.fmq-header__nav-link {
	display: block;
	width: 100%;
	padding: 14px 12px;
	color: var(--fmq-white);
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
	text-transform: capitalize;
	text-align: center;
	transition: background 0.15s, color 0.15s, box-shadow 0.15s;
	white-space: nowrap;
	box-sizing: border-box;
}

.fmq-header__nav-item:hover > .fmq-header__nav-link,
.fmq-header__nav-item:focus-within > .fmq-header__nav-link {
	background: var(--fmq-white);
	color: var(--fmq-blue);
	box-shadow: inset 0 -3px 0 var(--fmq-blue);
}

/* ── Mega menú Productos (WooCommerce) ─────────────────────── */

.fmq-header__nav-item--productos {
	z-index: 2;
}

.fmq-header__mega {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 460px;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.15s ease, visibility 0.15s ease;
	z-index: 10002;
}

.fmq-header__nav-item--productos:hover .fmq-header__mega,
.fmq-header__nav-item--productos:focus-within .fmq-header__mega {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.fmq-header__mega-inner {
	display: flex;
	background: var(--fmq-white);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
	border-top: 1px solid #e8e8e8;
	max-height: 380px;
}

.fmq-header__mega-cats {
	list-style: none;
	margin: 0;
	padding: 0;
	width: 230px;
	flex-shrink: 0;
	border-right: 1px solid #eee;
	overflow-y: auto;
	max-height: 380px;
}

.fmq-header__mega-cat a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 13px 16px;
	color: var(--fmq-blue);
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
	border-bottom: 1px solid #eee;
	transition: background 0.15s;
}

.fmq-header__mega-cat a i {
	font-size: 11px;
	color: #aaa;
	flex-shrink: 0;
}

.fmq-header__mega-cat:hover a,
.fmq-header__mega-cat.is-active a {
	background: #f5f7fa;
}

.fmq-header__mega-products {
	position: relative;
	min-width: 230px;
	flex: 1 1 auto;
}

.fmq-header__mega-product-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: none;
	min-width: 230px;
}

.fmq-header__mega-product-list.is-active {
	display: block;
	max-height: 380px;
	overflow-y: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.fmq-header__mega-product-list.is-active::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

.fmq-header__mega-product-list a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 13px 16px;
	color: var(--fmq-blue);
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
	border-bottom: 1px solid #eee;
	transition: background 0.15s;
}

.fmq-header__mega-product-list a i {
	font-size: 11px;
	color: #aaa;
	flex-shrink: 0;
}

.fmq-header__mega-product-list a:hover {
	background: #f5f7fa;
}

.fmq-header__mega-product-empty {
	padding: 13px 16px;
	color: #888;
	font-size: 13px;
}

/* ── Panel móvil (hamburguesa) ─────────────────────────────── */

.fmq-header__overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 9998;
}

.fmq-header__panel {
	position: fixed;
	top: 0;
	right: 0;
	width: min(320px, 90vw);
	height: 100vh;
	background: var(--fmq-white);
	z-index: 9999;
	box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
	transform: translateX(100%);
	transition: transform 0.3s ease;
	overflow-y: auto;
}

.fmq-header__panel.is-open {
	transform: translateX(0);
}

.fmq-header__panel-inner {
	padding: 24px 20px;
}

.fmq-header__search-wrap--mobile {
	margin-bottom: 20px;
}

.fmq-header__search-toggle {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	background: #f5f5f5;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	font-family: var(--fmq-header-font);
	font-size: 14px;
	font-weight: 600;
	color: var(--fmq-blue);
	cursor: pointer;
}

.fmq-header__search-toggle span {
	flex: 1;
}

.fmq-header__search-chevron {
	font-size: 12px;
	transition: transform 0.2s;
}

.fmq-header__search-toggle.is-open .fmq-header__search-chevron {
	transform: rotate(180deg);
}

.fmq-header__search-collapsible {
	padding-top: 12px;
}

.fmq-header__search-collapsible .fmq-header__search-form {
	border: 1px solid #e0e0e0;
}

.fmq-header__panel-nav {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 1px solid #eee;
}

.fmq-header__panel-nav li a {
	display: block;
	padding: 14px 8px;
	color: var(--fmq-blue);
	text-decoration: none;
	font-size: 15px;
	font-weight: 600;
	border-bottom: 1px solid #eee;
	transition: background 0.2s;
}

.fmq-header__panel-nav li a:hover {
	background: #f8f8f8;
}

.fmq-header__panel-meta {
	margin-top: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.fmq-header__panel-meta .fmq-header__whatsapp,
.fmq-header__panel-meta .fmq-header__account {
	font-size: 15px;
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 1024px) {
	.fmq-header__top-inner {
		padding: 0 20px;
		column-gap: 16px;
		grid-template-columns: minmax(0, 1fr) minmax(180px, 300px) minmax(0, 1fr);
	}

	:root {
		--fmq-logo-offset: clamp(8px, 3vw + 12px, 64px);
	}

	.fmq-header__top-left {
		gap: 20px;
	}

	.fmq-header__tagline {
		display: none;
	}

	.fmq-header__search-wrap--desktop {
		max-width: 300px;
	}

	.fmq-header__actions {
		max-width: 380px;
		gap: 14px;
		padding-left: 4px;
	}

	.fmq-header__nav-list {
		padding: 0 12px;
	}

	.fmq-header__nav-item a {
		font-size: 13px;
		padding: 12px 8px;
	}
}

@media (max-width: 768px) {
	.fmq-header__top {
		padding: 8px 0;
	}

	.fmq-header__top-inner {
		display: flex;
		justify-content: space-between;
		gap: 12px;
		padding: 0 12px;
		column-gap: 0;
	}

	.fmq-header__logo-img {
		height: 42px;
		max-width: 140px;
	}

	:root {
		--fmq-logo-offset: 0;
	}

	.fmq-header__logo-link {
		margin-left: 0;
		max-width: 140px;
	}

	.fmq-header__tagline,
	.fmq-header__search-wrap--desktop,
	.fmq-header__whatsapp--desktop,
	.fmq-header__account--desktop,
	.fmq-header__nav {
		display: none;
	}

	.fmq-header__top-left {
		flex: 1;
		min-width: 0;
		justify-content: flex-start;
		padding-right: 0;
	}

	.fmq-header__toggle {
		display: flex;
	}

	.fmq-header__actions {
		width: auto;
		max-width: none;
		justify-content: flex-end;
		gap: 10px;
		padding-left: 0;
	}

	.fmq-header__cart {
		font-size: 20px;
	}

	.fmq-header__whatsapp-float span {
		display: none;
	}

	.fmq-header__whatsapp-float {
		padding: 12px;
		border-radius: 50%;
	}
}

@media (min-width: 769px) {
	.fmq-header__panel,
	.fmq-header__overlay {
		display: none !important;
	}
}
