:root, :host, .bersoft-header-wrap {
	--bersoft-font: var(--bersoft-font-family, var(--wp--preset--font-family--base, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif));
	--bersoft-brown: var(--bersoft-theme-brown, var(--bersoft-color-primary, #5C4533));
	--bersoft-dark: var(--bersoft-text-dark, var(--bersoft-color-dark, #1C1B1A));
	--bersoft-muted: var(--bersoft-text-muted, var(--bersoft-color-muted, #736B63));
	--bersoft-border: var(--bersoft-border-color, var(--wp--preset--color--border, #E8E4DC));
	--bersoft-surface: var(--bersoft-color-surface, var(--bersoft-bg-card, #FFFFFF));
	--bersoft-bg-subtle: var(--bersoft-bg-subtle, #FAF7F2);
	--bersoft-badge-bg: var(--bersoft-badge-bg, #EFE7DA);
	--bersoft-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

/* 1. Resets e inmunidad frente a estilos globales de Elementor */
.bersoft-header-wrap, .bersoft-header-wrap * { box-sizing: border-box; }
.bersoft-header-wrap { width: 100%; background: var(--bersoft-surface); border-bottom: 1px solid var(--bersoft-border); font-family: var(--bersoft-font); color: var(--bersoft-dark); position: relative; z-index: 99990; }
.bersoft-header-wrap button, .bersoft-header-wrap input[type="button"] { background: transparent !important; background-color: transparent !important; border: none !important; box-shadow: none !important; border-radius: 0 !important; color: var(--bersoft-dark) !important; padding: 0 !important; line-height: 1; font-family: var(--bersoft-font); }
.bersoft-header-wrap ul, .bersoft-header-wrap li { list-style: none; margin: 0; padding: 0; }

/* 2. Fila principal alineada exactamente con el catálogo (max-width: 1320px, padding: 16px) */
.bersoft-header-main-row { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 20px; padding: 10px 16px; min-height: 68px; position: relative; }
.bersoft-mobile-toggle-btn { display: none; width: 40px; height: 40px; align-items: center; justify-content: center; cursor: pointer; color: var(--bersoft-dark); border-radius: 8px !important; }
.bersoft-mobile-toggle-btn:focus-visible { outline: 2px solid var(--bersoft-brown) !important; }
.bersoft-header-logo { text-decoration: none; display: inline-flex; align-items: center; flex-shrink: 0; }
.bersoft-header-logo-text { font-size: 24px; font-weight: 800; letter-spacing: 1.5px; color: var(--bersoft-dark); text-transform: uppercase; font-family: var(--bersoft-font); }
.bersoft-header-logo-img { max-height: 48px; max-width: 220px; width: auto; object-fit: contain; display: block; }
.bersoft-mobile-logo { display: none; }

/* 3. Desplegable de Categorías (solo padres de primer nivel) */
.bersoft-categories-dropdown-wrap { position: relative; flex-shrink: 0; }
.bersoft-btn-categories-trigger { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px !important; border-radius: 9999px !important; font-size: 14px; font-weight: 600; color: var(--bersoft-dark) !important; cursor: pointer; transition: background 140ms ease; }
.bersoft-btn-categories-trigger:hover { background-color: var(--bersoft-bg-subtle) !important; color: var(--bersoft-brown) !important; }
.bersoft-btn-categories-trigger:focus-visible { outline: 2px solid var(--bersoft-brown) !important; outline-offset: 2px; }
.bersoft-categories-popover { position: absolute; top: calc(100% + 10px); left: 0; width: 260px; max-height: 420px; background: var(--bersoft-surface); border: 1px solid var(--bersoft-border); border-radius: 16px; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12); padding: 8px 0; z-index: 1000; opacity: 0; visibility: hidden; transform: translateY(-8px); transition: all 160ms var(--bersoft-spring); }
.bersoft-categories-popover.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.bersoft-categories-scroll { max-height: 380px; overflow-y: auto; padding: 4px 0; }
.bersoft-cat-tree-item a { display: block; padding: 9px 20px; font-size: 14px; font-weight: 500; color: var(--bersoft-dark); text-decoration: none; transition: background 120ms ease; }
.bersoft-cat-tree-item a:hover { background: var(--bersoft-bg-subtle); color: var(--bersoft-brown); }

/* 4. Buscador protagonista que aprovecha el ancho libre */
.bersoft-header-search-wrap { flex: 1; min-width: 220px; position: relative; }
.bersoft-header-search-form { display: flex; align-items: center; width: 100%; background: #FFFFFF; border: 2px solid var(--bersoft-dark); border-radius: 9999px; padding: 0 4px 0 18px; height: 46px; transition: border-color 140ms ease, box-shadow 140ms ease; }
.bersoft-header-search-form:focus-within { border-color: var(--bersoft-brown); box-shadow: 0 2px 10px rgba(92, 69, 51, 0.14); }
.bersoft-search-input { flex: 1; height: 100%; border: none !important; background: transparent !important; outline: none !important; font-size: 14px; font-family: var(--bersoft-font); color: var(--bersoft-dark); }
.bersoft-search-input::placeholder { color: var(--bersoft-muted); opacity: 0.85; }
.bersoft-header-wrap .bersoft-search-submit { width: 38px; height: 38px; border-radius: 50% !important; background: var(--bersoft-brown) !important; background-color: var(--bersoft-brown) !important; color: #FFFFFF !important; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: transform 120ms ease, opacity 120ms ease; }
.bersoft-header-wrap .bersoft-search-submit:hover { opacity: 0.92; transform: scale(1.04); }
.bersoft-header-wrap .bersoft-search-submit:active { transform: scale(0.96); }
.bersoft-header-wrap .bersoft-search-submit svg { stroke: #FFFFFF !important; }
.bersoft-search-cancel-btn { display: none; }
.bersoft-mobile-search-trigger { display: none; }

/* 5. Resultados sugeridos en tiempo real (AJAX) */
.bersoft-search-ajax-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--bersoft-surface); border: 1px solid var(--bersoft-border); border-radius: 16px; box-shadow: 0 16px 36px rgba(0, 0, 0, 0.14); padding: 8px 0; z-index: 10000; display: none; overflow: hidden; }
.bersoft-search-ajax-results.is-open { display: block; }
.bersoft-ajax-item { display: flex; align-items: center; gap: 14px; padding: 10px 18px; text-decoration: none; color: var(--bersoft-dark); transition: background 120ms ease; cursor: pointer; }
.bersoft-ajax-item:hover, .bersoft-ajax-item.is-focused { background: var(--bersoft-bg-subtle); outline: none; }
.bersoft-ajax-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #eee; flex-shrink: 0; border: 1px solid var(--bersoft-border); }
.bersoft-ajax-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.bersoft-ajax-title { font-size: 13.5px; font-weight: 600; color: var(--bersoft-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bersoft-ajax-price { font-size: 13px; font-weight: 700; color: var(--bersoft-brown); }
.bersoft-ajax-message { padding: 16px; text-align: center; font-size: 13.5px; color: var(--bersoft-muted); }
.bersoft-ajax-footer { border-top: 1px solid var(--bersoft-border); padding: 10px 16px; text-align: center; background: var(--bersoft-bg-subtle); }
.bersoft-ajax-all-link { font-size: 13px; font-weight: 600; color: var(--bersoft-brown); text-decoration: none; }
.bersoft-ajax-all-link:hover { text-decoration: underline; }

/* 6. Acciones: Ayuda, Cuenta y Carrito */
.bersoft-header-actions-group { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
.bersoft-help-wrap, .bersoft-account-wrap { position: relative; }
.bersoft-header-icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px !important; border-radius: 9999px !important; color: var(--bersoft-dark) !important; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; transition: background 140ms, color 140ms; position: relative; }
.bersoft-header-icon-btn:hover { background-color: var(--bersoft-bg-subtle) !important; color: var(--bersoft-brown) !important; }
.bersoft-header-icon-btn:focus-visible { outline: 2px solid var(--bersoft-brown) !important; outline-offset: 2px; }
.bersoft-user-initial { width: 32px; height: 32px; border-radius: 50%; background: #EDE6DC; border: 1.5px solid #D5C8B8; color: var(--bersoft-brown); font-size: 13.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bersoft-acc-caret { color: var(--bersoft-muted); transition: transform 160ms ease; margin-left: 2px; }
.bersoft-account-btn[aria-expanded="true"] .bersoft-acc-caret { transform: rotate(180deg); }

/* Carrito y pastilla calibrada sin solapamiento */
.bersoft-cart-btn { position: relative; padding: 8px 10px !important; }
.bersoft-cart-badge { display: none; position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9999px; background: var(--bersoft-brown); color: #FFFFFF; font-size: 10px; font-weight: 700; align-items: center; justify-content: center; line-height: 1; border: 1.5px solid var(--bersoft-surface); pointer-events: none; }
.bersoft-cart-badge.is-visible { display: inline-flex; }

/* Popovers flotantes: Ayuda y Cuenta */
.bersoft-help-popover, .bersoft-account-menu-popover { position: absolute; top: calc(100% + 10px); right: 0; width: 270px; background: var(--bersoft-surface); border: 1px solid var(--bersoft-border); border-radius: 16px; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12); padding: 16px; z-index: 1000; opacity: 0; visibility: hidden; transform: translateY(-8px); transition: all 160ms var(--bersoft-spring); }
.bersoft-help-popover.is-open, .bersoft-account-menu-popover.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.bersoft-help-title { font-size: 14.5px; font-weight: 700; color: var(--bersoft-dark); margin-bottom: 6px; line-height: 1.3; }
.bersoft-help-desc { font-size: 12.5px; color: var(--bersoft-muted); line-height: 1.45; margin: 0 0 12px; }
.bersoft-help-contact-item { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--bersoft-dark); text-decoration: none; margin-bottom: 8px; }
.bersoft-help-link-action { font-size: 12.5px; font-weight: 600; color: var(--bersoft-brown); text-decoration: underline; display: inline-block; }
.bersoft-account-popover-header { padding-bottom: 10px; border-bottom: 1px solid var(--bersoft-border); margin-bottom: 6px; }
.bersoft-account-popover-header strong { display: block; font-size: 14px; color: var(--bersoft-dark); }
.bersoft-account-popover-header span { font-size: 12px; color: var(--bersoft-muted); word-break: break-all; }
.bersoft-account-popover-nav { display: flex; flex-direction: column; }
.bersoft-acc-nav-link { padding: 7px 0; font-size: 13.5px; font-weight: 500; color: var(--bersoft-dark); text-decoration: none; }
.bersoft-acc-nav-link:hover { color: var(--bersoft-brown); }
.bersoft-acc-nav-sep { height: 1px; background: var(--bersoft-border); margin: 5px 0; }
.bersoft-acc-logout { color: #B85D38; }

/* Selector de Moneda PEN / USD conectado a FOX */
.bersoft-currency-wrap { position: relative; }
.bersoft-currency-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px !important;
	border: 1px solid var(--bersoft-border) !important;
	border-radius: 9999px !important;
	color: var(--bersoft-dark) !important;
	font-size: 12.5px;
	font-weight: 600;
	background: var(--bersoft-surface) !important;
	cursor: pointer;
	transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
	line-height: 1;
	height: 36px;
	white-space: nowrap;
}
.bersoft-currency-btn:hover {
	background-color: var(--bersoft-bg-subtle) !important;
	border-color: var(--bersoft-brown) !important;
	color: var(--bersoft-brown) !important;
}
.bersoft-currency-btn:focus-visible {
	outline: 2px solid var(--bersoft-brown) !important;
	outline-offset: 2px;
}
.bersoft-currency-globe-icon {
	color: var(--bersoft-muted);
	flex-shrink: 0;
	transition: color 140ms ease;
}
.bersoft-currency-btn:hover .bersoft-currency-globe-icon {
	color: var(--bersoft-brown);
}
.bersoft-currency-caret {
	color: var(--bersoft-muted);
	transition: transform 160ms ease;
	margin-left: 2px;
}
.bersoft-currency-btn[aria-expanded="true"] .bersoft-currency-caret {
	transform: rotate(180deg);
}
.bersoft-currency-popover {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: 230px;
	background: var(--bersoft-surface);
	border: 1px solid var(--bersoft-border);
	border-radius: 16px;
	box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12);
	padding: 12px;
	z-index: 1000;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	transition: all 160ms var(--bersoft-spring);
}
.bersoft-currency-popover.is-open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}
.bersoft-currency-popover-title {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--bersoft-muted);
	margin-bottom: 8px;
	padding: 0 6px;
}
.bersoft-currency-list {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.bersoft-currency-option {
	margin: 0;
	padding: 0;
}
.bersoft-currency-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 10px;
	border-radius: 8px;
	text-decoration: none;
	color: var(--bersoft-dark);
	font-size: 13px;
	font-weight: 500;
	transition: background-color 120ms ease, color 120ms ease;
	min-height: 40px;
}
.bersoft-currency-link:hover {
	background: var(--bersoft-bg-subtle);
	color: var(--bersoft-brown);
}
.bersoft-currency-link:focus-visible {
	outline: 2px solid var(--bersoft-brown);
	outline-offset: 1px;
}
.bersoft-currency-option.is-active .bersoft-currency-link {
	background: #FAF5F0;
	color: var(--bersoft-brown);
	font-weight: 700;
}
.bersoft-currency-opt-name {
	font-weight: 700;
}
.bersoft-currency-opt-desc {
	font-size: 11px;
	color: var(--bersoft-muted);
	margin-left: 6px;
	flex: 1;
}
.bersoft-currency-check {
	color: var(--bersoft-brown);
	font-weight: 800;
	font-size: 13px;
	margin-left: 6px;
}

/* 7. Franja ligera de categorías destacadas (centrada como un conjunto respecto al ancho del header) */
.bersoft-header-wrap .bersoft-header-featured-strip { width: 100%; background: var(--bersoft-surface); display: flex; justify-content: center; padding-top: 4px; padding-bottom: 24px; }
.bersoft-header-wrap .bersoft-featured-strip-list { width: 100%; max-width: 1320px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: clamp(18px, 3vw, 36px); padding: 2px 16px 4px !important; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
.bersoft-header-wrap .bersoft-featured-strip-link { font-size: 14.5px; font-weight: 500; color: var(--bersoft-dark); text-decoration: none; transition: color 140ms ease; letter-spacing: -0.01em; display: inline-block; }
.bersoft-header-wrap .bersoft-featured-strip-link:hover { color: var(--bersoft-brown); }

/* 8. Drawer Móvil: acordeón de subcategorías (+ / −) y contacto estructurado */
.bersoft-mobile-drawer-overlay { position: fixed; inset: 0; z-index: 999999; display: flex; opacity: 0; visibility: hidden; transition: opacity 180ms ease, visibility 180ms; }
.bersoft-mobile-drawer-overlay.is-open { opacity: 1; visibility: visible; }
.bersoft-mobile-drawer-backdrop { position: absolute; inset: 0; background: rgba(28, 27, 26, 0.6); backdrop-filter: blur(4px); }
.bersoft-mobile-drawer-panel { position: relative; z-index: 2; width: 310px; max-width: 84vw; height: 100%; background: var(--bersoft-surface); box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15); display: flex; flex-direction: column; transform: translateX(-100%); transition: transform 200ms var(--bersoft-spring); }
.bersoft-mobile-drawer-overlay.is-open .bersoft-mobile-drawer-panel { transform: translateX(0); }
.bersoft-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--bersoft-border); }
.bersoft-drawer-logo .bersoft-header-logo-img { max-height: 38px; width: auto; }
.bersoft-drawer-title { font-size: 16px; font-weight: 800; letter-spacing: 1px; color: var(--bersoft-dark); }
.bersoft-drawer-close-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--bersoft-dark); cursor: pointer; border-radius: 6px !important; }
.bersoft-drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.bersoft-drawer-section-heading { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--bersoft-muted); margin: 0 0 12px; }

/* Acordeón de subcategorías */
.bersoft-drawer-cat-list { margin: 0; padding: 0; }
.bersoft-drawer-cat-entry { border-bottom: 1px solid rgba(232, 228, 220, 0.5); }
.bersoft-drawer-cat-row { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.bersoft-drawer-cat-item { font-size: 14.5px; font-weight: 600; color: var(--bersoft-dark); text-decoration: none; flex: 1; padding: 10px 0; }
.bersoft-drawer-cat-item:hover { color: var(--bersoft-brown); }
.bersoft-drawer-toggle-btn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 400; color: var(--bersoft-dark); cursor: pointer; border-radius: 6px !important; }
.bersoft-drawer-toggle-btn:hover { background-color: var(--bersoft-bg-subtle) !important; color: var(--bersoft-brown); }
.bersoft-drawer-subcat-list { margin: 0; padding: 2px 0 10px 18px; list-style: none; }
.bersoft-drawer-subcat-item { display: block; padding: 7px 0; font-size: 13.5px; font-weight: 500; color: var(--bersoft-muted); text-decoration: none; transition: color 120ms ease; }
.bersoft-drawer-subcat-item:hover { color: var(--bersoft-brown); }

/* Contacto y redes sociales */
.bersoft-drawer-footer { border-top: 1px solid var(--bersoft-border); margin-top: 24px; padding-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.bersoft-drawer-contact-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--bersoft-dark); text-decoration: none; transition: color 140ms ease; }
.bersoft-drawer-contact-row:hover { color: var(--bersoft-brown); }
.bersoft-contact-phone { white-space: nowrap; }
.bersoft-contact-email { word-break: break-all; font-weight: 500; font-size: 13px; color: var(--bersoft-muted); }
.bersoft-drawer-socials { display: flex; align-items: center; gap: 12px; margin-top: 4px; padding-top: 12px; border-top: 1px dashed var(--bersoft-border); }
.bersoft-drawer-social-link { width: 34px; height: 34px; border-radius: 50%; background: var(--bersoft-bg-subtle); display: inline-flex; align-items: center; justify-content: center; color: var(--bersoft-dark); text-decoration: none; transition: background 140ms ease, color 140ms ease, transform 120ms ease; }
.bersoft-drawer-social-link:hover { background: var(--bersoft-badge-bg); color: var(--bersoft-brown); transform: scale(1.08); }

/* 9. Adaptación a tablet y móvil (< 768px): menú · logo · búsqueda · moneda · cuenta · carrito */
@media (max-width: 768px) {
	.bersoft-header-main-row { min-height: 54px; height: 54px; padding: 4px 8px; gap: 0; display: flex; align-items: center; position: relative; }
	.bersoft-mobile-toggle-btn { display: inline-flex; width: 34px; height: 34px; margin-right: 4px; flex-shrink: 0; }
	.bersoft-header-logo { display: inline-flex; align-items: center; flex-shrink: 0; }
	.bersoft-desktop-logo { display: none !important; }
	.bersoft-mobile-logo { display: block !important; max-height: 30px; width: auto; }
	.bersoft-header-logo-text { font-size: 16px; font-weight: 800; letter-spacing: 0; }
	.bersoft-categories-dropdown-wrap, .bersoft-btn-text-desktop, .bersoft-help-wrap, .bersoft-header-featured-strip { display: none !important; }
	.bersoft-featured-strip-list { padding: 4px 12px 18px; }
	.bersoft-header-search-wrap { display: none; }
	.bersoft-mobile-search-trigger { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; color: var(--bersoft-dark); border-radius: 50% !important; cursor: pointer; flex-shrink: 0; margin-left: auto; margin-right: 4px; }
	.bersoft-header-actions-group { margin-left: 0; display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
	.bersoft-header-icon-btn { padding: 2px 4px !important; min-width: 32px; height: 32px; }
	.bersoft-currency-btn { height: 30px; padding: 2px 8px !important; font-size: 11px; gap: 4px; min-width: auto; }
	.bersoft-currency-globe-icon { width: 13px; height: 13px; }
	.bersoft-currency-caret { width: 9px; height: 9px; }
	.bersoft-acc-caret { display: none; }
	.bersoft-user-initial { width: 28px; height: 28px; font-size: 12px; }
	.bersoft-currency-popover { width: 210px; right: 0; top: calc(100% + 6px); }
	.bersoft-header-wrap.is-search-expanded .bersoft-header-search-wrap { display: flex; align-items: center; gap: 8px; position: absolute; inset: 6px 10px; max-width: none; z-index: 1000; background: var(--bersoft-surface); }
	.bersoft-header-wrap.is-search-expanded .bersoft-header-search-form { flex: 1; min-width: 0; height: 42px; }
	.bersoft-header-wrap.is-search-expanded .bersoft-search-cancel-btn { display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 6px !important; font-size: 13.5px; font-weight: 600; color: var(--bersoft-brown) !important; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
}

@media (max-width: 360px) {
	.bersoft-header-main-row { padding: 4px 4px; }
	.bersoft-mobile-toggle-btn { width: 28px; height: 28px; margin-right: 2px; }
	.bersoft-header-logo-text { font-size: 14px; }
	.bersoft-header-logo-img { max-height: 22px; }
	.bersoft-mobile-search-trigger { width: 28px; height: 28px; margin-right: 2px; }
	.bersoft-header-actions-group { gap: 2px; }
	.bersoft-header-icon-btn { min-width: 28px; height: 28px; padding: 2px !important; }
	.bersoft-currency-btn { padding: 2px 4px !important; font-size: 9.5px; }
	.bersoft-currency-caret { display: none; }
}
