/* Frontend layout (wrapper class added by PHP render_block) */
.wp-block-button.has-wx-svg-icon .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
}

/* Editor preview layout (class added to link via JS injection) */
.wp-block-button__link.has-wx-svg-icon {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
}

/* Icon box */
.wx-button-icon.wx-svg-icon,
.wx-icon-picker .wx-svg-icon {
	display: inline-block;
	width: 1em;
	height: 1em;
	background-color: currentColor;
	flex: 0 0 auto;

	-webkit-mask-repeat: no-repeat;
	-webkit-mask-position: center;
	-webkit-mask-size: contain;
	mask-repeat: no-repeat;
	mask-position: center;
	mask-size: contain;
}

/* Position safety net */
.wp-block-button.icon-left .wp-block-button__link .wx-button-icon,
.wp-block-button__link.icon-left .wx-button-icon {
	order: -1;
}

/* ---------- Sidebar icon grid ---------- */
.wx-icon-picker{
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 8px;
	margin-bottom: 12px;
}

.wx-icon-picker__item{
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;

	width: 36px;
	height: 36px;
	padding: 0;

	border: 1px solid #dcdcde;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
}

.wx-icon-picker__item:hover{
	border-color: #8c8f94;
}

.wx-icon-picker__item.is-selected{
	border-color: #3858e9;
	box-shadow: 0 0 0 1px #3858e9;
}

.wx-icon-picker__icon{
	width: 18px;
	height: 18px;
}

.wx-icon-picker__icon--none{
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	color: #8c8f94;
	font-size: 16px;
	line-height: 1;
}

/* Tooltip */
.wx-icon-picker__item[data-tooltip]::after{
	content: attr(data-tooltip);
	position: absolute;
	left: 50%;
	top: calc(100% + 8px);
	transform: translateX(-50%);
	white-space: nowrap;

	background: #1e1e1e;
	color: #fff;
	font-size: 12px;
	line-height: 1;
	padding: 6px 8px;
	border-radius: 4px;

	opacity: 0;
	pointer-events: none;
	transition: opacity 120ms ease;
	z-index: 9999;
}

.wx-icon-picker__item[data-tooltip]::before{
	content: "";
	position: absolute;
	left: 50%;
	top: calc(100% + 2px);
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-bottom-color: #1e1e1e;

	opacity: 0;
	pointer-events: none;
	transition: opacity 120ms ease;
	z-index: 9999;
}

.wx-icon-picker__item:hover::after,
.wx-icon-picker__item:hover::before{
	opacity: 1;
}


/* ---------- Example SVG masks (replace with your own) ---------- */

.wx-svg-icon--arrow-right {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M13%205l7%207-7%207v-4H4v-6h9V5z%27/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M13%205l7%207-7%207v-4H4v-6h9V5z%27/%3E%3C/svg%3E");
}

.wx-svg-icon--external {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M14%203h7v7h-2V6.41l-9.29%209.3-1.42-1.42%209.3-9.29H14V3z%27/%3E%3Cpath%20d%3D%27M5%205h7v2H7v10h10v-5h2v7H5V5z%27/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M14%203h7v7h-2V6.41l-9.29%209.3-1.42-1.42%209.3-9.29H14V3z%27/%3E%3Cpath%20d%3D%27M5%205h7v2H7v10h10v-5h2v7H5V5z%27/%3E%3C/svg%3E");
}

.wx-svg-icon--download {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M5%2020h14v-2H5v2z%27/%3E%3Cpath%20d%3D%27M11%204h2v8h3l-4%204-4-4h3V4z%27/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M5%2020h14v-2H5v2z%27/%3E%3Cpath%20d%3D%27M11%204h2v8h3l-4%204-4-4h3V4z%27/%3E%3C/svg%3E");
}
