/**
 * Cabecera — botones ☰ y 🔍, cajón del menú (< 992px) y panel de búsqueda.
 * Marcado: header.php, template-parts/header-drawer.php y header-search-panel.php.
 */

/* ---------- Botones de la cabecera ---------- */

button.bb-shop-header__icon {
	padding: 0;
	border: none;
	background: transparent;
	font: inherit;
	cursor: pointer;
}

.bb-shop-header__icon:focus-visible,
.bb-shop-drawer__row:focus-visible,
.bb-shop-drawer__links a:focus-visible,
.bb-shop-search-panel__chip:focus-visible,
.bb-shop-search-panel__product:focus-visible,
.bb-shop-search-panel__all:focus-visible,
.bb-shop-search-panel__clear:focus-visible {
	outline: 2px solid var(--bb-color-action);
	outline-offset: 2px;
}

/* ☰ y 🔍 solo por debajo de 992px y con JS (sin JS no abren nada). */
.bb-shop-header__toggle {
	display: none;
}

@media (max-width: 991.98px) {
	.bb-shop-has-js .bb-shop-header__toggle {
		display: inline-flex;
	}
}

/* Escritorio: lupa junto a cuenta y bolsa en lugar de la píldora (decisión del 1-dic-2026). Sin JS
   sigue la píldora, que es un formulario normal. */
.bb-shop-header__search-open {
	display: none;
}

@media (min-width: 992px) {
	.bb-shop-has-js .bb-shop-header__search-open {
		display: inline-flex;
	}

	.bb-shop-has-js .bb-shop-search {
		display: none;
	}
}

/* Por debajo de 992px el menú en línea no cabe: lo sustituye el cajón. */
@media (max-width: 991.98px) {
	.bb-shop-header__nav {
		display: none;
	}
}

/* ---------- Capa común de los dos diálogos ---------- */

html.bb-shop-scroll-locked {
	overflow: hidden;
}

html.bb-shop-scroll-locked body {
	overflow: hidden;
	padding-right: var(--bb-shop-scrollbar-gap, 0px);
}

.bb-shop-overlay {
	position: fixed;
	inset: var(--wp-admin--admin-bar--height, 0px) 0 0 0;
	z-index: 1000;
}

.bb-shop-overlay[hidden] {
	display: none;
}

.bb-shop-overlay__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(14, 14, 14, 0.5);
	opacity: 0;
	transition: opacity 0.24s ease;
}

.bb-shop-overlay.is-open .bb-shop-overlay__backdrop {
	opacity: 1;
}

/* ---------- Cajón del menú ---------- */

.bb-shop-drawer__panel {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 100%;
	background: var(--bb-color-bg);
	box-shadow: 8px 0 32px rgba(14, 14, 14, 0.12);
	transform: translateX(-100%);
	transition: transform 0.26s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (min-width: 768px) {
	.bb-shop-drawer__panel {
		width: 400px;
	}
}

.bb-shop-drawer.is-open .bb-shop-drawer__panel {
	transform: translateX(0);
}

.bb-shop-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	min-height: var(--bb-shop-header-height);
	padding: 0 var(--bb-shop-space-1) 0 var(--bb-shop-space-2);
	border-bottom: 1px solid var(--bb-shop-border);
}

.bb-shop-drawer__brand {
	display: inline-flex;
	text-decoration: none;
	color: var(--bb-color-text-primary);
}

.bb-shop-drawer__views {
	position: relative;
	flex: 1;
	min-height: 0;
	overflow: hidden;
}

.bb-shop-drawer__view {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 0 0 var(--bb-shop-space-4);
	background: var(--bb-color-bg);
	transition: transform 0.26s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.bb-shop-drawer__view[hidden] {
	display: none;
}

.bb-shop-drawer__view--root.is-behind {
	transform: translateX(-30%);
}

.bb-shop-drawer__view--sub {
	transform: translateX(100%);
}

.bb-shop-drawer__view--sub.is-active {
	transform: translateX(0);
}

.bb-shop-drawer__list,
.bb-shop-drawer__links {
	margin: 0;
	padding: 0;
	list-style: none;
}

.bb-shop-drawer__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--bb-shop-space-2);
	width: 100%;
	min-height: 56px;
	padding: 0 var(--bb-shop-space-2);
	border: none;
	border-bottom: 1px solid var(--bb-shop-border);
	background: transparent;
	font-family: var(--bb-font-heading);
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-align: left;
	text-decoration: none;
	color: var(--bb-color-text-primary);
	cursor: pointer;
}

