/* Pulsante */
.wpdm-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(128, 128, 128, 0.45);
	border-radius: 50%;
	background: #fff;
	color: #222;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	line-height: 1;
	transition: transform 0.15s ease, background-color 0.2s ease, color 0.2s ease;
}

.wpdm-toggle:hover,
.wpdm-toggle:focus-visible {
	transform: scale(1.08);
	background: #fff;
	color: #222;
}

.wpdm-toggle:focus-visible {
	outline: 2px solid #57ad68;
	outline-offset: 2px;
}

.wpdm-toggle .wpdm-icon-sun {
	display: none;
}

html[data-wpdm-theme="dark"] .wpdm-toggle {
	background: #2a2a2a;
	color: #ffd666;
	border-color: #555;
}

html[data-wpdm-theme="dark"] .wpdm-toggle:hover,
html[data-wpdm-theme="dark"] .wpdm-toggle:focus-visible {
	background: #333;
	color: #ffd666;
}

html[data-wpdm-theme="dark"] .wpdm-toggle .wpdm-icon-sun {
	display: block;
}

html[data-wpdm-theme="dark"] .wpdm-toggle .wpdm-icon-moon {
	display: none;
}

.wpdm-floating {
	position: fixed;
	z-index: 99999;
}

.wpdm-pos-bottom-right { right: 20px; bottom: 20px; }
.wpdm-pos-bottom-left { left: 20px; bottom: 20px; }
.wpdm-pos-top-right { right: 20px; top: 20px; }
.wpdm-pos-top-left { left: 20px; top: 20px; }

body.admin-bar .wpdm-pos-top-right,
body.admin-bar .wpdm-pos-top-left {
	top: 52px;
}

@media (prefers-reduced-motion: reduce) {
	.wpdm-toggle {
		transition: none;
	}
}

html[data-wpdm-theme="light"] {
	color-scheme: light;
}

/* Tema scuro */
html[data-wpdm-theme="dark"] {
	color-scheme: dark;
	--wpdm-bg: #121212;
	--wpdm-surface: #1c1c1e;
	--wpdm-surface-2: #26262a;
	--wpdm-border: #3a3a3f;
	--wpdm-text: #e6e6e6;
	--wpdm-muted: #a8a8ad;
	--wpdm-link: #ffffff;
	--wpdm-accent: #57ad68;
}

html[data-wpdm-theme="dark"],
html[data-wpdm-theme="dark"] body,
html[data-wpdm-theme="dark"] .site,
html[data-wpdm-theme="dark"] #page,
html[data-wpdm-theme="dark"] .site-header,
html[data-wpdm-theme="dark"] .site-content,
html[data-wpdm-theme="dark"] .site-footer,
html[data-wpdm-theme="dark"] .site-main,
html[data-wpdm-theme="dark"] .hentry,
html[data-wpdm-theme="dark"] .widget {
	background-color: var(--wpdm-bg) !important;
	color: var(--wpdm-text) !important;
}

html[data-wpdm-theme="dark"] body,
html[data-wpdm-theme="dark"] p,
html[data-wpdm-theme="dark"] li,
html[data-wpdm-theme="dark"] td,
html[data-wpdm-theme="dark"] th,
html[data-wpdm-theme="dark"] dt,
html[data-wpdm-theme="dark"] dd,
html[data-wpdm-theme="dark"] label,
html[data-wpdm-theme="dark"] figcaption,
html[data-wpdm-theme="dark"] h1,
html[data-wpdm-theme="dark"] h2,
html[data-wpdm-theme="dark"] h3,
html[data-wpdm-theme="dark"] h4,
html[data-wpdm-theme="dark"] h5,
html[data-wpdm-theme="dark"] h6,
html[data-wpdm-theme="dark"] .site-title a,
html[data-wpdm-theme="dark"] .site-description,
html[data-wpdm-theme="dark"] .entry-title,
html[data-wpdm-theme="dark"] .entry-title a,
html[data-wpdm-theme="dark"] .entry-content,
html[data-wpdm-theme="dark"] .entry-summary,
html[data-wpdm-theme="dark"] .comment-respond {
	color: var(--wpdm-text) !important;
}

