/* ============================================================
 * Bocadillo Builder
 * Mismo lenguaje visual que el Carrusel de Marcas (.wb):
 * acento calido, fondo claro, tarjetas blancas, radios grandes,
 * botones tipo pildora y la fuente del sistema.
 * ============================================================ */

.bb-builder,
.bb-modal {
	--bb-bg: #f5f3ef;
	--bb-card: #ffffff;
	--bb-text: #1c1a17;
	--bb-muted: #6b6560;
	--bb-accent: #c0472b;
	--bb-accent-soft: rgba(192, 71, 43, .10);
	--bb-line: rgba(0, 0, 0, .08);
	--bb-radius: 18px;
	--bb-added: #2e7d32;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--bb-text);
}

.bb-builder *,
.bb-modal * {
	box-sizing: border-box;
}

.bb-builder {
	margin-top: 8px;
}

/* ============================================================
 * Pasos
 * ============================================================ */
.bb-step {
	border: 1px solid var(--bb-line);
	border-radius: var(--bb-radius);
	padding: 18px;
	margin-bottom: 16px;
	background: var(--bb-card);
	box-shadow: 0 6px 24px rgba(0, 0, 0, .06);
}

.bb-step--error,
.bb-step.has-error {
	border-color: var(--bb-accent);
	box-shadow: 0 0 0 3px var(--bb-accent-soft);
}

.bb-step__head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px;
}

.bb-step__num {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--bb-accent);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 15px;
}

.bb-step__titles {
	flex: 1 1 auto;
}

.bb-step__title {
	margin: 0;
	font-size: 17px;
	font-weight: 800;
	letter-spacing: -.01em;
	line-height: 1.3;
}

.bb-step__sub {
	margin: 2px 0 0;
	font-size: 13px;
	color: var(--bb-muted);
}

/* ============================================================
 * Opciones (bocadillo base = radios)
 * ============================================================ */
.bb-options {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 10px;
}

.bb-option {
	cursor: pointer;
	margin: 0;
}

.bb-option input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.bb-option__box {
	display: flex;
	flex-direction: column;
	gap: 4px;
	border: 1.5px solid var(--bb-line);
	border-radius: 14px;
	padding: 12px 14px;
	background: var(--bb-bg);
	transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
	height: 100%;
}

.bb-option__name {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
}

.bb-option__price {
	font-size: 12.5px;
	font-weight: 700;
	color: var(--bb-accent);
}

.bb-option input:checked + .bb-option__box {
	border-color: var(--bb-accent);
	background: var(--bb-accent-soft);
	box-shadow: 0 6px 18px rgba(192, 71, 43, .15);
}

.bb-option input:focus-visible + .bb-option__box {
	outline: 2px solid var(--bb-accent);
	outline-offset: 2px;
}

/* ============================================================
 * Extras (fila con nombre, precio y stepper de cantidad)
 * ============================================================ */