.bb-shop-drawer__row:hover,
.bb-shop-drawer__row:active {
	background: var(--bb-color-surface-1);
}

.bb-shop-drawer__row svg {
	flex-shrink: 0;
	color: var(--bb-color-text-secondary);
}

.bb-shop-drawer__list--sub .bb-shop-drawer__row--sub {
	min-height: 52px;
	font-family: var(--bb-font-body);
	font-size: 0.9375rem;
	font-weight: 500;
	letter-spacing: normal;
	text-transform: none;
}


.bb-shop-drawer__back {
	display: flex;
	align-items: center;
	gap: var(--bb-shop-space-1);
	width: 100%;
	min-height: 56px;
	padding: 0 var(--bb-shop-space-2);
	border: none;
	border-bottom: 1px solid var(--bb-shop-border);
	background: var(--bb-color-surface-1);
	font-family: var(--bb-font-heading);
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--bb-color-action);
	cursor: pointer;
}

/* Recibe el foco al abrir el nivel: sin contorno, se marca con el fondo. */
.bb-shop-drawer__back:focus-visible {
	outline: none;
	background: var(--bb-color-surface-2);
}

.bb-shop-drawer__links {
	margin-top: auto;
	padding-top: var(--bb-shop-space-4);
}

.bb-shop-drawer__links a {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-height: 44px;
	padding: 0 var(--bb-shop-space-2);
	font-size: 0.875rem;
	font-weight: 500;
	text-decoration: none;
	color: var(--bb-color-text-primary);
}

.bb-shop-drawer__links a:hover {
	color: var(--bb-color-action);
}

/*
 * Pie del cajón: fila negra con «Volver al club» en píldora roja, como el pie del menú móvil
 * de la web del club (botón «Tienda», `.bb-cta--primary`). Fijo debajo de las vistas.
 */
.bb-shop-drawer__club {
	flex-shrink: 0;
	padding: var(--bb-shop-space-1) var(--bb-shop-space-2) max(var(--bb-shop-space-2), env(safe-area-inset-bottom, 0px));
	background: var(--bb-color-text-primary);
}

.bb-shop-drawer__social {
	display: flex;
	justify-content: center;
	gap: var(--bb-shop-space-1);
	margin: 0 0 var(--bb-shop-space-1);
	padding: 0;
	list-style: none;
}

.bb-shop-drawer__social-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 9999px;
	color: rgba(255, 255, 255, 0.82);
	transition: color 0.15s ease, background-color 0.15s ease;
}

.bb-shop-drawer__social-link:hover {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.1);
}

.bb-shop-drawer__social-link:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

.bb-shop-drawer__social-icon {
	width: 22px;
	height: 22px;
}

.bb-shop-drawer__club-link {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--bb-shop-space-1);
	min-height: 48px;
	padding: 0 var(--bb-shop-space-3);
	border-radius: 9999px;
	background: var(--bb-color-action);
	font-family: var(--bb-font-heading);
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
	color: #ffffff;
	transition: background-color 0.2s ease;
}

.bb-shop-drawer__club-link:hover {
	background: var(--bb-color-action-hover);
}

.bb-shop-drawer__club-link:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

.bb-shop-drawer__count {
	margin-left: auto;
	font-size: 0.75rem;
	color: var(--bb-color-text-secondary);
}

/* ---------- Panel de búsqueda ---------- */

