/**
 * CFTV Icon Picker — field UI + modal grid (wp-admin / block editor).
 *
 * @package CFTV
 */

/* --- Field row -------------------------------------------------------- */
.cftv-iconpick {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.cftv-iconpick__preview {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	background: #fff;
	font-size: 20px;
	color: #3d3454;
	flex: 0 0 auto;
}

.cftv-iconpick__preview:empty::before {
	content: "\f2b9"; /* fa-address-card outline as placeholder */
	font-family: "Font Awesome 6 Pro", "Font Awesome 6 Free";
	font-weight: 300;
	opacity: 0.25;
}

.cftv-iconpick__label {
	font-family: Menlo, Consolas, monospace;
	font-size: 12px;
	color: #50575e;
}

.cftv-iconpick__clear {
	color: #b32d2e;
	text-decoration: none;
	cursor: pointer;
}

/* --- Modal overlay ---------------------------------------------------- */
.cftv-iconmodal[hidden] {
	display: none;
}

.cftv-iconmodal {
	position: fixed;
	inset: 0;
	z-index: 160000; /* above ACF/Gutenberg UI */
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.55);
	padding: 24px;
}

.cftv-iconmodal__panel {
	background: #fff;
	width: min(880px, 100%);
	max-height: 88vh;
	border-radius: 8px;
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.cftv-iconmodal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	border-bottom: 1px solid #e2e2e4;
}

.cftv-iconmodal__title {
	font-size: 15px;
	color: #1d2327;
}

.cftv-iconmodal__x {
	border: 0;
	background: transparent;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: #646970;
	padding: 0 4px;
}

.cftv-iconmodal__x:hover {
	color: #135e96;
}

.cftv-iconmodal__tools {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 18px;
	border-bottom: 1px solid #f0f0f1;
}

.cftv-iconmodal__search {
	flex: 1 1 auto;
	height: 36px;
	font-size: 14px;
}

.cftv-iconmodal__count {
	font-size: 12px;
	color: #787c82;
	white-space: nowrap;
}

/* --- Grid ------------------------------------------------------------- */
.cftv-iconmodal__grid {
	overflow-y: auto;
	padding: 14px 18px;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 8px;
	align-content: start;
}

.cftv-iconmodal__cell {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 82px;
	padding: 6px;
	border: 1px solid #e2e2e4;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
	overflow: hidden;
}

.cftv-iconmodal__cell:hover,
.cftv-iconmodal__cell:focus {
	border-color: #3d3454;
	box-shadow: 0 0 0 1px #3d3454;
	background: #faf9fc;
	outline: none;
}

.cftv-iconmodal__cell i {
	font-size: 24px;
	color: #3d3454;
	line-height: 1;
}

.cftv-iconmodal__cell span {
	font-size: 10px;
	line-height: 1.2;
	color: #646970;
	text-align: center;
	max-width: 100%;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cftv-iconmodal__empty {
	grid-column: 1 / -1;
	text-align: center;
	color: #787c82;
	padding: 32px 0;
}

/* --- Manual entry ----------------------------------------------------- */
.cftv-iconmodal__manual {
	border-top: 1px solid #e2e2e4;
	padding: 12px 18px;
	font-size: 13px;
	color: #50575e;
}

.cftv-iconmodal__manualrow {
	display: flex;
	gap: 8px;
	margin-top: 6px;
}

.cftv-iconmodal__custom {
	flex: 1 1 auto;
	height: 34px;
	font-family: Menlo, Consolas, monospace;
}

/* Prevent background scroll while open. */
body.cftv-iconmodal-open {
	overflow: hidden;
}
