/*!
 * DG Encuestas — estilos públicos
 * Todo se puede sobrescribir con variables CSS o desde el widget de Elementor.
 */
.dgenc {
	--dgenc-primary: var(--dgenc-primary-global, #2563eb);
	--dgenc-indicator: var(--dgenc-primary);
	--dgenc-text: inherit;
	--dgenc-muted: #6b7280;
	--dgenc-border: #e5e7eb;
	--dgenc-surface: #ffffff;
	--dgenc-soft: rgba(37, 99, 235, 0.08);
	--dgenc-error: #dc2626;
	--dgenc-radius: 12px;
	--dgenc-question-gap: 28px;
	--dgenc-image-height: 180px;
	--dgenc-image-width: 72px;
	--dgenc-bar-height: 10px;
	--dgenc-bar-radius: 999px;

	position: relative;
	box-sizing: border-box;
	color: var(--dgenc-text);
	background: var(--dgenc-surface);
	border: 1px solid var(--dgenc-border);
	border-radius: 16px;
	padding: clamp(18px, 3vw, 28px);
}

@supports (background: color-mix(in srgb, red 10%, white)) {
	.dgenc { --dgenc-soft: color-mix(in srgb, var(--dgenc-primary) 9%, transparent); }
}

.dgenc *,
.dgenc *::before,
.dgenc *::after { box-sizing: border-box; }
.dgenc [hidden] { display: none !important; }

/* ---------- Encabezado ---------- */
.dgenc__header { margin-bottom: 20px; }
.dgenc__title { margin: 0 0 8px; line-height: 1.25; }
.dgenc__description { color: var(--dgenc-muted); }
.dgenc__description > :last-child { margin-bottom: 0; }
.dgenc__countdown {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	margin-top: 12px;
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--dgenc-soft);
	color: var(--dgenc-primary);
	font-size: 0.875em;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* ---------- Preguntas ---------- */
.dgenc__form { display: flex; flex-direction: column; gap: var(--dgenc-question-gap); }
.dgenc__question { margin: 0; padding: 0; border: 0; min-width: 0; }
.dgenc__question-title {
	display: block;
	width: 100%;
	margin: 0 0 6px;
	padding: 0;
	font-size: 1.05em;
	font-weight: 600;
	line-height: 1.35;
}
.dgenc__required { color: var(--dgenc-error); }
.dgenc__question-help { margin: 0 0 12px; color: var(--dgenc-muted); font-size: 0.875em; }
.dgenc__question-title + .dgenc__choices { margin-top: 10px; }
.dgenc__question-error { margin: 8px 0 0; color: var(--dgenc-error); font-size: 0.875em; }

/* ---------- Opciones ---------- */
.dgenc__choices { display: flex; flex-direction: column; gap: 10px; }
.dgenc--layout-grid .dgenc__choices {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
}

.dgenc__choice {
	position: relative;
	display: flex;
	flex-direction: column;
	margin: 0;
	cursor: pointer;
	border: 1px solid transparent;
	border-radius: var(--dgenc-radius);
	overflow: hidden;
	transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease, transform .2s ease;
	-webkit-tap-highlight-color: transparent;
}
.dgenc__input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}
.dgenc__choice-body {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	min-height: 48px;
}
.dgenc__choice-label { line-height: 1.35; overflow-wrap: anywhere; }

.dgenc__indicator {
	position: relative;
	flex: 0 0 20px;
	width: 20px;
	height: 20px;
	border: 2px solid #c4c9d2;
	border-radius: 50%;
	background: #fff;
	transition: border-color .2s ease, background-color .2s ease;
}
.dgenc__question[data-type="multiple"] .dgenc__indicator { border-radius: 6px; }
.dgenc__indicator::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	transform: scale(0);
	transition: transform .18s ease;
}
.dgenc__question[data-type="single"] .dgenc__indicator::after,
.dgenc__choice--other .dgenc__indicator::after {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--dgenc-indicator);
}
.dgenc__question[data-type="multiple"] .dgenc__indicator::after {
	width: 10px;
	height: 6px;
	border-left: 2px solid #fff;
	border-bottom: 2px solid #fff;
	transform: translateY(-1px) rotate(-45deg) scale(0);
}
.dgenc__choice.is-selected .dgenc__indicator { border-color: var(--dgenc-indicator); }
.dgenc__question[data-type="single"] .dgenc__choice.is-selected .dgenc__indicator::after { transform: scale(1); }
.dgenc__question[data-type="multiple"] .dgenc__choice.is-selected .dgenc__indicator { background: var(--dgenc-indicator); }
.dgenc__question[data-type="multiple"] .dgenc__choice.is-selected .dgenc__indicator::after { transform: translateY(-1px) rotate(-45deg) scale(1); }