.bb-shop-search-panel__sheet {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	background: var(--bb-color-bg);
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.bb-shop-search-panel.is-open .bb-shop-search-panel__sheet {
	opacity: 1;
	transform: translateY(0);
}

.bb-shop-search-panel__form {
	display: flex;
	align-items: center;
	gap: var(--bb-shop-space-1);
	flex-shrink: 0;
	min-height: var(--bb-shop-header-height);
	padding: var(--bb-shop-space-1) var(--bb-shop-gutter);
	border-bottom: 1px solid var(--bb-shop-border);
}

.bb-shop-search-panel__back {
	flex-shrink: 0;
	margin-left: -8px;
}

.bb-shop-search-panel__close {
	display: none;
	flex-shrink: 0;
}

.bb-shop-search-panel__field {
	display: flex;
	align-items: center;
	gap: var(--bb-shop-space-1);
	flex: 1;
	min-width: 0;
	min-height: 44px;
	padding: 0 var(--bb-shop-space-1) 0 var(--bb-shop-space-2);
	border: 1px solid var(--bb-shop-border-strong);
	border-radius: 9999px;
	background: var(--bb-color-surface-1);
}

.bb-shop-search-panel__field:focus-within {
	border-color: var(--bb-color-text-primary);
	background: var(--bb-color-bg);
}

.bb-shop-search-panel__field > svg {
	flex-shrink: 0;
	color: var(--bb-color-text-secondary);
}

.bb-shop-search-panel__input {
	flex: 1;
	min-width: 0;
	height: 42px;
	padding: 0;
	border: none;
	background: transparent;
	/* 16px: menos y Safari de iOS hace zoom al enfocar. */
	font-family: var(--bb-font-body);
	font-size: 1rem;
	color: var(--bb-color-text-primary);
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.bb-shop-search-panel__input::-webkit-search-cancel-button {
	display: none;
}

.bb-shop-search-panel__input::placeholder {
	color: var(--bb-color-text-muted);
}

.bb-shop-search-panel__clear {
	flex-shrink: 0;
	padding: 0.375rem 0.625rem;
	border: none;
	border-radius: 9999px;
	background: transparent;
	font-family: var(--bb-font-body);
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--bb-color-text-secondary);
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.bb-shop-search-panel__clear[hidden] {
	display: none;
}

.bb-shop-search-panel__body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: var(--bb-shop-space-3) var(--bb-shop-gutter) var(--bb-shop-space-5);
}

.bb-shop-search-panel.is-loading .bb-shop-search-panel__results {
	opacity: 0.55;
	transition: opacity 0.15s ease;
}

.bb-shop-search-panel__section + .bb-shop-search-panel__section {
	margin-top: var(--bb-shop-space-4);
}

.bb-shop-search-panel__section[hidden],
.bb-shop-search-panel__idle[hidden],
.bb-shop-search-panel__results[hidden] {
	display: none;
}

.bb-shop-search-panel__title {
	margin: 0 0 var(--bb-shop-space-2);
	font-family: var(--bb-font-heading);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--bb-color-text-primary);
}

.bb-shop-search-panel__chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--bb-shop-space-1);
	margin: 0;
	padding: 0;
	list-style: none;
}

.bb-shop-search-panel__chip {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding: 0 var(--bb-shop-space-2);
	border: 1px solid var(--bb-shop-border-strong);
	border-radius: 9999px;
	font-size: 0.8125rem;
	font-weight: 500;
	text-decoration: none;
	color: var(--bb-color-text-primary);
	transition: border-color 0.15s ease, background 0.15s ease;
}

.bb-shop-search-panel__chip:hover {
	border-color: var(--bb-color-text-primary);
	background: var(--bb-color-surface-1);
}

/* Productos: filas con miniatura en móvil, rejilla de tarjetas desde tablet. */
.bb-shop-search-panel__products {
	display: grid;
	gap: var(--bb-shop-space-1);
	margin: 0;
	padding: 0;
	list-style: none;
}

.bb-shop-search-panel__product {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.25rem;
	border-radius: var(--bb-shop-radius-card);
	text-decoration: none;
	color: var(--bb-color-text-primary);
}

.bb-shop-search-panel__product:hover {
	background: var(--bb-color-surface-1);
}

.bb-shop-search-panel__thumb {
	flex-shrink: 0;
	width: 64px;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: var(--bb-shop-radius-card);
	background: var(--bb-color-surface-2);
}

.bb-shop-search-panel__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.bb-shop-search-panel__meta {
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
	min-width: 0;
}

.bb-shop-search-panel__name {
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.35;
}

