.tgwcfb-label {
	display: block;

	&.required:after {
		content: ' *';
		color: red;
	}
}

.tgwcfb-select {
	height: 49px !important;
	min-height: 49px !important;
	max-width: 100%;
	padding: 0 16px;
	border-radius: 4px;
	font-size: 14px;
	border-color: #e1e1e1;
}

.tgwcfb_settings {
	.components-base-control__label {
		text-transform: capitalize;
		font-size: 12px;
		font-weight: 500;
		color: #424242;
	}

	.components-form-toggle__input {
		&:focus {
			box-shadow: 0 0 0 0 #2271b1 !important;
			outline: 0 solid transparent !important;
		}
	}

	.components-text-control__input,
	.components-input-control__backdrop {
		border-color: #e1e1e1 !important;
		height: 34px;
		font-size: 12px;
		-webkit-border-radius: 4px;
		-moz-border-radius: 4px;
		border-radius: 4px;
	}

	.is-checked {
		.components-form-toggle__track {
			background: #2563eb;
		}
	}

	.components-textarea-control__input {
		border-color: #e1e1e1 !important;
	}

	.components-external-link {
		color: #2563eb;
	}

	.components-button-group {
		.components-button {
			box-shadow: inset 0 0 0 1px #e1e1e1;

			&.is-primary {
				background: #2563eb;
			}
		}
	}
}

.components-base-control__help {
	font-style: italic !important;
}

.tgwcfb-input {
	width: 100%;
	padding: 4px !important;
	min-height: 36px !important;
}

.tgwcfb-select:not(.select2-hidden-accessible) {
	width: 100% !important;
	max-width: 100% !important;
}

.form-row {
	margin: 1em 0;
}

.input-description {
	margin-top: 0;
	display: block;
}

.input-wrapper {
	display: flex;
	align-items: center;

	input[type='range'] {
		flex-grow: 1;
	}

	input[type='number'] {
		width: 100px;
	}
}

.tgwcfb-control {
	.components-button-group {
		display: block;
	}

	> .components-base-control__field {
		> .components-base-control__label {
			margin-bottom: 8px;
			display: inline-block;
		}
		> .components-base-control {
			margin-bottom: 0;
		}
	}
}

.block-editor-block-list__layout {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-start;
	flex-direction: row;
	column-gap: 10px;
	max-width: 650px;
	margin: auto;
	padding: 0 !important;

	> .field-width-100,
	.block-list-appender {
		flex: 0 0 100%;
	}

	> .field-width-50 {
		flex: 0 0 calc(50% - 5px);
	}

	&.is-root-container .wp-block[class*='field-width'] {
		margin: 0 !important;
	}
}

.tgwcfb-options {
	margin: 0;
	padding: 0;
	list-style-type: none;

	.tgwcfb-option {
		display: flex;
		align-items: center;
		padding-bottom: 1px;

		.tgwcfb-option-input {
			flex-grow: 1;
			border: none;
			outline: none;
			padding: 0 8px;
			line-height: 2;
			min-height: 30px;

			&:hover {
				outline: 1px solid #2271b1;
			}

			&:focus,
			&:focus-within {
				outline: none;
				border: 1px solid #8c8f94;
			}
		}
	}
}

[data-type='tgwcfb/user-roles'] .form-row {
	position: relative;

	.loading {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		display: grid;
		place-items: center;
		background: rgba(0, 0, 0, 0.04);
		z-index: 1;
	}
}

.components-base-control {
	margin-bottom: 24px;
}

.tgwcfb-shortcode-wrapper,
.tgwcfb-header-actions {
	/* Invisible until inside header settings — prevents below-header flash on load. */
	opacity: 0;
	pointer-events: none;
}

.editor-header__settings .tgwcfb-shortcode-wrapper,
.edit-post-header__settings .tgwcfb-shortcode-wrapper,
.editor-header__settings .tgwcfb-header-actions,
.edit-post-header__settings .tgwcfb-header-actions {
	opacity: 1;
	pointer-events: auto;
	display: flex;
	align-items: center;
	flex-shrink: 0;
	margin-right: 12px;
	gap: 8px;
}

.tgwcfb-header-shortcode-wrap {
	display: flex;
	align-items: center;
	gap: 0;

	> input,
	.tgwcfb-header-shortcode-input {
		width: 280px;
		height: 36px;
		min-height: 36px;
		padding: 4px 8px;
		margin: 0;
		box-sizing: border-box;
		font-size: 12px;
		font-family: monospace;
		border: 1px solid #ddd;
		border-radius: 2px 0 0 2px;
		background: #fff;
		box-shadow: none;
		color: #1e1e1e;
	}

	> button,
	.tgwcfb-header-copy-shortcode.components-button {
		height: 36px;
		min-height: 36px;
		min-width: 36px;
		padding: 4px;
		border-radius: 0 2px 2px 0;
		display: inline-flex;
		align-items: center;
		justify-content: center;

		svg {
			fill: none;
			stroke: currentColor;
		}
	}
}

.tgwcfb-header-copy-wrap {
	display: inline-flex;
}

/* Header action tooltips (Copy) — white surface. */
body.post-type-tgwcfb_form .components-tooltip {
	background: #fff;
	color: #1e1e1e;
	border: 1px solid #dcdcde;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	padding: 6px 10px;
	border-radius: 4px;
}

