/**
 * DHI Ninja Forms Signature — scoped styles to reduce theme conflicts.
 */

.dhi-signature-field {
	box-sizing: border-box;
	max-width: 100%;
	margin-bottom: 1em;
	min-height: 2.75rem;
}

.dhi-signature-init-msg {
	margin: 0 0 0.5em;
	padding: 0.5em 0.65em;
	font-size: 0.875rem;
	line-height: 1.4;
	color: #1d2327;
	background: #fcf0f1;
	border: 1px solid #d63638;
	border-radius: 4px;
}

.dhi-signature-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.5em;
}

.dhi-signature-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.35em;
	font-size: 0.95em;
	line-height: 1.3;
}

.dhi-signature-legacy-hidden {
	display: none !important;
}

/* —— Toolbar (modal mode; sibling of .dhi-signature-field) —— */

.dhi-signature-toolbar .dhi-signature-open,
.dhi-signature-toolbar .dhi-signature-remove,
.dhi-signature-field .dhi-signature-open,
.dhi-signature-field .dhi-signature-remove {
	appearance: none;
	-webkit-appearance: none;
	box-sizing: border-box;
	margin: 0 0.5em 0.5em 0;
	padding: 0.5em 1em;
	font-size: 0.9rem;
	line-height: 1.4;
	font-family: inherit;
	border-radius: 4px;
	cursor: pointer;
	vertical-align: middle;
}

.dhi-signature-toolbar .dhi-signature-open,
.dhi-signature-field .dhi-signature-open {
	color: #fff;
	background: #2271b1;
	border: 1px solid #2271b1;
}

.dhi-signature-toolbar .dhi-signature-open:hover,
.dhi-signature-field .dhi-signature-open:hover {
	background: #135e96;
	border-color: #135e96;
}

.dhi-signature-toolbar .dhi-signature-open:focus,
.dhi-signature-field .dhi-signature-open:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.dhi-signature-toolbar .dhi-signature-remove,
.dhi-signature-field .dhi-signature-remove {
	color: #333;
	background: #f0f0f0;
	border: 1px solid #c3c4c7;
}

.dhi-signature-toolbar .dhi-signature-remove:hover,
.dhi-signature-field .dhi-signature-remove:hover {
	background: #e0e0e0;
}

/* —— Inline canvas (legacy / data-dhi-inline) —— */

.dhi-signature-field canvas.dhi-signature-canvas {
	display: block;
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 100%;
	height: 180px;
	box-sizing: border-box;
	border: 1px solid #c5c5c5;
	background: #fff;
	border-radius: 6px;
	cursor: crosshair;
	touch-action: none;
	pointer-events: auto;
	-webkit-user-select: none;
	user-select: none;
}

.dhi-signature-field button.dhi-signature-clear {
	appearance: none;
	-webkit-appearance: none;
	box-sizing: border-box;
	margin-top: 0.5em;
	padding: 0.45em 0.85em;
	font-size: 0.875rem;
	line-height: 1.4;
	font-family: inherit;
	color: #333;
	background: #f3f3f3;
	border: 1px solid #bbb;
	border-radius: 4px;
	cursor: pointer;
}

.dhi-signature-field button.dhi-signature-clear:hover {
	background: #e8e8e8;
	border-color: #aaa;
}

.dhi-signature-field button.dhi-signature-clear:focus {
	outline: 2px solid #666;
	outline-offset: 2px;
}

.dhi-signature-field img.dhi-signature-preview {
	display: none;
	max-width: 100%;
	height: auto;
	margin-top: 0.5em;
	border-radius: 4px;
	border: 1px solid #ddd;
}

.dhi-signature-field img.dhi-signature-preview.dhi-signature-preview--visible {
	display: block;
}

/* —— Modal —— */

.dhi-signature-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 100000;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	box-sizing: border-box;
}

.dhi-signature-modal.dhi-signature-modal--open {
	display: flex;
}

.dhi-signature-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	cursor: pointer;
}

.dhi-signature-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 520px;
	max-height: calc(100vh - 2rem);
	overflow: auto;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.dhi-signature-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.85rem 1rem;
	border-bottom: 1px solid #e0e0e0;
}

.dhi-signature-modal__title {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.3;
}

.dhi-signature-modal__close {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	padding: 0.25rem 0.5rem;
	font-size: 1.5rem;
	line-height: 1;
	color: #50575e;
	background: transparent;
	border: none;
	border-radius: 4px;
	cursor: pointer;
}

.dhi-signature-modal__close:hover {
	background: #f0f0f0;
	color: #1d2327;
}

.dhi-signature-modal__body {
	padding: 1rem;
}

.dhi-signature-modal__canvas-wrap {
	width: 100%;
	min-height: 120px;
}

.dhi-signature-modal__canvas {
	display: block;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	border: 1px solid #c5c5c5;
	background: #fff;
	border-radius: 6px;
	cursor: crosshair;
	touch-action: none;
	pointer-events: auto;
	-webkit-user-select: none;
	user-select: none;
}

.dhi-signature-modal__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-top: 1rem;
}

.dhi-signature-modal__spacer {
	flex: 1 1 auto;
	min-width: 0.5rem;
}

.dhi-signature-modal__clear,
.dhi-signature-modal__cancel,
.dhi-signature-modal__confirm {
	appearance: none;
	-webkit-appearance: none;
	box-sizing: border-box;
	padding: 0.5em 0.9em;
	font-size: 0.875rem;
	font-family: inherit;
	line-height: 1.4;
	border-radius: 4px;
	cursor: pointer;
}

.dhi-signature-modal__clear {
	color: #333;
	background: #f3f3f3;
	border: 1px solid #bbb;
}

.dhi-signature-modal__clear:hover {
	background: #e8e8e8;
}

.dhi-signature-modal__cancel {
	color: #333;
	background: #fff;
	border: 1px solid #8c8f94;
}

.dhi-signature-modal__cancel:hover {
	background: #f6f7f7;
}

.dhi-signature-modal__confirm {
	color: #fff;
	background: #2271b1;
	border: 1px solid #2271b1;
}

.dhi-signature-modal__confirm:hover {
	background: #135e96;
	border-color: #135e96;
}

@media print {
	.dhi-signature-canvas,
	.dhi-signature-clear,
	.dhi-signature-open,
	.dhi-signature-remove,
	.dhi-signature-toolbar,
	.dhi-signature-modal,
	.dhi-signature-init-msg {
		display: none !important;
	}

	.dhi-signature-preview {
		display: block !important;
		max-width: 400px;
		border-bottom: 1px solid #000;
	}
}
