/**
 * Site header (child theme override)
 *
 * Sustituye el header flotante del tema padre (tarjeta blanca inclinada,
 * position:fixed pero fondo transparente) por una cabecera fija clásica de
 * dos filas: pre-header (mensaje + teléfono) + header (logo, menú, acciones).
 *
 * Se reutiliza a propósito el selector "header.ccb-header" para heredar del
 * tema padre: z-index, el offset cuando hay admin bar
 * (.logged-in header.ccb-header { top }) y el icono del botón #menu-toggle.
 *
 * Posición: "sticky" en vez de "fixed". Así el header ocupa su sitio normal
 * en el flujo (no tapa el hero de la home) y solo se queda fijo arriba
 * cuando el scroll llega a su altura — sin salto visual y sin JS.
 */

header.ccb-header.ccb-child-header {
	position: sticky;
	top: 0;
	left: auto;
	width: auto;
	height: auto;
	padding: 0;
	background: transparent;
	display: block;
}

/* El JS del padre (js/scripts.js) sigue añadiendo/quitando .scrolled a los
   300px de scroll; lo aprovechamos solo para una sombra sutil una vez que
   el header queda "pegado" arriba — ya no hace falta el degradado del
   diseño flotante original. */
header.ccb-header.ccb-child-header.scrolled {
	box-shadow: 0 4px 14px rgba(20, 27, 77, 0.15);
}

/* ---------- Pre-header ---------- */

.ccb-child-preheader {
	background: #141B4D;
}

.ccb-child-preheader__inner {
	max-width: 1600px;
	margin-inline: auto;
	padding: 8px 3%;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 24px;
}

@media screen and (max-width: 767px) {
	.ccb-child-preheader {
		display: none;
	}
}

.ccb-child-preheader__message {
	margin: 0;
	font-family: "futura-pt", sans-serif;
	font-size: 0.85rem;
	line-height: 1.3;
	color: rgba(255, 255, 255, 0.85);
}

.ccb-child-preheader__phone {
	margin: 0;
	flex: none;
	font-family: "futura-pt", sans-serif;
	font-weight: 700;
	font-size: 0.9rem;
	color: #FFFFFF;
	white-space: nowrap;
}

/* ---------- Main header ---------- */

.ccb-child-masthead {
	background: #FFFFFF;
	box-shadow: 0 2px 10px rgba(20, 27, 77, 0.08);
}

.ccb-child-masthead__inner {
	max-width: 1600px;
	margin-inline: auto;
	padding: 10px 3%;
	display: flex;
	align-items: center;
	gap: 24px;
}

.ccb-child-masthead__branding {
	flex: none;
}

.ccb-child-masthead__logo-link {
	display: block;
}

.ccb-child-masthead__branding img,
.ccb-child-masthead__logo-fallback {
	display: block;
	height: 46px;
	width: auto;
}

@media screen and (min-width: 992px) {
	.ccb-child-masthead__branding img,
	.ccb-child-masthead__logo-fallback {
		height: 58px;
	}
}

/* ---------- Nav menu ---------- */

.ccb-child-masthead__nav {
	display: none;
	flex: 1 1 auto;
	min-width: 0;
}

@media screen and (min-width: 1300px) {
	.ccb-child-masthead__nav {
		display: block;
	}
}

.ccb-child-masthead__nav ul {
	margin-left: auto;
	margin-right: auto;
	padding: 0;
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 4px;
}

.ccb-child-masthead__nav li.menu-item {
	position: relative;
}

.ccb-child-masthead__nav li.menu-item > a:not(.ccb-child-submenu-card) {
	display: block;
	padding: 10px 14px;
	font-family: "futura-pt", sans-serif;
	font-weight: 600;
	font-size: 0.95rem;
	color: #141B4D;
	text-decoration: none;
	white-space: nowrap;
}

.ccb-child-masthead__nav li.menu-item > a:hover,
.ccb-child-masthead__nav li.menu-item.current-menu-item > a,
.ccb-child-masthead__nav li.menu-item.current_page_item > a {
	color: #62B5E5;
}

.ccb-child-masthead__nav li.menu-item-has-children > a::after {
	content: "";
	display: inline-block;
	margin-left: 5px;
	width: 6px;
	height: 6px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
}

.ccb-child-masthead__nav ul.sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 220px;
	background: #FFFFFF;
	box-shadow: 0 10px 24px rgba(20, 27, 77, 0.14);
	border-radius: 8px;
	padding: 8px;
	flex-direction: column;
	align-items: stretch;
	gap: 0;
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity 0.15s ease-out, transform 0.15s ease-out, visibility 0.15s;
	z-index: 10;
}

.ccb-child-masthead__nav li.menu-item:hover > ul.sub-menu,
.ccb-child-masthead__nav li.menu-item:focus-within > ul.sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.ccb-child-masthead__nav ul.sub-menu li.menu-item > a:not(.ccb-child-submenu-card) {
	padding: 8px 10px;
	border-radius: 6px;
}