html[data-wpdm-theme="dark"] .entry-meta,
html[data-wpdm-theme="dark"] .entry-meta a,
html[data-wpdm-theme="dark"] .site-info,
html[data-wpdm-theme="dark"] .site-footer,
html[data-wpdm-theme="dark"] .comment-metadata,
html[data-wpdm-theme="dark"] .wp-caption-text {
	color: var(--wpdm-muted) !important;
}

html[data-wpdm-theme="dark"] a,
html[data-wpdm-theme="dark"] a:visited,
html[data-wpdm-theme="dark"] .entry-content a,
html[data-wpdm-theme="dark"] .entry-summary a,
html[data-wpdm-theme="dark"] .post-excerpts .entry-content a,
html[data-wpdm-theme="dark"] .post-excerpts .entry-summary a,
html[data-wpdm-theme="dark"] .read-more a {
	color: var(--wpdm-link) !important;
}

html[data-wpdm-theme="dark"] a:hover,
html[data-wpdm-theme="dark"] a:focus,
html[data-wpdm-theme="dark"] .entry-title a:hover,
html[data-wpdm-theme="dark"] .entry-meta a:hover,
html[data-wpdm-theme="dark"] .site-footer a:hover {
	color: var(--wpdm-accent) !important;
}

/* Bordi e separatori */
html[data-wpdm-theme="dark"] hr,
html[data-wpdm-theme="dark"] .blog hr.footnotes,
html[data-wpdm-theme="dark"] .archive hr.footnotes {
	background-color: var(--wpdm-border) !important;
	border-color: var(--wpdm-border) !important;
}

html[data-wpdm-theme="dark"] blockquote,
html[data-wpdm-theme="dark"] .entry-header,
html[data-wpdm-theme="dark"] .entry-meta,
html[data-wpdm-theme="dark"] .site-footer,
html[data-wpdm-theme="dark"] table,
html[data-wpdm-theme="dark"] th,
html[data-wpdm-theme="dark"] td {
	border-color: var(--wpdm-border) !important;
}

/* Superfici secondarie */
html[data-wpdm-theme="dark"] pre,
html[data-wpdm-theme="dark"] code,
html[data-wpdm-theme="dark"] kbd,
html[data-wpdm-theme="dark"] tt,
html[data-wpdm-theme="dark"] var,
html[data-wpdm-theme="dark"] .site-main article.sticky,
html[data-wpdm-theme="dark"] .format-chat .entry-content,
html[data-wpdm-theme="dark"] .format-chat .entry-summary,
html[data-wpdm-theme="dark"] .comment-respond,
html[data-wpdm-theme="dark"] .commentlist .comment-respond,
html[data-wpdm-theme="dark"] .archive .page-header,
html[data-wpdm-theme="dark"] .search .page-header,
html[data-wpdm-theme="dark"] .wp-block-table thead,
html[data-wpdm-theme="dark"] .wp-block-code,
html[data-wpdm-theme="dark"] .wp-block-preformatted {
	background-color: var(--wpdm-surface) !important;
	color: var(--wpdm-text) !important;
	border-color: var(--wpdm-border) !important;
}

html[data-wpdm-theme="dark"] pre code {
	background: transparent !important;
}

html[data-wpdm-theme="dark"] mark,
html[data-wpdm-theme="dark"] ins {
	background-color: #5c5200 !important;
	color: #fff !important;
}

/* Form */
html[data-wpdm-theme="dark"] input[type="text"],
html[data-wpdm-theme="dark"] input[type="email"],
html[data-wpdm-theme="dark"] input[type="url"],
html[data-wpdm-theme="dark"] input[type="search"],
html[data-wpdm-theme="dark"] input[type="password"],
html[data-wpdm-theme="dark"] input[type="number"],
html[data-wpdm-theme="dark"] select,
html[data-wpdm-theme="dark"] textarea {
	background-color: var(--wpdm-surface-2) !important;
	color: var(--wpdm-text) !important;
	border-color: var(--wpdm-border) !important;
}

html[data-wpdm-theme="dark"] ::placeholder {
	color: var(--wpdm-muted);
}

/* Pulsanti del tema (il toggle è escluso) */
html[data-wpdm-theme="dark"] button:not(.wpdm-toggle):not(.mega-toggle-animated),
html[data-wpdm-theme="dark"] input[type="button"],
html[data-wpdm-theme="dark"] input[type="reset"],
html[data-wpdm-theme="dark"] input[type="submit"] {
	background: var(--wpdm-surface-2) !important;
	color: var(--wpdm-text) !important;
	border: 1px solid var(--wpdm-border) !important;
}

