/* UB Diritto di Recesso — Frontend Styles
   Ceucasale — conforme Art. 54-bis D.Lgs. 209/2025 */

/* ── Reset colori — sovrascrive temi che ereditano testo bianco ── */
.ub-recesso-wrap,
.ub-recesso-wrap *:not(input):not(textarea):not(select):not(button):not(a) {
	color: inherit;
}

.ub-recesso-wrap {
	max-width: 760px;
	color: #333;
}

.ub-recesso-wrap h3,
.ub-recesso-wrap h4,
.ub-recesso-wrap legend,
.ub-recesso-wrap label,
.ub-recesso-wrap p,
.ub-recesso-wrap td,
.ub-recesso-wrap th,
.ub-recesso-wrap span,
.ub-recesso-wrap small {
	color: #333;
}

.ub-recesso-wrap .description,
.ub-recesso-wrap small,
.ub-recesso-wrap em {
	color: #666;
}

.ub-recesso-wrap a {
	color: #0073aa;
}

/* Sfondo bianco esplicito su elementi che potrebbero ereditare sfondi scuri */
.ub-recesso-order-card {
	color: #333 !important;
}

.ub-recesso-modal-box {
	color: #333;
}

.ub-recesso-declaration {
	color: #333 !important;
}

.ub-recesso-consent-label {
	color: #333 !important;
}

/* ── Contenitore principale ── */
.ub-recesso-wrap {
	max-width: 760px;
}

.ub-recesso-info {
	margin-bottom: 24px;
}

/* ── Dati cliente ── */
.ub-recesso-customer-data {
	border: 1px solid #e5e5e5;
	border-radius: 4px;
	padding: 14px 18px;
	margin-bottom: 24px;
	background: #fafcff;
}

.ub-recesso-customer-data legend {
	font-weight: 600;
	padding: 0 6px;
	color: #333;
}

.ub-recesso-customer-row {
	display: flex;
	gap: 12px;
	margin-top: 6px;
	font-size: 14px;
}

.ub-recesso-label {
	font-weight: 600;
	min-width: 120px;
	color: #555;
}

/* ── Fieldset ordini ── */
.ub-recesso-fieldset {
	border: none;
	padding: 0;
	margin: 0;
}

.ub-recesso-fieldset legend {
	font-weight: 600;
	font-size: 15px;
	margin-bottom: 14px;
	color: #333;
}

/* ── Order cards ── */
.ub-recesso-orders {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 8px;
}

.ub-recesso-order-card {
	border: 2px solid #ddd;
	border-radius: 5px;
	padding: 12px 16px;
	background: #fafafa;
	transition: border-color .15s, background .15s;
}

/* :has() con fallback JS via classe aggiunta */
.ub-recesso-order-card:has(input[type="radio"]:checked),
.ub-recesso-order-card.is-selected {
	border-color: #0073aa;
	background: #f0f7fc;
}

.ub-recesso-order-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
	font-size: 14px;
}

.ub-recesso-order-label input[type="radio"] {
	margin-top: 3px;
	flex-shrink: 0;
	accent-color: #0073aa;
}

/* ── Item checkboxes ── */
.ub-recesso-items {
	margin: 10px 0 4px 24px;
	padding: 10px 12px;
	background: #fff;
	border: 1px dashed #ccc;
	border-radius: 4px;
}

.ub-recesso-items-label {
	margin: 0 0 8px;
	color: #666;
}

.ub-recesso-item-label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 4px 0;
	cursor: pointer;
	font-size: 14px;
}

.ub-recesso-item-label input[type="checkbox"] {
	margin-top: 3px;
	flex-shrink: 0;
	accent-color: #0073aa;
}

/* ── Pulsante principale ── */
.ub-recesso-btn {
	font-size: 15px !important;
	padding: 10px 22px !important;
}

/* ── Modale ── */
#ub-recesso-modal,
#ub-recesso-global-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Blocca scroll body quando modale è aperta */
body.ub-recesso-modal-open {
	overflow: hidden;
}

.ub-recesso-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .6);
	cursor: pointer;
}

.ub-recesso-modal-box {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 8px;
	padding: 28px 32px;
	max-width: 660px;
	width: 92%;
	max-height: 88vh;
	overflow-y: auto;
	box-shadow: 0 12px 48px rgba(0, 0, 0, .22);
}

/* ── Dichiarazione nella modale ── */
.ub-recesso-declaration {
	background: #f8f8f8;
	border: 1px solid #d5d5d5;
	border-left: 4px solid #0073aa;
	border-radius: 3px;
	padding: 14px 18px;
	font-size: 13px;
	line-height: 1.7;
	color: #333;
	margin: 16px 0;
	max-height: 260px;
	overflow-y: auto;
	scroll-behavior: smooth;
}

/* ── Link policy ── */
.ub-recesso-policy-links {
	font-size: 12px;
	color: #888;
	margin: 8px 0 14px;
}

.ub-recesso-policy-links a {
	color: #0073aa;
}

/* ── Checkbox consenso esplicito ── */
.ub-recesso-consent-wrap {
	background: #fffbea;
	border: 1px solid #f0c040;
	border-radius: 4px;
	padding: 12px 14px;
	margin: 16px 0;
}

.ub-recesso-consent-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
	font-size: 13px;
	line-height: 1.5;
}

.ub-recesso-consent-label input[type="checkbox"] {
	margin-top: 3px;
	flex-shrink: 0;
	accent-color: #c0392b;
	width: 16px;
	height: 16px;
}

/* ── Azioni modale ── */
.ub-recesso-modal-actions {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid #eee;
}

#ub-recesso-confirm {
	background: #c0392b !important;
	border-color: #a93226 !important;
	color: #fff !important;
}

#ub-recesso-confirm:hover:not([disabled]) {
	background: #a93226 !important;
}

#ub-recesso-confirm[disabled] {
	background: #ccc !important;
	border-color: #bbb !important;
	cursor: not-allowed !important;
	opacity: .65;
}

/* ── Pagina successo ── */
.ub-recesso-success {
	padding: 24px;
}

.ub-recesso-success h3 {
	margin-top: 0;
	color: #27ae60;
}

/* ── Responsive ── */
@media (max-width: 640px) {
	.ub-recesso-modal-box {
		padding: 20px 16px;
	}

	.ub-recesso-modal-actions {
		flex-direction: column-reverse;
	}

	.ub-recesso-modal-actions .button {
		width: 100%;
		text-align: center;
		justify-content: center;
	}

	.ub-recesso-customer-row {
		flex-direction: column;
		gap: 2px;
	}
}