.ccb-child-masthead__nav ul.sub-menu li.menu-item > a:not(.ccb-child-submenu-card):hover {
	background: rgba(98, 181, 229, 0.12);
}

/* ---------- Submenú "card" enriquecido (p. ej. "Reviews") ----------
 * Se activa automáticamente cuando un item de submenú tiene el campo
 * "Description" relleno en Apariencia → Menús, vía CCB_Child_Nav_Walker
 * (functions.php). El resto de submenús (sin Description, p. ej. "Do It
 * Yourself", "Pro Customers") siguen usando el estilo simple de arriba,
 * sin cambios. Formato del campo Description: "Texto | Source: Proveedor".
 */

.ccb-child-masthead__nav ul.sub-menu:has(.ccb-child-submenu-card) {
	min-width: 380px;
	padding: 10px;
	gap: 4px;
}

.ccb-child-submenu-card {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 16px;
	border-radius: 12px;
	text-decoration: none;
}

.ccb-child-masthead__nav ul.sub-menu li.menu-item:first-child .ccb-child-submenu-card {
	background: #F1F0EF;
}

.ccb-child-submenu-card:hover {
	background: rgba(98, 181, 229, 0.14);
}

.ccb-child-masthead__nav ul.sub-menu li.menu-item:first-child .ccb-child-submenu-card:hover {
	background: #E6E4E2;
}

.ccb-child-submenu-card__title {
	font-family: "futura-pt", sans-serif;
	font-weight: 700;
	font-size: 1.05rem;
	color: #141B4D;
}

.ccb-child-submenu-card__desc {
	font-family: "futura-pt", sans-serif;
	font-size: 0.85rem;
	line-height: 1.4;
	color: #63666A;
}

.ccb-child-submenu-card__source {
	font-family: "futura-pt", sans-serif;
	font-size: 0.78rem;
	font-weight: 600;
	color: #62B5E5;
}

/* ---------- Actions (login / cart / toggle) ---------- */

.ccb-child-masthead__actions {
	flex: none;
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 10px;
}

.ccb-child-masthead__login {
	display: none;
	font-family: "futura-pt", sans-serif;
	font-weight: 600;
	font-size: 0.9rem;
	color: #141B4D;
	text-decoration: none;
	padding: 10px 20px;
	border: 1px solid #CDCBCA;
	border-radius: 999px;
	white-space: nowrap;
}

.ccb-child-masthead__login:hover {
	border-color: #141B4D;
}

@media screen and (min-width: 1300px) {
	.ccb-child-masthead__login {
		display: inline-block;
	}
}

.ccb-child-masthead__cart {
	display: none;
	position: relative;
	font-family: "futura-pt", sans-serif;
	font-weight: 600;
	font-size: 0.9rem;
	color: #141B4D;
	text-decoration: none;
	white-space: nowrap;
}

@media screen and (min-width: 1300px) {
	.ccb-child-masthead__cart {
		display: inline-flex;
		align-items: center;
	}
}

.ccb-child-masthead__cart .ccb-cart-count {
	position: relative;
	top: -1px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: 4px;
	background: #CB333B;
	color: #FFFFFF;
	width: 1.25rem;
	height: 1.25rem;
	border-radius: 50%;
	font-size: 0.7rem;
	font-weight: 600;
	font-style: normal;
	line-height: 1;
}

/* En móvil el link de escritorio se oculta y se ofrece dentro del
   menú móvil (ver .ccb-child-mobile-actions). */

.ccb-child-masthead__toggle {
	/* El icono/posicionamiento ya los pone header.ccb-header #menu-toggle
	   del tema padre; aquí solo ajustamos el margen. */
	margin: 0;
}

/* ---------- Menú móvil hasta 1299 px ----------
   El menú de escritorio (nav + "Pro Log In" + carrito) solo cabe con holgura desde 1300 px. Por debajo se usa el
   menú móvil (botón + panel deslizante). El tema padre oculta el botón y el panel desde 992 px, así que se
   vuelven a mostrar entre 992 y 1299 px; por debajo de 992 px siguen mostrándose por el CSS del padre. */

@media screen and (min-width: 992px) and (max-width: 1299px) {
	header.ccb-header #menu-toggle {
		display: block;
	}

	/* Entre 992 y 1299 px el panel es un cajón a la derecha (420 px), no una hoja a todo el ancho: con líneas de
	   1000 px de largo se veía descolocado. Entra por la derecha en lugar de por la izquierda del padre. */
	#mobile-navigation.ccb-mobile-nav {
		display: block;
		left: auto;
		right: -460px;
		width: 420px;
		max-width: 100vw;
		box-shadow: -8px 0 24px rgba(20, 27, 77, 0.18);
	}

	#mobile-navigation.ccb-mobile-nav.active {
		left: auto;
		right: 0;
	}
}

/* ---------- Mobile slide-out: cabecera del panel ---------- */

