/**
 * Field Placer – admin modal styles.
 *
 * @package Client_Document_Signatures
 */

/* ------------------------------------------------------------------ */
/*  Body lock when modal is open                                       */
/* ------------------------------------------------------------------ */
body.fp-no-scroll {
	overflow: hidden !important;
}

/* ------------------------------------------------------------------ */
/*  Overlay / backdrop                                                 */
/* ------------------------------------------------------------------ */
.fp-overlay {
	position: fixed;
	inset: 0;
	z-index: 160000;
	background: rgba(0, 0, 0, 0.72);
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ------------------------------------------------------------------ */
/*  Modal                                                              */
/* ------------------------------------------------------------------ */
.fp-modal {
	background: #fff;
	width: 94vw;
	max-width: 1200px;
	max-height: 92vh;
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* Header */
.fp-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 24px 12px;
	border-bottom: 1px solid #e0e0e0;
}
.fp-modal-header .fp-title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #1d2327;
}
.fp-close {
	background: none;
	border: none;
	font-size: 28px;
	cursor: pointer;
	color: #666;
	line-height: 1;
	padding: 0 4px;
}
.fp-close:hover {
	color: #d63638;
}

/* Instructions */
.fp-instructions {
	margin: 0;
	padding: 10px 24px;
	background: #f0f6fc;
	color: #2271b1;
	font-size: 13px;
	line-height: 1.5;
	border-bottom: 1px solid #e0e0e0;
}

/* ------------------------------------------------------------------ */
/*  Toolbar                                                            */
/* ------------------------------------------------------------------ */
.fp-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 24px;
	gap: 12px;
	border-bottom: 1px solid #e0e0e0;
	flex-wrap: wrap;
	background: #f9f9f9;
}
.fp-tool-group {
	display: flex;
	align-items: center;
	gap: 8px;
}
.fp-tool-label {
	font-weight: 600;
	font-size: 13px;
	color: #50575e;
}
.fp-tool-btn {
	padding: 5px 14px;
	font-size: 13px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	color: #50575e;
	transition: all 0.15s ease;
}
.fp-tool-btn:hover {
	border-color: #2271b1;
	color: #2271b1;
}
.fp-tool-btn.fp-tool-active {
	background: #2271b1;
	color: #fff;
	border-color: #2271b1;
}

/* Signer selector in toolbar */
.fp-signer-group {
	border-left: 1px solid #ddd;
	padding-left: 12px;
}
.fp-signer-select {
	padding: 4px 8px;
	font-size: 13px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #fff;
	max-width: 200px;
}

/* Page nav */
.fp-page-nav {
	display: flex;
	align-items: center;
	gap: 8px;
}
.fp-page-info {
	font-size: 13px;
	color: #50575e;
	min-width: 90px;
	text-align: center;
}

/* ------------------------------------------------------------------ */
/*  PDF viewer area                                                    */
/* ------------------------------------------------------------------ */
.fp-viewer-wrap {
	flex: 1 1 auto;
	overflow: auto;
	padding: 16px 24px;
	background: #e8e8e8;
	display: flex;
	justify-content: center;
	min-height: 300px;
}

.fp-canvas-container {
	position: relative;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
	background: #fff;
	line-height: 0;
}

#fp-pdf-canvas {
	display: block;
}

/* ------------------------------------------------------------------ */
/*  Field overlay layer                                                */
/* ------------------------------------------------------------------ */
.fp-field-layer {
	position: absolute;
	top: 0;
	left: 0;
	cursor: crosshair;
}

/* Drag rectangle (while drawing) */
.fp-drag-rect {
	position: absolute;
	border: 2px dashed #2271b1;
	background: rgba(34, 113, 177, 0.12);
	pointer-events: none;
	z-index: 5;
}

/* Placed field rectangles */
.fp-field-rect {
	position: absolute;
	border: 2px solid #2271b1;
	background: rgba(34, 113, 177, 0.10);
	border-radius: 3px;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s;
}
.fp-field-rect:hover {
	background: rgba(34, 113, 177, 0.22);
}
.fp-field-rect.fp-type-signature {
	border-color: #2271b1;
	background: rgba(34, 113, 177, 0.10);
}
.fp-field-rect.fp-type-initials {
	border-color: #dba617;
	background: rgba(219, 166, 23, 0.10);
}
.fp-field-rect.fp-type-initials:hover {
	background: rgba(219, 166, 23, 0.22);
}
.fp-field-rect.fp-type-date {
	border-color: #00a32a;
	background: rgba(0, 163, 42, 0.10);
}
.fp-field-rect.fp-type-date:hover {
	background: rgba(0, 163, 42, 0.22);
}