.bb-extras {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.bb-extra {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	border: 1.5px solid var(--bb-line);
	border-radius: 14px;
	padding: 12px 14px;
	background: var(--bb-bg);
	transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.bb-extra.is-active {
	border-color: var(--bb-accent);
	background: var(--bb-accent-soft);
	box-shadow: 0 6px 18px rgba(192, 71, 43, .12);
}

.bb-extra__info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.bb-extra__name {
	font-size: 14.5px;
	font-weight: 700;
	line-height: 1.3;
}

.bb-extra__price {
	font-size: 12.5px;
	font-weight: 700;
	color: var(--bb-accent);
}

.bb-extra__tag {
	align-self: flex-start;
	margin-top: 2px;
	font-size: 11px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: .03em;
	color: #fff;
	background: var(--bb-accent);
	border-radius: 999px;
	padding: 2px 8px;
}

/* Stepper de cantidad */
.bb-qty {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: var(--bb-card);
	border: 1px solid var(--bb-line);
	border-radius: 999px;
	padding: 3px;
}

.bb-qty__btn {
	width: 32px;
	height: 32px;
	border: none;
	border-radius: 50%;
	background: var(--bb-bg);
	color: var(--bb-text);
	font-size: 18px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background .18s ease, color .18s ease, opacity .18s ease;
}

.bb-qty__btn:hover:not(:disabled) {
	background: var(--bb-accent);
	color: #fff;
}

.bb-qty__btn:disabled {
	opacity: .35;
	cursor: not-allowed;
}

.bb-qty__val {
	width: 30px;
	text-align: center;
	border: none;
	background: transparent;
	font-size: 15px;
	font-weight: 800;
	color: var(--bb-text);
	-moz-appearance: textfield;
	appearance: textfield;
	pointer-events: none;
}

.bb-qty__val::-webkit-outer-spin-button,
.bb-qty__val::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* ============================================================
 * Resumen / total (ficha de producto)
 * ============================================================ */
.bb-summary {
	position: sticky;
	bottom: 0;
	border: 1px solid var(--bb-line);
	border-radius: var(--bb-radius);
	padding: 16px 18px;
	background: var(--bb-card);
	box-shadow: 0 -4px 18px rgba(0, 0, 0, .06);
}

.bb-summary__total {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 15px;
	font-weight: 700;
	margin-bottom: 12px;
}

.bb-summary__price {
	font-size: 24px;
	font-weight: 800;
	color: var(--bb-accent);
}

.bb-summary__errors {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 12px;
}

.bb-summary__errors span {
	font-size: 13px;
	color: var(--bb-accent);
	background: var(--bb-accent-soft);
	border-radius: 8px;
	padding: 6px 10px;
}

.bb-summary__errors:empty {
	display: none;
}

/* ============================================================
 * Botones (mismo estilo pildora que el carrusel .wb__btn)
 * ============================================================ */
.bb-submit.button,
.bb-modal__add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border: none;
	background: var(--bb-accent);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	padding: 13px 20px;
	border-radius: 999px;
	cursor: pointer;
	text-decoration: none;
	transition: opacity .18s ease, background .18s ease;
	width: 100%;
}

.bb-submit.button:hover,
.bb-modal__add:hover:not(:disabled) {
	opacity: .9;
	color: #fff;
}

.bb-modal__add:disabled {
	background: #c9c9c4;
	cursor: not-allowed;
	opacity: 1;
}

.bb-modal__add.is-loading {
	opacity: .7;
	pointer-events: none;
}

.bb-modal__add.is-done {
	background: var(--bb-added);
}

/* ============================================================
 * Modal del carrusel
 * ============================================================ */
.bb-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
}

.bb-modal.is-open {
	display: block;
}

.bb-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(28, 26, 23, .55);
	backdrop-filter: blur(2px);
}

.bb-modal__dialog {
	position: relative;
	z-index: 1;
	width: min(640px, calc(100% - 24px));
	max-height: calc(100vh - 48px);
	margin: 24px auto;
	background: var(--bb-bg);
	border-radius: var(--bb-radius);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 24px 60px rgba(28, 26, 23, .35);
	animation: bb-pop .18s ease;
}

@keyframes bb-pop {
	from { transform: translateY(12px); opacity: 0; }
	to { transform: translateY(0); opacity: 1; }
}

.bb-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	background: var(--bb-card);
	border-bottom: 1px solid var(--bb-line);
}

.bb-modal__title {
	margin: 0;
	font-size: 20px;
	font-weight: 800;
	letter-spacing: -.01em;
	line-height: 1.2;
}

.bb-modal__close {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--bb-bg);
	border: 1px solid var(--bb-line);
	color: var(--bb-text);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: background .18s ease;
}

.bb-modal__close:hover {
	background: #ececea;
}

.bb-modal__body {
	padding: 18px 20px;
	overflow-y: auto;
	flex: 1 1 auto;
	background: var(--bb-bg);
}

.bb-modal__body .bb-step {
	margin-bottom: 14px;
}

.bb-modal__body .bb-step:last-child {
	margin-bottom: 0;
}

.bb-modal__foot {
	padding: 14px 20px 18px;
	background: var(--bb-card);
	border-top: 1px solid var(--bb-line);
}

.bb-modal__errors {
	font-size: 13px;
	color: var(--bb-accent);
	background: var(--bb-accent-soft);
	border-radius: 8px;
	padding: 8px 10px;
	margin-bottom: 10px;
}

.bb-modal__errors:empty {
	display: none;
}

.bb-modal__totalRow {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.bb-modal__totalLabel {
	font-size: 15px;
	font-weight: 700;
}

.bb-modal__total {
	font-size: 26px;
	font-weight: 800;
	color: var(--bb-accent);
}

/* Boton "Personalizar" en las tarjetas del carrusel */
.wb__btn.bb-open {
	cursor: pointer;
}

body.bb-modal-open {
	overflow: hidden;
}

@media (max-width: 480px) {
	.bb-options {
		grid-template-columns: 1fr;
	}

	.bb-modal__dialog {
		margin: 0;
		width: 100%;
		max-height: 100vh;
		height: 100%;
		border-radius: 0;
	}
}