.dgenc__choice:focus-within { outline: 2px solid var(--dgenc-primary); outline-offset: 2px; }
.dgenc__choice:focus-within:not(:has(:focus-visible)) { outline: none; }

/* Estilo: tarjetas */
.dgenc--style-boxed .dgenc__choice { border-color: var(--dgenc-border); background: var(--dgenc-surface); }
.dgenc--style-boxed .dgenc__choice:hover { border-color: var(--dgenc-primary); }
.dgenc--style-boxed .dgenc__choice.is-selected {
	border-color: var(--dgenc-primary);
	background: var(--dgenc-soft);
	box-shadow: 0 0 0 1px var(--dgenc-primary) inset;
}

/* Estilo: clásico */
.dgenc--style-classic .dgenc__choices { gap: 4px; }
.dgenc--style-classic .dgenc__choice-body { padding: 6px 2px; min-height: 0; }
.dgenc--style-classic .dgenc__choice:hover .dgenc__indicator { border-color: var(--dgenc-primary); }

/* Estilo: botones */
.dgenc--style-buttons.dgenc--layout-list .dgenc__choices { flex-direction: row; flex-wrap: wrap; }
.dgenc--style-buttons .dgenc__choice { border-color: var(--dgenc-border); border-radius: 999px; background: var(--dgenc-surface); }
.dgenc--style-buttons .dgenc__choice--has-image { border-radius: var(--dgenc-radius); }
.dgenc--style-buttons .dgenc__indicator { display: none; }
.dgenc--style-buttons .dgenc__choice-body { justify-content: center; text-align: center; padding: 10px 20px; }
.dgenc--style-buttons .dgenc__choice:hover { border-color: var(--dgenc-primary); }
.dgenc--style-buttons .dgenc__choice.is-selected { background: var(--dgenc-primary); border-color: var(--dgenc-primary); }
.dgenc--style-buttons .dgenc__choice.is-selected .dgenc__choice-label { color: #fff; }

/* Imágenes */
.dgenc__choice-media { display: block; overflow: hidden; background: #f3f4f6; }
.dgenc__choice-media img {
	display: block;
	width: 100%;
	height: var(--dgenc-image-height);
	object-fit: cover;
	transition: transform .35s ease;
}
.dgenc__choice:hover .dgenc__choice-media img { transform: scale(1.05); }
.elementor-widget-dgenc-poll:not(.dgenc-zoom-yes) .dgenc__choice:hover .dgenc__choice-media img { transform: none; }

.dgenc--img-left .dgenc__choice--has-image { flex-direction: row; align-items: stretch; }
.dgenc--img-left .dgenc__choice--has-image .dgenc__choice-media { flex: 0 0 var(--dgenc-image-width); }
.dgenc--img-left .dgenc__choice--has-image .dgenc__choice-media img { height: 100%; min-height: var(--dgenc-image-width); }
.dgenc--img-left .dgenc__choice--has-image .dgenc__choice-body { flex: 1; }

/* "Otra" */
.dgenc__other-input { margin-top: 2px; }

/* ---------- Campos ---------- */
.dgenc__fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.dgenc__field { display: flex; flex-direction: column; gap: 6px; }
.dgenc__field-label { font-weight: 600; font-size: 0.9em; }
.dgenc__field-input {
	width: 100%;
	padding: 10px 12px;
	font: inherit;
	color: inherit;
	background: var(--dgenc-surface);
	border: 1px solid var(--dgenc-border);
	border-radius: 10px;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.dgenc__field-input:focus { outline: none; border-color: var(--dgenc-primary); box-shadow: 0 0 0 3px var(--dgenc-soft); }
.dgenc__field-input.has-error { border-color: var(--dgenc-error); }
.dgenc__consent { grid-column: 1 / -1; display: flex; gap: 10px; align-items: flex-start; font-size: 0.9em; cursor: pointer; }
.dgenc__consent input { margin-top: 3px; accent-color: var(--dgenc-primary); }
.dgenc__consent.has-error { color: var(--dgenc-error); }

/* Honeypot */
.dgenc__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Botones ---------- */
.dgenc__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 4px; }
.dgenc__results .dgenc__actions { margin-top: 18px; }
.dgenc__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 28px;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	background: var(--dgenc-primary);
	border: 1px solid transparent;
	border-radius: 10px;
	cursor: pointer;
	transition: filter .2s ease, transform .1s ease, box-shadow .2s ease, background-color .2s ease;
}
.dgenc__button:hover { filter: brightness(1.08); }
.dgenc__button:active { transform: translateY(1px); }
.dgenc__button:focus-visible { outline: 2px solid var(--dgenc-primary); outline-offset: 3px; }
.dgenc__button[disabled] { opacity: .65; cursor: progress; }
.dgenc__button.is-loading::before {
	content: "";
	width: 1em;
	height: 1em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: dgenc-spin .7s linear infinite;
}
.dgenc-btn-full-yes .dgenc__button { width: 100%; } /* Compatibilidad con versiones anteriores. */
.dgenc__share-label { flex: 0 0 auto; }
.dgenc__link { box-sizing: border-box; }

.dgenc__link {
	padding: 4px 0;
	font: inherit;
	font-size: 0.925em;
	color: var(--dgenc-primary);
	background: none;
	border: 0;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}
.dgenc__link:hover { text-decoration-thickness: 2px; }

/* ---------- Resultados ---------- */
.dgenc__results-body { display: flex; flex-direction: column; gap: var(--dgenc-question-gap); }
.dgenc__result-list { display: flex; flex-direction: column; gap: 14px; margin: 10px 0 0; padding: 0; list-style: none; }
.dgenc__result { margin: 0; padding: 0; }
.dgenc__result-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.dgenc__result-label { display: inline-flex; align-items: center; gap: 10px; min-width: 0; overflow-wrap: anywhere; }
.dgenc__result-thumb { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; flex: 0 0 32px; }
.dgenc__result-value { display: inline-flex; gap: 6px; align-items: baseline; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dgenc__result-percent { font-weight: 700; }
.dgenc__result-votes { color: var(--dgenc-muted); font-size: 0.85em; }
.dgenc__result-percent + .dgenc__result-votes::before { content: "("; }
.dgenc__result-percent + .dgenc__result-votes::after { content: ")"; }
.dgenc__result.is-leading .dgenc__result-label { font-weight: 700; }

.dgenc__bar {
	position: relative;
	height: var(--dgenc-bar-height);
	background: #eef0f3;
	border-radius: var(--dgenc-bar-radius);
	overflow: hidden;
}
.dgenc__bar-fill {
	display: block;
	height: 100%;
	width: 0;
	background: var(--dgenc-choice-color, var(--dgenc-primary));
	border-radius: inherit;
	transition: width .9s cubic-bezier(.22, 1, .36, 1);
}
.elementor-widget-dgenc-poll:not(.dgenc-anim-yes) .dgenc__bar-fill { transition: none; }

.dgenc__total { margin: 0; color: var(--dgenc-muted); font-size: 0.9em; }

/* ---------- Mensajes ---------- */
/* Los <p> internos heredan tipografía y color del contenedor para que el tema no los pise. */
.dgenc .dgenc__thanks p,
.dgenc .dgenc__hidden-results p,
.dgenc .dgenc__description p,
.dgenc p.dgenc__question-title {
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	font-style: inherit;
	line-height: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	color: inherit;
}
.dgenc .dgenc__thanks p,
.dgenc .dgenc__hidden-results p { margin: 0 0 .5em; }
/* Márgenes propios con más especificidad que los estilos de párrafo del tema. */
.dgenc p.dgenc__question-title { margin: 0 0 6px; }
.dgenc p.dgenc__question-help { margin: 0 0 12px; }
.dgenc p.dgenc__total { margin: 0; }
.dgenc .dgenc__description p { margin: 0 0 .5em; }
.dgenc .dgenc__description p:last-child,
.dgenc .dgenc__thanks p:last-child,
.dgenc .dgenc__hidden-results p:last-child { margin-bottom: 0; }
.dgenc .dgenc__result-list { margin: 10px 0 0; padding: 0; }
.dgenc__notice,
.dgenc__thanks,
.dgenc__hidden-results {
	margin: 0 0 18px;
	padding: 12px 16px;
	border-radius: 10px;
	background: var(--dgenc-soft);
}
.dgenc__thanks > :first-child,
.dgenc__hidden-results > :first-child { margin-top: 0; }
.dgenc__thanks > :last-child,
.dgenc__hidden-results > :last-child { margin-bottom: 0; }
.dgenc__notice.is-error { color: var(--dgenc-error); background: rgba(220, 38, 38, .08); }
.dgenc__hidden-results { margin: 0; }

/* ---------- Compartir ---------- */
.dgenc__share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--dgenc-border); }
.dgenc__share-label { color: var(--dgenc-muted); font-size: 0.875em; margin-right: 4px; }
.dgenc__share { --dgenc-share-icon: 1.1em; }
.dgenc__share-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .45em;
	padding: 6px 14px;
	font: inherit;
	font-size: 0.85em;
	font-weight: 600;
	line-height: 1.2;
	color: var(--dgenc-text);
	background: #f3f4f6;
	border: 0;
	border-radius: 999px;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease, transform .15s ease, filter .2s ease;
}
.dgenc__share-btn:hover { background: var(--dgenc-primary); color: #fff; }
.dgenc__share-icon { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.dgenc__share-icon i { font-size: var(--dgenc-share-icon); }
.dgenc__share-icon svg { width: var(--dgenc-share-icon); height: var(--dgenc-share-icon); fill: currentColor; }
.dgenc__share-btn--icon-only { width: 38px; height: 38px; padding: 0; border-radius: 50%; }
/* Ancho por dispositivo (control "Ancho de los botones de compartir"). */
.dgenc__share-btn { white-space: nowrap; width: var(--dgenc-sbtn-w, auto); flex: var(--dgenc-sbtn-flex, 0 0 auto); }
.dgenc__share-btn--icon-only { width: var(--dgenc-sbtn-w, 38px); }
.dgenc__share-label { flex-basis: var(--dgenc-slabel-basis, auto); }
.dgenc__share-btn.is-copied { background: #16a34a; color: #fff; }

/* Colores oficiales (switch del widget). */
.dgenc-share-brand-yes .dgenc__share-btn { color: #fff; }
.dgenc-share-brand-yes .dgenc__share-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.dgenc-share-brand-yes .dgenc__share-btn--whatsapp { background: #25d366; }
.dgenc-share-brand-yes .dgenc__share-btn--facebook { background: #1877f2; }
.dgenc-share-brand-yes .dgenc__share-btn--x { background: #000; }
.dgenc-share-brand-yes .dgenc__share-btn--telegram { background: #26a5e4; }
.dgenc-share-brand-yes .dgenc__share-btn--linkedin { background: #0a66c2; }
.dgenc-share-brand-yes .dgenc__share-btn--email { background: #6b7280; }
.dgenc-share-brand-yes .dgenc__share-btn--copy { background: var(--dgenc-primary); }

/* ---------- Estados ---------- */
.dgenc__question.has-error .dgenc__question-title { color: var(--dgenc-error); }
.dgenc__question.has-error .dgenc__choice { border-color: var(--dgenc-error); }
.dgenc.is-preview::after {
	content: attr(data-preview-note);
	display: block;
	margin-top: 14px;
	font-size: 12px;
	color: var(--dgenc-muted);
	text-align: center;
}
.dgenc-placeholder {
	padding: 24px;
	text-align: center;
	color: #6b7280;
	border: 2px dashed #d1d5db;
	border-radius: 12px;
	background: #f9fafb;
}

@keyframes dgenc-spin { to { transform: rotate(360deg); } }
@keyframes dgenc-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dgenc__view.is-entering { animation: dgenc-fade .35s ease both; }

@media (prefers-reduced-motion: reduce) {
	.dgenc *,
	.dgenc *::before,
	.dgenc *::after { transition: none !important; animation: none !important; }
}

/* ---------- Compartir independiente (widget/shortcode) ---------- */
.dgenc-share-box {
	--dgenc-primary: var(--dgenc-primary-global, #2563eb);
	--dgenc-text: inherit;
	--dgenc-muted: #6b7280;
	--dgenc-border: #e5e7eb;
}
.dgenc-share-box .dgenc__share { margin: 0; padding: 0; border: 0; }
.dgenc-share-box *, .dgenc-share-box *::before, .dgenc-share-box *::after { box-sizing: border-box; }
