/* Box Builder for WooCommerce — frontend styles. */

.cbb-builder {
	margin: 1.5em 0;
	padding: 1.25em;
	border: 1px solid rgba( 0, 0, 0, 0.12 );
	border-radius: 10px;
}

.cbb-builder.cbb-locked .cbb-palette,
.cbb-builder.cbb-locked .cbb-box {
	opacity: 0.45;
	pointer-events: none;
}

.cbb-header {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.5em;
	margin-bottom: 1em;
}

.cbb-title {
	margin: 0;
	font-size: 1.15em;
}

.cbb-counter {
	font-size: 0.9em;
	font-weight: 600;
	padding: 0.25em 0.75em;
	border-radius: 999px;
	background: rgba( 0, 0, 0, 0.06 );
}

.cbb-counter.cbb-done {
	background: #d4edda;
	color: #155724;
}

/* The box itself: a grid of wells. Columns are set inline by JS (≈ square). */
.cbb-box {
	display: grid;
	gap: 0.5em;
	max-width: 420px;
	margin: 0 auto 1.25em;
	padding: 0.75em;
	border: 2px solid rgba( 0, 0, 0, 0.15 );
	border-radius: 12px;
	background: rgba( 0, 0, 0, 0.02 );
}

.cbb-box:empty {
	display: none;
}

.cbb-well {
	position: relative;
	aspect-ratio: 1 / 1;
	border-radius: 8px;
	padding: 0;
	overflow: hidden;
}

.cbb-well.cbb-empty {
	border: 2px dashed rgba( 0, 0, 0, 0.25 );
	background: transparent;
}

.cbb-well.cbb-filled {
	border: none;
	background: transparent;
	cursor: pointer;
}

.cbb-well.cbb-filled img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 8px;
}

.cbb-well-x {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 1.4em;
	height: 1.4em;
	line-height: 1.4em;
	text-align: center;
	font-size: 0.85em;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.6 );
	color: #fff;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.cbb-well.cbb-filled:hover .cbb-well-x,
.cbb-well.cbb-filled:focus .cbb-well-x {
	opacity: 1;
}

/* The palette of available items. */
.cbb-palette {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 150px, 1fr ) );
	gap: 1em;
}

.cbb-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 0.5em;
	margin: 0;
	padding: 0.75em;
	border: 2px solid transparent;
	border-radius: 10px;
	background: rgba( 0, 0, 0, 0.03 );
	transition: border-color 0.15s ease;
}

.cbb-item.cbb-selected {
	border-color: currentColor;
}

.cbb-thumb {
	position: relative;
	width: 100%;
}

.cbb-thumb img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
}

.cbb-badge {
	position: absolute;
	top: -0.5em;
	right: -0.5em;
	min-width: 1.9em;
	padding: 0.25em 0.4em;
	border-radius: 999px;
	background: #222;
	color: #fff;
	font-size: 0.8em;
	font-weight: 700;
	line-height: 1.4;
}

.cbb-name {
	font-weight: 600;
	line-height: 1.3;
}

.cbb-desc {
	font-size: 0.8em;
	opacity: 0.75;
	line-height: 1.35;
}

.cbb-add {
	margin-top: auto;
	padding: 0.45em 1.1em;
	font-size: 0.85em;
	font-weight: 600;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	cursor: pointer;
	transition: background 0.15s ease;
}

.cbb-add:hover:not( :disabled ) {
	background: rgba( 0, 0, 0, 0.06 );
}

.cbb-add:disabled {
	opacity: 0.4;
	cursor: default;
}
