/* =========================================================================
   Polverosa – Documenti Partecipanti  |  checkout a blocchi
   Mobile-first, responsive, cross-browser. Colori brand nel blocco :root.
   Neutralizza il text-transform/letter-spacing del tema per leggibilità.
   ========================================================================= */
.pd-documents {
	/* === BRAND === */
	--pd-accent: #F6D41A;
	--pd-accent-dark: #C9AC0E;
	--pd-red: #892626;
	--pd-ink: #070010;
	--pd-muted: #6F6B66;
	--pd-line: #E6E2DA;
	--pd-surface: #FFFFFF;
	--pd-soft: #FBFAF6;
	--pd-ok: #2E7D32;
	--pd-radius: 14px;
	--pd-radius-sm: 10px;
	--pd-shadow: 0 1px 2px rgba(7,0,16,.04), 0 6px 18px rgba(7,0,16,.05);

	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 22px 0;
	padding: clamp(14px, 4vw, 22px);
	background: var(--pd-soft);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius);
	font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: var(--pd-ink);
	-webkit-font-smoothing: antialiased;
}
/* Reset mirato: il tema del checkout forza MAIUSCOLO e spaziatura. */
.pd-documents,
.pd-documents h3,
.pd-documents h4,
.pd-documents p,
.pd-documents label,
.pd-documents span,
.pd-documents button,
.pd-documents a {
	text-transform: none !important;
	letter-spacing: normal !important;
	line-height: 1.45;
}
.pd-documents *,
.pd-documents *::before,
.pd-documents *::after { box-sizing: border-box; }

.pd-documents__title {
	font-size: clamp(1.05rem, 3.4vw, 1.25rem);
	font-weight: 700;
	margin: 0 0 6px;
	line-height: 1.2;
}
.pd-documents__title::after {
	content: "";
	display: block;
	width: 42px; height: 3px;
	margin-top: 9px;
	background: var(--pd-accent);
	border-radius: 3px;
}
.pd-documents__intro {
	color: var(--pd-muted);
	font-size: .88rem;
	margin: 0 0 16px;
}

/* Card partecipante */
.pd-attendee {
	background: var(--pd-surface);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius-sm);
	padding: clamp(12px, 3.5vw, 16px);
	margin-bottom: 12px;
	box-shadow: var(--pd-shadow);
}
.pd-attendee__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin: 0 0 12px;
}
.pd-attendee__title {
	font-size: .98rem;
	font-weight: 700;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 8px;
}
.pd-attendee__title::before {
	content: "";
	width: 8px; height: 8px; border-radius: 50%;
	background: var(--pd-accent);
	flex: 0 0 auto;
}
.pd-attendee__course {
	font-size: .74rem;
	font-weight: 700;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: var(--pd-red);
	background: var(--pd-soft);
	border: 1px solid var(--pd-line);
	border-radius: 999px;
	padding: 3px 10px;
	line-height: 1.3;
}