.bb-shop-search-panel__name mark {
	padding: 0;
	background: transparent;
	color: inherit;
	font-weight: 700;
	text-decoration: underline;
	text-decoration-color: var(--bb-color-action);
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

.bb-shop-search-panel__chip mark {
	background: transparent;
	color: inherit;
	font-weight: 700;
}

.bb-shop-search-panel__price {
	font-size: 0.8125rem;
	color: var(--bb-color-text-secondary);
}

.bb-shop-search-panel__price del {
	margin-right: 0.25rem;
	color: var(--bb-color-text-muted);
}

.bb-shop-search-panel__price ins {
	text-decoration: none;
	font-weight: 600;
	color: var(--bb-color-action);
}

.bb-shop-search-panel__empty {
	margin: 0;
	font-size: 0.875rem;
	color: var(--bb-color-text-secondary);
}

/* Móvil: botón a todo el ancho; desde 768px vuelve a ajustarse al texto. */
.bb-shop-search-panel__all {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	margin-top: var(--bb-shop-space-3);
	padding: 0 var(--bb-shop-space-3);
	border-radius: 9999px;
	background: var(--bb-color-text-primary);
	font-family: var(--bb-font-heading);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	text-decoration: none;
	color: #fff;
}

.bb-shop-search-panel__all:hover {
	background: var(--bb-color-action);
}

.bb-shop-search-panel__all[hidden] {
	display: none;
}

@media (min-width: 768px) {
	.bb-shop-search-panel__all {
		display: inline-flex;
		width: auto;
	}

	.bb-shop-search-panel__products {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: var(--bb-shop-space-3) var(--bb-shop-space-2);
	}

	.bb-shop-search-panel__product {
		flex-direction: column;
		align-items: stretch;
		gap: var(--bb-shop-space-1);
		padding: 0;
	}

	.bb-shop-search-panel__product:hover {
		background: transparent;
	}

	.bb-shop-search-panel__product:hover .bb-shop-search-panel__name {
		text-decoration: underline;
		text-underline-offset: 3px;
	}

	.bb-shop-search-panel__thumb {
		width: 100%;
	}
}

/* Escritorio: panel desde arriba con el fondo oscurecido; ✕ en lugar de ←. */
@media (min-width: 992px) {
	.bb-shop-search-panel__sheet {
		bottom: auto;
		max-height: min(86vh, 760px);
		box-shadow: 0 16px 40px rgba(14, 14, 14, 0.14);
		transform: translateY(-16px);
	}

	.bb-shop-search-panel__form,
	.bb-shop-search-panel__body {
		width: 100%;
		max-width: 1120px;
		margin-inline: auto;
	}

	.bb-shop-search-panel__form {
		min-height: 76px;
		border-bottom: none;
	}

	.bb-shop-search-panel__back {
		display: none;
	}

	.bb-shop-search-panel__close {
		display: inline-flex;
	}

	.bb-shop-search-panel__body {
		padding-top: var(--bb-shop-space-1);
	}

	.bb-shop-search-panel__idle {
		display: grid;
		grid-template-columns: minmax(200px, 1fr) minmax(0, 3fr);
		gap: var(--bb-shop-space-5);
	}

	.bb-shop-search-panel__idle .bb-shop-search-panel__section + .bb-shop-search-panel__section {
		margin-top: 0;
	}

	.bb-shop-search-panel__section--popular .bb-shop-search-panel__chips {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.25rem;
	}

	.bb-shop-search-panel__section--popular .bb-shop-search-panel__chip {
		min-height: 32px;
		padding: 0;
		border: none;
		font-size: 0.9375rem;
	}

	.bb-shop-search-panel__section--popular .bb-shop-search-panel__chip:hover {
		background: transparent;
		color: var(--bb-color-action);
	}

	.bb-shop-search-panel__products {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.bb-shop-search-panel__results .bb-shop-search-panel__products {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}
}

@media (prefers-reduced-motion: reduce) {
	.bb-shop-overlay__backdrop,
	.bb-shop-drawer__panel,
	.bb-shop-drawer__view,
	.bb-shop-search-panel__sheet {
		transition: none;
	}
}
