/**
 * Image Choice field — frontend styles.
 *
 * Visual tile grid where users pick between images.
 * Each tile = image (or placeholder) + optional label + check overlay on select.
 */

/* ==========================================================================
   Grid
   ========================================================================== */

.bf-image-choice {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat( 3, 1fr );
}

.bf-image-choice--2col { grid-template-columns: repeat( 2, 1fr ); }
.bf-image-choice--3col { grid-template-columns: repeat( 3, 1fr ); }
.bf-image-choice--4col { grid-template-columns: repeat( 4, 1fr ); }
.bf-image-choice--5col { grid-template-columns: repeat( 5, 1fr ); }
.bf-image-choice--6col { grid-template-columns: repeat( 6, 1fr ); }

/* ==========================================================================
   Tile  (<label>)
   ========================================================================== */

.bf-image-choice__item {
	cursor: pointer;
	display: flex;
	flex-direction: column;
	border: 2px solid #e2e8f0;
	border-radius: 10px;
	overflow: hidden;
	background: #ffffff;
	transition: border-color 0.15s, box-shadow 0.15s;
	user-select: none;
	-webkit-user-select: none;
}

.bf-image-choice__item:hover {
	border-color: var( --bf-focus-color, #0f766e );
}

.bf-image-choice__item.is-checked {
	border-color: var( --bf-focus-color, #0f766e );
	box-shadow: 0 0 0 3px color-mix( in srgb, var( --bf-focus-color, #0f766e ) 15%, transparent );
}

/* ==========================================================================
   Hidden native input
   ========================================================================== */

.bf-image-choice__item input[type="radio"],
.bf-image-choice__item input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
	width: 0;
	height: 0;
	margin: 0;
}

/* ==========================================================================
   Image wrapper — 1:1 aspect ratio, image fills it
   ========================================================================== */

.bf-image-choice__img-wrap {
	position: relative;
	height: var( --bf-ic-img-height, 160px );
	overflow: hidden;
	background: #f1f5f9;
	flex-shrink: 0;
}

.bf-image-choice__img-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.2s ease;
}

.bf-image-choice__item:hover .bf-image-choice__img-wrap img {
	transform: scale( 1.04 );
}

/* Placeholder when no image is set */
.bf-image-choice__img-placeholder {
	display: flex;
	width: 100%;
	height: 100%;
	align-items: center;
	justify-content: center;
	color: #94a3b8;
}

.bf-image-choice__img-placeholder .dashicons {
	font-size: 32px;
	width: 32px;
	height: 32px;
}

/* ==========================================================================
   Check badge — top-right overlay, appears on selection
   ========================================================================== */

.bf-image-choice__check {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var( --bf-focus-color, #0f766e );
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	opacity: 0;
	transform: scale( 0.6 );
	transition: opacity 0.15s ease, transform 0.15s ease;
	pointer-events: none;
	box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.bf-image-choice__item.is-checked .bf-image-choice__check {
	opacity: 1;
	transform: scale( 1 );
}

/* ==========================================================================
   Label strip
   ========================================================================== */

.bf-image-choice__label {
	padding: 8px 10px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	text-align: center;
	color: #374151;
	word-break: break-word;
	transition: color 0.15s;
}

.bf-image-choice__item.is-checked .bf-image-choice__label {
	color: var( --bf-focus-color, #0f766e );
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media ( max-width: 480px ) {
	.bf-image-choice--4col {
		grid-template-columns: repeat( 2, 1fr );
	}
}