/* Tipo certificato */
.pd-cert-type {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
	padding: 11px 13px;
	margin-bottom: 14px;
	background: var(--pd-soft);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius-sm);
}
.pd-cert-type__label { font-weight: 600; font-size: .85rem; width: 100%; }
.pd-cert-type.is-error { border-color: var(--pd-red); background: #fdf4f4; }
.pd-cert-type__error { width: 100%; margin: 4px 0 0; color: var(--pd-red); font-size: .76rem; font-weight: 600; }

/* Tipo certificato vincolato dal prodotto (non selezionabile). */
.pd-cert-type.is-locked { background: var(--pd-soft); }
.pd-cert-type__locked {
	display: inline-flex;
	flex-direction: column;
	gap: 1px;
	padding: 5px 12px;
	border: 1px solid var(--pd-line);
	border-left: 3px solid var(--pd-red);
	border-radius: var(--pd-radius-sm);
	background: #fff;
}
.pd-cert-type__locked-value { font-weight: 700; font-size: .9rem; }
.pd-cert-type__locked-hint { font-size: .72rem; opacity: .7; }

.pd-radio, .pd-checkbox {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	cursor: pointer;
	font-size: .9rem;
	min-height: 34px;
	user-select: none;
}
/* Forza la visibilità dei controlli nativi anche con temi aggressivi. */
.pd-radio input, .pd-checkbox input,
.pd-consent .pd-checkbox input {
	-webkit-appearance: auto !important;
	appearance: auto !important;
	accent-color: var(--pd-red);
	width: 20px; height: 20px;
	flex: 0 0 auto;
	margin: 0;
	opacity: 1 !important;
	filter: none !important;
	box-shadow: none !important;
}
/* I due tipi di certificato come "pillole" con bordo netto, così si vedono anche da non selezionati. */
.pd-radio {
	padding: 6px 14px 6px 11px;
	border: 2px solid var(--pd-line);
	border-radius: 999px;
	background: #fff;
	transition: border-color .12s, background .12s, box-shadow .12s;
}
.pd-radio:hover { border-color: #b9b9c2; }
.pd-radio:has( input:checked ) {
	border-color: var(--pd-red);
	background: #fbeeee;
	box-shadow: 0 0 0 1px var(--pd-red) inset;
	font-weight: 600;
}

/* Griglia documenti */
.pd-docs-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}
.pd-doc__label { display: block; font-weight: 600; font-size: .82rem; margin-bottom: 6px; }
.pd-req { color: var(--pd-accent-dark); }

/* Dropzone */
.pd-dropzone {
	position: relative;
	border: 1.5px dashed var(--pd-line);
	border-radius: var(--pd-radius-sm);
	background: var(--pd-surface);
	padding: 12px;
	text-align: center;
	cursor: pointer;
	min-height: 72px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: border-color .15s ease, background .15s ease;
	-webkit-tap-highlight-color: transparent;
}
.pd-dropzone:hover, .pd-dropzone:focus-within, .pd-dropzone.is-dragover {
	border-color: var(--pd-accent-dark);
	background: var(--pd-soft);
}
.pd-dropzone.is-done { border-style: solid; border-color: var(--pd-ok); background: #f4faf4; }
.pd-dropzone.is-error { border-color: var(--pd-red); background: #fdf4f4; }
.pd-dropzone.is-busy { cursor: progress; }

.pd-file-input {
	position: absolute; inset: 0;
	width: 100%; height: 100%;
	opacity: 0; cursor: pointer;
	z-index: 2;
}
.pd-dropzone.is-busy .pd-file-input,
.pd-dropzone.is-done .pd-file-input { display: none; }

.pd-dropzone__idle, .pd-dropzone__busy, .pd-dropzone__done {
	display: flex; align-items: center; justify-content: center;
	gap: 6px; flex-wrap: wrap;
	position: relative; z-index: 1;
}
.pd-dropzone__idle { flex-direction: column; gap: 3px; }
.pd-dropzone__text { font-size: .84rem; font-weight: 600; }
.pd-dropzone__hint { font-size: .68rem; color: var(--pd-muted); }

.pd-file-name { font-size: .8rem; font-weight: 600; word-break: break-word; }
.pd-check { color: var(--pd-ok); font-weight: 800; }

.pd-remove {
	background: none; border: none; padding: 4px 6px;
	color: var(--pd-red); font-size: .78rem; cursor: pointer;
	text-decoration: underline;
	position: relative; z-index: 3;
}

.pd-spinner {
	width: 18px; height: 18px;
	border: 2px solid var(--pd-line);
	border-top-color: var(--pd-accent-dark);
	border-radius: 50%;
	animation: pd-spin .7s linear infinite;
	flex: 0 0 auto;
}
@keyframes pd-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pd-spinner { animation: none; } }

.pd-doc__error { color: var(--pd-red); font-size: .76rem; margin: 6px 0 0; font-weight: 600; }

/* Consenso */
.pd-consent {
	margin-top: 4px; padding: 12px 14px;
	background: var(--pd-surface);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius-sm);
}
.pd-consent .pd-checkbox { align-items: flex-start; font-size: .82rem; color: var(--pd-muted); }
.pd-consent .pd-checkbox input { margin-top: 2px; }
.pd-consent a { color: var(--pd-accent-dark); text-decoration: underline; }
.pd-consent.is-error { border-color: var(--pd-red); background: #fdf4f4; }
.pd-consent__error { margin: 8px 0 0; color: var(--pd-red); font-size: .76rem; font-weight: 600; }

/* Stato */
.pd-status {
	margin-top: 12px; padding: 10px 14px;
	border-radius: var(--pd-radius-sm);
	font-size: .84rem; font-weight: 600;
	text-align: center;
}
.pd-status--wait { background: #fdf6dd; color: #6b5a07; border: 1px solid #efdf9a; }
.pd-status--ok { background: #eef8ee; color: var(--pd-ok); border: 1px solid #bfe2bf; }

/* Conferma thank-you */
.pd-thankyou {
	display: flex; align-items: center; gap: 10px;
	margin: 18px 0; padding: 14px 16px;
	background: #eef8ee; border: 1px solid #bfe2bf;
	border-radius: 12px; color: #2E7D32; font-weight: 600;
}
.pd-thankyou__check {
	display: inline-flex; align-items: center; justify-content: center;
	width: 24px; height: 24px; border-radius: 50%;
	background: #2E7D32; color: #fff; font-weight: 800; flex: 0 0 auto;
}

/* --- Responsive --- */
@media (min-width: 560px) {
	.pd-docs-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
	.pd-cert-type__label { width: auto; }
}
@media (min-width: 1024px) {
	.pd-docs-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
}

/* Schermi molto stretti: nulla deve uscire dal contenitore */
@media (max-width: 360px) {
	.pd-documents { padding: 12px; }
	.pd-cert-type { gap: 8px; }
}

/* ===================== Liberatoria iscrizione ===================== */
.pd-lib {
	margin-top: 14px;
	padding: 14px;
	background: var(--pd-surface);
	border: 1px solid var(--pd-line);
	border-left: 3px solid var(--pd-red);
	border-radius: var(--pd-radius-sm);
}
.pd-lib__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
}
.pd-lib__title {
	font-weight: 700;
	color: var(--pd-red);
	font-size: .98rem;
}
.pd-lib__badge {
	font-size: .8rem;
	font-weight: 700;
	color: var(--pd-ok);
	background: #eef7ee;
	border: 1px solid #cfe6cf;
	border-radius: 999px;
	padding: 3px 10px;
}
.pd-lib__intro {
	margin: 6px 0 10px;
	font-size: .85rem;
	color: var(--pd-muted);
	line-height: 1.45;
}
.pd-lib__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 12px;
}
.pd-lib__chip {
	font-size: .78rem;
	font-weight: 600;
	color: var(--pd-ink);
	background: var(--pd-soft);
	border: 1px solid var(--pd-line);
	border-radius: 999px;
	padding: 4px 10px;
}
.pd-lib__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px 12px;
}
.pd-lib__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}
.pd-lib__field--name { margin-top: 12px; }
.pd-lib__flabel {
	font-size: .78rem;
	font-weight: 600;
	color: var(--pd-ink);
}
.pd-req { color: var(--pd-red); }
.pd-lib__input {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	font-size: 16px; /* evita lo zoom su iOS */
	color: var(--pd-ink);
	background: var(--pd-surface);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius-sm);
	-webkit-appearance: none;
	appearance: none;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.pd-lib__input:focus {
	outline: none;
	border-color: var(--pd-red);
	box-shadow: 0 0 0 3px rgba(137,38,38,.12);
}
.pd-lib__minor-toggle {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 14px 0 0;
	font-size: .86rem;
	color: var(--pd-ink);
	cursor: pointer;
}
.pd-lib__minor-toggle input,
.pd-lib__decl input {
	margin-top: 2px;
	width: 18px;
	height: 18px;
	accent-color: var(--pd-red);
	flex: 0 0 auto;
}
.pd-lib__subtitle {
	margin: 12px 0 6px;
	font-size: .82rem;
	font-weight: 700;
	color: var(--pd-red);
}
.pd-lib__full {
	margin: 14px 0;
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius-sm);
	background: var(--pd-soft);
}
.pd-lib__full > summary {
	cursor: pointer;
	padding: 10px 12px;
	font-size: .82rem;
	font-weight: 600;
	color: var(--pd-red);
	list-style: none;
}
.pd-lib__full > summary::-webkit-details-marker { display: none; }
.pd-lib__full > summary::before { content: "▸ "; }
.pd-lib__full[open] > summary::before { content: "▾ "; }
.pd-lib__fulltext {
	max-height: 240px;
	overflow: auto;
	padding: 0 14px 12px;
	font-size: .78rem;
	line-height: 1.5;
	color: var(--pd-muted);
	white-space: pre-wrap;
	-webkit-overflow-scrolling: touch;
}
.pd-lib__decls {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 12px 0;
}
.pd-lib__decl {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: .82rem;
	line-height: 1.45;
	color: var(--pd-ink);
	cursor: pointer;
}
.pd-lib__signwrap { margin-top: 12px; }
.pd-lib__signlabel {
	display: block;
	font-size: .78rem;
	font-weight: 600;
	color: var(--pd-ink);
	margin-bottom: 6px;
}
.pd-lib__error {
	margin: 10px 0 0;
	color: var(--pd-red);
	font-size: .8rem;
	font-weight: 600;
}
.pd-lib__sign-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	margin-top: 12px;
	padding: 13px 18px;
	font-size: .92rem;
	font-weight: 700;
	color: #fff;
	background: var(--pd-red);
	border: none;
	border-radius: var(--pd-radius-sm);
	cursor: pointer;
	transition: filter .15s ease, transform .05s ease;
}
.pd-lib__sign-btn:hover { filter: brightness(1.06); }
.pd-lib__sign-btn:active { transform: translateY(1px); }
.pd-lib__sign-btn:disabled { opacity: .6; cursor: default; }
.pd-lib--signed .pd-lib__signed-info {
	margin: 8px 0 10px;
	font-size: .85rem;
	color: var(--pd-ink);
}
.pd-lib__edit {
	font-size: .8rem;
	font-weight: 600;
	color: var(--pd-red);
	background: var(--pd-soft);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius-sm);
	padding: 8px 14px;
	cursor: pointer;
}

