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

.pb-builder,
.pb-modal {
	--pb-bg: #f5f5f3;
	--pb-card: #ffffff;
	--pb-text: #16181d;
	--pb-muted: #6b7280;
	--pb-accent: #e4572e;
	--pb-accent-soft: rgba(228, 87, 46, .10);
	--pb-line: rgba(0, 0, 0, .08);
	--pb-radius: 18px;
	--pb-added: #2e7d32;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--pb-text);
}

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

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

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

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

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

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

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

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

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

.pb-step__count {
	margin-left: auto;
	font-size: 12.5px;
	font-weight: 700;
	color: var(--pb-muted);
	white-space: nowrap;
	background: var(--pb-bg);
	border: 1px solid var(--pb-line);
	border-radius: 999px;
	padding: 5px 12px;
}

.pb-step__count.is-active {
	color: #fff;
	background: var(--pb-accent);
	border-color: var(--pb-accent);
}

/* ============================================================
 * Opciones
 * ============================================================ */
.pb-options {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 10px;
}

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

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

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

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

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

.pb-option__price--free {
	color: var(--pb-muted);
	font-weight: 600;
}

.pb-option input:checked + .pb-option__box {
	border-color: var(--pb-accent);
	background: var(--pb-accent-soft);
	box-shadow: 0 6px 18px rgba(228, 87, 46, .15);
}

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

.pb-option.is-disabled .pb-option__box {
	opacity: 0.45;
	cursor: not-allowed;
}

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

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

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

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

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

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

/* ============================================================
 * Botones (mismo estilo pildora que el carrusel .wb__btn)
 * ============================================================ */
.pb-btn,
.pb-submit.button,
.pb-modal__add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border: none;
	background: var(--pb-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;
}

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

.pb-submit.button,
.pb-modal__add {
	width: 100%;
}

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

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

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

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

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

.pb-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(22, 24, 29, .55);
	backdrop-filter: blur(2px);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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