/* Field label inside rect (fallback for unknown types) */
.fp-field-label {
	font-size: 11px;
	font-weight: 600;
	color: #1d2327;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	pointer-events: none;
	user-select: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Realtime preview content inside placed fields */
.fp-field-preview {
	pointer-events: none;
	user-select: none;
	display: block;
	width: 100%;
	text-align: center;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	line-height: 1.2;
}
.fp-preview-signature {
	font-family: "Brush Script MT", "Segoe Script", "Comic Sans MS", cursive;
	font-style: italic;
	font-size: 22px;
	color: rgba(34, 113, 177, 0.55);
}
.fp-preview-initials {
	font-family: "Georgia", "Times New Roman", serif;
	font-weight: 700;
	font-style: italic;
	font-size: 20px;
	color: rgba(180, 140, 20, 0.60);
	letter-spacing: 2px;
}
.fp-preview-date {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 12px;
	font-weight: 500;
	color: rgba(0, 130, 30, 0.60);
}

/* Small type badge in bottom-left corner of field */
.fp-field-type-badge {
	position: absolute;
	bottom: 1px;
	left: 4px;
	font-size: 8px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	opacity: 0.5;
	pointer-events: none;
	user-select: none;
	color: #1d2327;
}

/* Signer badge in field rect (multi-signer) */
.fp-field-signer-badge {
	position: absolute;
	top: 1px;
	right: 4px;
	font-size: 8px;
	font-weight: 600;
	background: rgba(0, 0, 0, 0.08);
	padding: 1px 4px;
	border-radius: 3px;
	pointer-events: none;
	user-select: none;
	color: #333;
	max-width: 60%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Dashed border style for placed fields */
.fp-field-rect {
	border-style: dashed;
}
.fp-field-rect:hover {
	border-style: solid;
}

/* Remove button on field */
.fp-field-remove {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: none;
	background: #d63638;
	color: #fff;
	font-size: 14px;
	line-height: 18px;
	text-align: center;
	cursor: pointer;
	display: none;
	padding: 0;
	z-index: 11;
}
.fp-field-rect:hover .fp-field-remove {
	display: block;
}

/* ------------------------------------------------------------------ */
/*  Fields list table (below viewer)                                   */
/* ------------------------------------------------------------------ */
.fp-fields-list {
	padding: 12px 24px 8px;
	border-top: 1px solid #e0e0e0;
	max-height: 140px;
	overflow-y: auto;
	background: #fafafa;
}
.fp-fields-list h3 {
	margin: 0 0 8px;
	font-size: 13px;
	color: #50575e;
}
.fp-fields-tbl {
	width: 100%;
}
.fp-fields-tbl th,
.fp-fields-tbl td {
	padding: 4px 8px;
	font-size: 12px;
}

/* ------------------------------------------------------------------ */
/*  Footer                                                             */
/* ------------------------------------------------------------------ */
.fp-modal-footer {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	padding: 14px 24px;
	border-top: 1px solid #e0e0e0;
	background: #f9f9f9;
}

/* ------------------------------------------------------------------ */
/*  Success panel                                                      */
/* ------------------------------------------------------------------ */
.fp-success {
	text-align: center;
	padding: 60px 40px;
}
.fp-success .dashicons {
	font-size: 64px;
	width: 64px;
	height: 64px;
	color: #00a32a;
	margin-bottom: 16px;
}
.fp-success h3 {
	font-size: 22px;
	margin: 0 0 10px;
	color: #1d2327;
}
.fp-success p {
	font-size: 14px;
	color: #50575e;
	margin: 10px 0;
}

/* ------------------------------------------------------------------ */
/*  Responsive                                                         */
/* ------------------------------------------------------------------ */
@media (max-width: 782px) {
	.fp-modal {
		width: 100vw;
		max-width: 100vw;
		max-height: 100vh;
		border-radius: 0;
	}
	.fp-toolbar {
		flex-direction: column;
		align-items: flex-start;
	}
}
