/**
 * Stili WordPress per RB_Consent: layout banner, tema dark/auto,
 * switch resilienti ai temi, pulsante galleggiante riapertura,
 * segnaposto embed bloccati e documenti Privacy/Cookie Policy.
 *
 * @package RB_Consent
 */

/* Banner: struttura pulita con .rbc-testo-banner e azioni resilienti ai temi WP */
.rbc-banner {
	box-sizing: border-box;
	flex-wrap: wrap;
}

.rbc-banner .rbc-testo-banner {
	flex: 1 1 320px;
	min-width: 0;
}

.rbc-banner .rbc-testo-banner .rbc-policy-links {
	margin: 0.35rem 0 0;
}

.rbc-banner > .rbc-azioni {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
}

.rbc-banner .rbc-pulsante,
.rbc-modale .rbc-pulsante {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	line-height: 1.25;
	text-decoration: none;
}

.rbc-banner .rbc-pulsante-icona {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	min-width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	line-height: 1;
	color: var(--rbc-text, #172033);
	background: var(--rbc-surface, #ffffff);
	border: 1px solid var(--rbc-border, #cbd5e1);
}

.rbc-modale .rbc-chiudi-modale {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	color: var(--rbc-muted, #4b5563);
	background: transparent;
	border: 0;
	border-radius: 6px;
	line-height: 1;
}

.rbc-modale .rbc-chiudi-modale:hover {
	color: var(--rbc-text, #172033);
	background: rgba(148, 163, 184, 0.16);
}

/* Switch modale: alta specificità per evitare override dai temi WordPress */
.rbc-modale input[type="checkbox"].rbc-switch {
	appearance: none !important;
	-webkit-appearance: none !important;
	position: relative;
	flex: 0 0 auto;
	width: 2.75rem;
	min-width: 2.75rem;
	height: 1.5rem;
	padding: 0;
	margin: 0;
	box-sizing: border-box;
	border: 1px solid var(--rbc-border, #cbd5e1);
	border-radius: 999px;
	background: var(--rbc-muted, #4b5563);
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.rbc-modale input[type="checkbox"].rbc-switch::before {
	content: none !important;
	display: none !important;
}

.rbc-modale input[type="checkbox"].rbc-switch::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 0.18rem;
	width: 1.05rem;
	height: 1.05rem;
	border-radius: 50%;
	background: var(--rbc-surface, #ffffff);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	transform: translateY(-50%);
	transition: transform 0.15s ease;
}

.rbc-modale input[type="checkbox"].rbc-switch:checked {
	border-color: var(--rbc-accent, #2457d6);
	background: var(--rbc-accent, #2457d6);
}

.rbc-modale input[type="checkbox"].rbc-switch:checked::after {
	transform: translate(1.22rem, -50%);
}

.rbc-modale input[type="checkbox"].rbc-switch:disabled {
	cursor: not-allowed;
	opacity: 0.72;
}

/* Pulsante galleggiante di riapertura preferenze (tutti i 5 stili) */
button.rbc-riapri-preferenze {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	box-sizing: border-box;
	color: var(--rbc-accent-contrast, #ffffff);
	background: var(--rbc-accent, #2457d6);
	border: 1px solid var(--rbc-accent, #2457d6);
	box-shadow: var(--rbc-shadow, 0 12px 30px rgba(15, 23, 42, 0.22));
	font-family: var(--rbc-font-family, Arial, Helvetica, sans-serif);
	font-size: var(--rbc-font-size, 0.9rem);
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button.rbc-riapri-preferenze:hover {
	transform: translateY(-2px);
	color: var(--rbc-accent-contrast, #ffffff);
	background: var(--rbc-accent, #2457d6);
	opacity: 0.94;
}

button.rbc-riapri-preferenze svg {
	width: 1.5rem;
	height: 1.5rem;
	display: block;
	flex: 0 0 auto;
}

button.rbc-riapri-preferenze.rbc-riapri-preferenze-bottom-right,
button.rbc-riapri-preferenze.rbc-riapri-preferenze-bottom-left {
	padding: 0.65rem 1rem;
	border-radius: max(var(--rbc-radius, 8px), 6px);
}

/* Varianti layout banner */
.rbc-banner.rbc-wp-layout-top-banner {
	top: 0;
	bottom: auto;
}

.rbc-banner.rbc-wp-layout-floating-card-left {
	right: auto;
	left: var(--rbc-left, 1.25rem);
	bottom: var(--rbc-bottom, 1.25rem);
	max-width: min(var(--rbc-max-width, 540px), calc(100vw - 2rem));
	flex-direction: column;
	align-items: stretch;
	gap: 0.9rem;
}

.rbc-banner.rbc-wp-layout-floating-card-right {
	left: auto;
	right: var(--rbc-right, 1.25rem);
	bottom: var(--rbc-bottom, 1.25rem);
	max-width: min(var(--rbc-max-width, 540px), calc(100vw - 2rem));
	flex-direction: column;
	align-items: stretch;
	gap: 0.9rem;
}

.rbc-banner.rbc-wp-layout-floating-card-left .rbc-testo-banner,
.rbc-banner.rbc-wp-layout-floating-card-right .rbc-testo-banner {
	flex: 0 0 auto;
}

/* Supporto Tema Dark esplicito o Automatico */
.rbc-wp-theme-dark {
	--rbc-surface: #0f172a;
	--rbc-text: #f8fafc;
	--rbc-muted: #cbd5e1;
	--rbc-border: #334155;
	--rbc-soft-border: #1e293b;
	--rbc-strong-border: #38bdf8;
}

@media (prefers-color-scheme: dark) {
	.rbc-wp-theme-auto {
		--rbc-surface: #0f172a;
		--rbc-text: #f8fafc;
		--rbc-muted: #cbd5e1;
		--rbc-border: #334155;
		--rbc-soft-border: #1e293b;
		--rbc-strong-border: #38bdf8;
	}
}

/* Segnaposto per Iframe / Embed bloccati */
.rbc-wp-iframe-blocked {
	display: none !important;
}

.rbc-wp-embed-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 0.65rem;
	padding: 1.75rem 1.25rem;
	margin: 1rem 0;
	border: 1px dashed var(--rbc-border, #cbd5e1);
	border-radius: var(--rbc-radius, 10px);
	background: var(--rbc-surface, #f8fafc);
	color: var(--rbc-text, #1e293b);
}

.rbc-wp-embed-placeholder p {
	margin: 0;
	max-width: 48ch;
	color: var(--rbc-muted, #475569);
	font-size: 0.95em;
}

.rbc-wp-embed-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
}

.rbc-wp-embed-allow-btn,
.rbc-wp-pref-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.5rem;
	padding: 0.55rem 1.1rem;
	border: 1px solid var(--rbc-accent, #2457d6);
	border-radius: 6px;
	background: var(--rbc-accent, #2457d6);
	color: var(--rbc-accent-contrast, #ffffff);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.rbc-wp-embed-pref-btn {
	min-height: 2.5rem;
	padding: 0.55rem 1rem;
	border: 1px solid var(--rbc-border, #cbd5e1);
	border-radius: 6px;
	background: transparent;
	color: var(--rbc-text, #1e293b);
	font: inherit;
	cursor: pointer;
}

/* Documenti Privacy & Cookie Policy generati da Shortcode */
.rbc-wp-policy-doc {
	line-height: 1.65;
}

.rbc-wp-policy-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem 2rem;
	padding: 0.85rem 1rem;
	margin-bottom: 1.5rem;
	background: rgba(148, 163, 184, 0.12);
	border-left: 4px solid var(--rbc-accent, #2457d6);
	border-radius: 6px;
	font-size: 0.92em;
}

.rbc-wp-policy-section {
	margin-bottom: 1.75rem;
}

.rbc-wp-categories-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
	gap: 1rem;
	margin-top: 0.75rem;
}

.rbc-wp-cat-card {
	padding: 1rem;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
}

.rbc-wp-cat-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.4rem;
}

.rbc-wp-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 0.78em;
	font-weight: 600;
	background: #e2e8f0;
	color: #1e293b;
}

.rbc-wp-badge.is-required {
	background: #dcfce7;
	color: #166534;
}

.rbc-wp-table-wrap {
	overflow-x: auto;
	margin-top: 0.75rem;
}

.rbc-wp-services-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92em;
}

.rbc-wp-services-table th,
.rbc-wp-services-table td {
	padding: 0.75rem;
	border: 1px solid #cbd5e1;
	text-align: left;
	vertical-align: top;
}

.rbc-wp-services-table th {
	background: rgba(148, 163, 184, 0.14);
	font-weight: 700;
}