html[data-wpdm-theme="dark"] button:not(.wpdm-toggle):not(.mega-toggle-animated):hover,
html[data-wpdm-theme="dark"] input[type="button"]:hover,
html[data-wpdm-theme="dark"] input[type="reset"]:hover,
html[data-wpdm-theme="dark"] input[type="submit"]:hover {
	background: var(--wpdm-accent) !important;
	color: #fff !important;
}

/* Max Mega Menu */
html[data-wpdm-theme="dark"] #mega-menu-wrap-primary,
html[data-wpdm-theme="dark"] #mega-menu-wrap-primary #mega-menu-primary,
html[data-wpdm-theme="dark"] #mega-menu-wrap-primary .mega-menu-toggle,
html[data-wpdm-theme="dark"] #mega-menu-wrap-primary .mega-menu-toggle + #mega-menu-primary {
	background: var(--wpdm-bg) !important;
}

html[data-wpdm-theme="dark"] #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link,
html[data-wpdm-theme="dark"] #mega-menu-wrap-primary #mega-menu-primary li.mega-menu-item a.mega-menu-link {
	color: var(--wpdm-text) !important;
	background: transparent !important;
}

html[data-wpdm-theme="dark"] #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item > a.mega-menu-link:hover,
html[data-wpdm-theme="dark"] #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-toggle-on > a.mega-menu-link,
html[data-wpdm-theme="dark"] #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-item.mega-current-menu-item > a.mega-menu-link {
	background: var(--wpdm-surface-2) !important;
	color: var(--wpdm-link) !important;
}

html[data-wpdm-theme="dark"] #mega-menu-wrap-primary #mega-menu-primary ul.mega-sub-menu,
html[data-wpdm-theme="dark"] #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-flyout ul.mega-sub-menu li.mega-menu-item a.mega-menu-link {
	background: var(--wpdm-surface) !important;
	color: var(--wpdm-text) !important;
}

html[data-wpdm-theme="dark"] #mega-menu-wrap-primary #mega-menu-primary > li.mega-menu-flyout ul.mega-sub-menu li.mega-menu-item a.mega-menu-link:hover {
	background: var(--wpdm-surface-2) !important;
}

html[data-wpdm-theme="dark"] #mega-menu-wrap-primary #mega-menu-primary ul.mega-sub-menu li.mega-menu-item a,
html[data-wpdm-theme="dark"] #mega-menu-wrap-primary #mega-menu-primary ul.mega-sub-menu li.mega-menu-column-standard a {
	color: var(--wpdm-text) !important;
}

html[data-wpdm-theme="dark"] #mega-menu-wrap-primary .mega-menu-toggle .mega-toggle-animated-inner,
html[data-wpdm-theme="dark"] #mega-menu-wrap-primary .mega-menu-toggle .mega-toggle-animated-inner::before,
html[data-wpdm-theme="dark"] #mega-menu-wrap-primary .mega-menu-toggle .mega-toggle-animated-inner::after {
	background-color: var(--wpdm-text) !important;
}

/* Icone social (colorate di nero dal CSS personalizzato del sito) */
html[data-wpdm-theme="dark"] #menu-social li a::before {
	color: var(--wpdm-text) !important;
}

/* Immagini e media */
html[data-wpdm-theme="dark"] img:not(.no-grav):not([src$=".svg"]),
html[data-wpdm-theme="dark"] video {
	filter: brightness(0.85) contrast(1.05);
}

/* Cookie banner iubenda */
html[data-wpdm-theme="dark"] #iubenda-cs-banner .iubenda-cs-container .iubenda-cs-content {
	background-color: var(--wpdm-surface) !important;
	color: var(--wpdm-text) !important;
}

html[data-wpdm-theme="dark"] #iubenda-cs-banner .iubenda-cs-container .iubenda-cs-content * {
	color: var(--wpdm-text) !important;
}

/* Il pulsante di tema non deve ereditare le regole sui button del tema */
html[data-wpdm-theme="dark"] .wpdm-toggle,
html[data-wpdm-theme="dark"] .wpdm-toggle:hover,
html[data-wpdm-theme="dark"] .wpdm-toggle:focus {
	color: #ffd666 !important;
}