.tgwcfb-shortcode-wrapper {
	> input {
		padding: 0 6px;
		margin: 0;
		border-color: #dee0e9;
		background-color: #f0f1f5;
		border-radius: 4px 0 0 4px;
	}

	> button {
		border-radius: 0 4px 4px 0;

		svg {
			fill: #fff;
		}
	}
}

.edit-post-visual-editor__post-title-wrapper,
.editor-visual-editor__post-title-wrapper,
.editor-post-title,
.editor-post-title__block,
.wp-block.editor-post-title {
	max-width: 650px !important;
	margin-left: auto !important;
	margin-right: auto !important;
}

[class*='tgwcfb_form_'] {
	.is-root-container {
		margin: auto !important;
		max-width: 650px !important;
	}
}

.editor-block-list-item-tgwcfb-phone,
.editor-block-list-item-tgwcfb-multi-select,
.editor-block-list-item-tgwcfb-profile-picture,
.editor-block-list-item-tgwcfb-date-picker,
.editor-block-list-item-tgwcfb-user-roles,
.editor-block-list-item-tgwcfb-time-picker,
.editor-block-list-item-tgwcfb-range,
.editor-block-list-item-tgwcfb-file-upload,
.editor-block-list-item-tgwcfb-confirm-password {
	position: relative;
	opacity: 0.5 !important;
	// pointer-events: none !important;

	&::before {
		content: '';
		display: inline-block;
		width: 18px;
		height: 18px;
		background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 width%3D%2211%22 height%3D%2211%22 viewBox%3D%220 0 24 24%22 fill%3D%22none%22 stroke%3D%22%23fff%22 stroke-width%3D%222%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22%3E%3Cpath d%3D%22m2 4 3 12h14l3-12-6 5-4-5-4 5-6-5zm3 16h14%22%2F%3E%3C%2Fsvg%3E');
		background-color: #ff8c39;
		background-repeat: no-repeat;
		background-position: center;
		background-size: 65%;
		position: absolute;
		border-radius: 4px;
		top: 4px;
		right: 4px;
	}
}

// Single-use default blocks: gray circle lock badge — only when li has draggable="false"
.block-editor-block-types-list__list-item[draggable='false'] {
	.editor-block-list-item-tgwcfb-username,
	.editor-block-list-item-tgwcfb-email,
	.editor-block-list-item-tgwcfb-password,
	.editor-block-list-item-tgwcfb-first-name,
	.editor-block-list-item-tgwcfb-last-name,
	.editor-block-list-item-tgwcfb-nickname,
	.editor-block-list-item-tgwcfb-display-name,
	.editor-block-list-item-tgwcfb-description,
	.editor-block-list-item-tgwcfb-url {
		position: relative;

		&::before {
			content: '';
			background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 width%3D%2212%22 height%3D%2212%22 viewBox%3D%220 0 24 24%22 fill%3D%22none%22 stroke%3D%22%23fff%22 stroke-width%3D%222.5%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22%3E%3Crect x%3D%223%22 y%3D%2211%22 width%3D%2218%22 height%3D%2211%22 rx%3D%222%22 ry%3D%222%22%2F%3E%3Cpath d%3D%22M7 11V7a5 5 0 0 1 10 0v4%22%2F%3E%3C%2Fsvg%3E');
			background-color: #adb5bd;
			background-repeat: no-repeat;
			background-position: center;
			background-size: 62%;
			position: absolute;
			width: 18px;
			height: 18px;
			top: 4px;
			right: 4px;
			border-radius: 50%;
		}
	}
}

// Pro hover popup — used in block inspector panel
.tgwcfb-pro {
	position: relative;
	display: inline-flex;
	align-items: center;
	vertical-align: middle;

	&::after {
		content: '';
		position: absolute;
		bottom: -10px;
		left: 0;
		right: 0;
		height: 10px;
	}

	&:hover .tgwcfb-pro__popup,
	.tgwcfb-pro__popup:hover {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		transform: translateY(0);
	}
}

.tgwcfb-pro__crown {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	background: #ff8c39;
	border-radius: 4px;
	color: #fff;
	cursor: pointer;
	flex-shrink: 0;

	svg {
		width: 12px;
		height: 12px;

		path {
			stroke: #fff;
		}
	}
}

.tgwcfb-pro__popup {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	left: auto;
	transform: translateY(6px);
	width: 240px;
	padding: 16px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	z-index: 999999;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
	text-align: left;
	white-space: normal;

	&::before,
	&::after {
		content: '';
		position: absolute;
		left: 16px;
		border-style: solid;
		border-color: transparent;
	}

	&::before {
		top: -7px;
		border-width: 0 6px 7px;
		border-bottom-color: #e5e7eb;
	}

	&::after {
		top: -6px;
		border-width: 0 5px 6px;
		border-bottom-color: #fff;
	}
}

.tgwcfb-pro__popup-msg {
	display: block;
	font-size: 13px;
	color: #374151;
	margin: 0 0 12px;
	line-height: 1.5;
	font-weight: normal;
}

.tgwcfb-pro__popup-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	background: #ff8c39;
	color: #fff !important;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500 !important;
	text-decoration: none !important;
	text-transform: none;
	line-height: 1;
	transition: background 0.15s ease;

	&:hover {
		background: #e87b2a;
		color: #fff !important;
	}

	svg path {
		stroke: #fff;
	}
}

.tgwcfb-pro__popup-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 14px;
	height: 14px;
	flex-shrink: 0;

	svg {
		width: 12px;
		height: 12px;
	}
}