/* Riquadro firma */
.pd-sign {
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius-sm);
	background: var(--pd-surface);
	overflow: hidden;
}
.pd-sign__canvas {
	display: block;
	width: 100%;
	height: 170px;
	background:
		linear-gradient(180deg, #fff 0%, #fff 100%);
	touch-action: none;          /* niente scroll mentre si firma */
	-ms-touch-action: none;
	cursor: crosshair;
	border-bottom: 1px dashed var(--pd-line);
}
.pd-sign__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 10px;
	background: var(--pd-soft);
}
.pd-sign__hint {
	font-size: .76rem;
	color: var(--pd-muted);
}
.pd-sign__clear {
	font-size: .78rem;
	font-weight: 600;
	color: var(--pd-red);
	background: transparent;
	border: 1px solid var(--pd-line);
	border-radius: 8px;
	padding: 6px 12px;
	cursor: pointer;
}
.pd-sign__clear:hover { background: #fff; }

@media (max-width: 560px) {
	.pd-lib { padding: 12px; }
	.pd-lib__grid { grid-template-columns: 1fr; }
	.pd-sign__canvas { height: 150px; }
}

/* Validazione puntuale liberatoria */
.pd-lib__input.is-error {
	border-color: var(--pd-red);
	background: #fdf4f4;
	box-shadow: 0 0 0 3px rgba(137,38,38,.10);
}
.pd-lib__decl.is-error {
	color: var(--pd-red);
}
.pd-lib__decl.is-error input {
	outline: 2px solid var(--pd-red);
	outline-offset: 1px;
	border-radius: 4px;
}
.pd-lib__signwrap.is-error .pd-sign {
	border-color: var(--pd-red);
	box-shadow: 0 0 0 3px rgba(137,38,38,.10);
}

/* Riga guida base nel riquadro firma (solo estetica, non finisce nel PNG) */
.pd-sign__canvas {
	background-color: #fff;
	background-image: linear-gradient(var(--pd-line), var(--pd-line));
	background-size: 86% 1px;
	background-position: 7% 74%;
	background-repeat: no-repeat;
}

/* Autocomplete comune */
.pd-ac { position: relative; }
.pd-ac__list {
	position: absolute;
	z-index: 30;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	margin: 0;
	padding: 4px;
	list-style: none;
	max-height: 220px;
	overflow-y: auto;
	background: var(--pd-surface);
	border: 1px solid var(--pd-line);
	border-radius: var(--pd-radius-sm);
	box-shadow: var(--pd-shadow);
	-webkit-overflow-scrolling: touch;
}
.pd-ac__item {
	display: flex;
	align-items: baseline;
	gap: 6px;
	padding: 9px 10px;
	font-size: .88rem;
	color: var(--pd-ink);
	border-radius: 8px;
	cursor: pointer;
}
.pd-ac__item:hover,
.pd-ac__item:active { background: var(--pd-soft); }
.pd-ac__name { font-weight: 600; }
.pd-ac__prov { color: var(--pd-muted); font-size: .82rem; }
.pd-ac__empty {
	padding: 9px 10px;
	font-size: .84rem;
	color: var(--pd-muted);
}
