/* United Diplomats – Delegate Photo Generator
 * Scoped under .udpg so theme / Elementor styles don't clash. */

.udpg {
	--udpg-accent: #009edb;          /* UN blue */
	--udpg-accent-dark: #0077a8;
	--udpg-border: #c9d5e1;
	--udpg-surface: #f6f9fc;
	--udpg-text: #1d2733;
	--udpg-muted: #5b6b7c;
	max-width: 560px;
	margin: 0 auto;
	color: var(--udpg-text);
	font: inherit;
	box-sizing: border-box;
}
.udpg *, .udpg *::before, .udpg *::after { box-sizing: inherit; }
.udpg [hidden] { display: none !important; }

/* ---- Delegate details ------------------------------------------------ */
.udpg .udpg-fields {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-bottom: 16px;
}
@media (max-width: 520px) { .udpg .udpg-fields { grid-template-columns: 1fr; } }
.udpg .udpg-field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92em; }
.udpg .udpg-field input {
	width: 100%;
	padding: 11px 12px;
	border: 1px solid var(--udpg-border);
	border-radius: 8px;
	background: #fff;
	color: var(--udpg-text);
	font: inherit;
	font-weight: 400;
}
.udpg .udpg-field input:focus { outline: none; border-color: var(--udpg-accent); box-shadow: 0 0 0 3px rgba(0, 158, 219, .18); }

/* ---- Upload area ---------------------------------------------------- */
.udpg .udpg-drop {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 28px 20px;
	border: 2px dashed var(--udpg-border);
	border-radius: 14px;
	background: var(--udpg-surface);
	text-align: center;
	cursor: pointer;
	transition: border-color .15s ease, background-color .15s ease;
}
.udpg .udpg-drop:hover,
.udpg .udpg-drop:focus-within { border-color: var(--udpg-accent); background: #eef7fc; }

/* Visually hidden but still keyboard/screen-reader accessible. */
.udpg .udpg-file {
	position: absolute;
	width: 1px; height: 1px;
	opacity: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
}
.udpg .udpg-drop-title { font-weight: 600; font-size: 1.05em; }
.udpg .udpg-drop-hint  { color: var(--udpg-muted); font-size: .9em; }
.udpg .udpg-preview {
	width: 140px; height: 140px;
	object-fit: cover;
	border-radius: 50%;
	border: 3px solid #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}

.udpg .udpg-consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 16px 0;
	font-size: .9em;
	color: var(--udpg-muted);
	cursor: pointer;
}
.udpg .udpg-consent input { margin-top: 3px; flex: none; }

/* ---- Buttons --------------------------------------------------------- */
.udpg .udpg-btn {
	display: block;
	width: 100%;
	padding: 14px 18px;
	border: 0;
	border-radius: 10px;
	background: var(--udpg-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
	transition: background-color .15s ease;
}
.udpg .udpg-btn:hover,
.udpg .udpg-btn:focus-visible { background: var(--udpg-accent-dark); color: #fff; }
.udpg .udpg-btn:disabled { opacity: .6; cursor: wait; }
.udpg .udpg-btn-secondary { background: transparent; color: var(--udpg-accent-dark); border: 2px solid var(--udpg-accent); }
.udpg .udpg-btn-secondary:hover { background: #eef7fc; color: var(--udpg-accent-dark); }

/* ---- Loading state ---------------------------------------------------- */
.udpg .udpg-status {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 22px 8px;
	text-align: left;
	color: var(--udpg-muted);
}
.udpg .udpg-spinner {
	flex: none;
	width: 32px; height: 32px;
	border: 3px solid rgba(0, 158, 219, .2);
	border-top-color: var(--udpg-accent);
	border-radius: 50%;
	animation: udpg-spin .8s linear infinite;
}
@keyframes udpg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .udpg .udpg-spinner { animation-duration: 2.4s; } }

.udpg.is-loading .udpg-drop { opacity: .6; pointer-events: none; }

/* ---- Errors ------------------------------------------------------------ */
.udpg .udpg-error {
	margin: 14px 0;
	padding: 12px 14px;
	border-radius: 10px;
	background: #fdecea;
	color: #8a1c12;
	font-size: .95em;
}

/* ---- Protected result viewer ----------------------------------------- */
.udpg .udpg-viewer {
	position: relative;
	width: 100%;
	aspect-ratio: 3 / 4;                 /* replaced by real ratio in JS */
	margin-bottom: 16px;
	border-radius: 14px;
	overflow: hidden;
	background: var(--udpg-surface);
	box-shadow: 0 4px 18px rgba(0, 0, 0, .12);

	/* No selecting, no iOS/Android long-press "Save image" callout. */
	-webkit-user-select: none;
	-moz-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
	-webkit-user-drag: none;
}

/* The image itself: a CSS background, and it never receives pointer events. */
.udpg .udpg-image {
	position: absolute;
	inset: 0;
	background-position: center;
	background-repeat: no-repeat;
	background-size: contain;
	pointer-events: none;
	-webkit-user-drag: none;
	user-select: none;
}

/* Transparent shield on top: every click / long-press / drag hits this
 * empty div, not the image, so "Save image as…" is never offered. */
.udpg .udpg-shield {
	position: absolute;
	inset: 0;
	z-index: 2;
	background: transparent;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-user-drag: none;
}

/* Keep the generated image out of printouts and "Save as PDF". */
@media print {
	.udpg .udpg-result { display: none !important; }
}