/* El tema padre (style.css) reserva "padding-top: 70px" en .ccb-mobile-nav
   asumiendo que su propio header (position: fixed) queda siempre visible
   por encima. El header del child es "sticky" (site-header.css arriba), así
   que al abrir el menú con scroll puede no estar visible — el panel ya
   lleva su propia cabecera pegajosa (ver abajo), no hace falta ese hueco. */
#mobile-navigation.ccb-mobile-nav {
	padding-top: 0;
	/* El padre fuerza "overflow-y: scroll", que dibuja siempre un ascensor dentro del panel (junto al del
	   navegador). Se sigue pudiendo desplazar, pero sin barra visible. */
	overflow-y: auto;
	scrollbar-width: none;
	/* El header del tema padre lleva z-index: 999 (header.ccb-header),
	   heredado a propósito por header.ccb-child-header (ver comentario al
	   inicio de este fichero). El panel del padre solo tenía z-index: 90,
	   así que el header sticky quedaba por encima y tapaba cualquier
	   contenido pegado arriba del panel — no se notaba porque antes no
	   había nada interactivo ahí; con la cabecera propia del panel
	   (.ccb-child-mobile-nav__header) sí hace falta que gane. */
	z-index: 1000;
}

#mobile-navigation.ccb-mobile-nav::-webkit-scrollbar {
	display: none;
}

.ccb-child-mobile-nav__header {
	position: sticky;
	top: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	background: #141B4D;
}

/* Con la admin bar de WordPress visible (editores conectados), el panel arranca justo debajo de ella (32 px, o 46 px
   en el breakpoint de la admin bar) y su cabecera pegajosa va a top: 0 dentro del panel. Antes la cabecera llevaba
   top: 32px dentro de un panel que ya empezaba arriba del todo: ocupaba su hueco en el flujo pero se pintaba 32 px
   más abajo y tapaba el primer enlace de la lista. */
.admin-bar #mobile-navigation.ccb-mobile-nav {
	top: 32px;
	height: calc(100vh - 92px);
}

@media screen and (max-width: 782px) {
	.admin-bar #mobile-navigation.ccb-mobile-nav {
		top: 46px;
		height: calc(100vh - 106px);
	}
}

.ccb-child-mobile-nav__brand {
	font-family: "futura-pt", sans-serif;
	font-weight: 700;
	font-size: 0.95rem;
	color: #FFFFFF;
}

.ccb-child-mobile-nav__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	background: none;
	border: none;
	font-size: 1.5rem;
	line-height: 1;
	color: #FFFFFF;
	cursor: pointer;
}

/* ---------- Mobile slide-out extras (login/cart) ---------- */

.ccb-child-mobile-actions {
	display: flex;
	gap: 1.5rem;
	padding: 1rem 1.25rem 0;
}

.ccb-child-mobile-actions a {
	font-family: "futura-pt", sans-serif;
	font-weight: 600;
	font-size: 1rem;
	color: #141B4D;
	text-decoration: none;
}

/* ---------- Mobile slide-out: lista de navegación ----------
 * Sobreescribe el estilo de enlace del tema padre (rojo, cursiva, grande)
 * con el diseño de Figma: filas navy con separador punteado azul, fila
 * activa con fondo gris y símbolo +/-, hijos indentados en gris.
 * Selector con doble ID (#mobile-navigation #ccb-mobile-menu) a propósito,
 * para ganar en especificidad a ".ccb-mobile-nav ul li a" del padre sin
 * necesidad de !important.
 */

#mobile-navigation #ccb-mobile-menu {
	margin: 0;
	padding: 8px 0;
	list-style: none;
	border-top: 1px dashed #62B5E5;
}

#mobile-navigation #ccb-mobile-menu li.menu-item {
	margin: 0;
	border-bottom: 1px dashed #62B5E5;
}

#mobile-navigation #ccb-mobile-menu li.menu-item > a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 15px 20px;
	font-family: "futura-pt", sans-serif;
	font-weight: 400;
	font-style: normal;
	font-size: 1rem;
	color: #141B4D;
	text-decoration: none;
}

/* Símbolo +/- de los items con hijos (Reviews, Do It Yourself, Pro
   Customers...). El JS (mobile-menu.js) solo alterna la clase
   .ccb-child-submenu-open en el <li>; el símbolo y el fondo los pone CSS. */
#mobile-navigation #ccb-mobile-menu li.menu-item-has-children > a::after {
	content: "+";
	flex: none;
	font-size: 1.2rem;
	line-height: 1;
	color: #141B4D;
}

#mobile-navigation #ccb-mobile-menu li.menu-item-has-children.ccb-child-submenu-open > a {
	background: #F1F0EF;
}

#mobile-navigation #ccb-mobile-menu li.menu-item-has-children.ccb-child-submenu-open > a::after {
	content: "\2212"; /* – */
}

#mobile-navigation #ccb-mobile-menu ul.sub-menu {
	margin: 0;
	padding: 0;
	list-style: none;
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.25s ease;
}

#mobile-navigation #ccb-mobile-menu ul.sub-menu li.menu-item > a {
	padding: 15px 20px 15px 36px;
	color: #404040;
}
