/* ==========================================================================
   POP UP Contacto - estilos del front-end
   Los colores, fuentes, tamaños y opacidad se inyectan dinámicamente desde PHP.
   Aquí va solo la estructura, la posición y el comportamiento responsive.
   ========================================================================== */

/* Botón flotante circular */
#puc-toggle {
	position: fixed;
	bottom: 124px; /* esquina inferior derecha, pero 100px más arriba (24 + 100) */
	right: 24px;
	width: 60px;
	height: 60px;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.30);
	z-index: 99999;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
}

#puc-toggle:hover {
	transform: translateY(-2px) scale(1.04);
	box-shadow: 0 10px 26px rgba(0, 0, 0, 0.38);
}

#puc-toggle:focus-visible {
	outline: 3px solid rgba(255, 255, 255, 0.9);
	outline-offset: 2px;
}

#puc-toggle svg {
	display: block;
	pointer-events: none;
}

/* Etiqueta "bocadillo" a la izquierda del botón, con flecha apuntando a él.
   Va alineada verticalmente con el botón y se mueve junto a él. */
#puc-label {
	position: fixed;
	right: 96px;  /* a la izquierda del botón (botón: 24 + 60 = 84 + ~12 de hueco) */
	bottom: 134px; /* centrada verticalmente con el botón (centro del botón a 154px) */
	height: 40px;
	display: flex;
	align-items: center;
	padding: 0 16px;
	border: none;
	border-radius: 8px;
	color: #ffffff;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
	z-index: 99999;
	-webkit-appearance: none;
	appearance: none;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

/* Flecha triangular en el lado derecho, apuntando hacia el botón. */
#puc-label::after {
	content: "";
	position: absolute;
	right: -8px;
	top: 50%;
	transform: translateY(-50%);
	width: 0;
	height: 0;
	border-top: 8px solid transparent;
	border-bottom: 8px solid transparent;
	border-left: 9px solid #0242ce; /* el color real se inyecta desde PHP */
}

#puc-label:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
}

#puc-label:focus-visible {
	outline: 3px solid rgba(255, 255, 255, 0.9);
	outline-offset: 2px;
}

/* Contenedor (no oscurece la página: solo posiciona el pop up) */
#puc-overlay {
	position: fixed;
	inset: 0;
	z-index: 99998;
	pointer-events: none; /* los clics atraviesan salvo en el propio pop up */
	display: none;
}

#puc-overlay.puc-open {
	display: block;
}

/* Pop up: esquina inferior derecha, por encima del botón.
   La altura es automática (se ajusta al contenido del shortcode), por lo que
   en PC y tablet no aparecen scrolls. El max-height + el ocultado de la barra
   son solo una red de seguridad para formularios excepcionalmente largos. */
#puc-popup {
	position: fixed;
	bottom: 196px; /* justo encima del botón elevado (124 + 60 + ~12) */
	right: 24px;
	width: 380px;
	max-width: calc(100vw - 40px);
	height: auto;
	max-height: calc(100vh - 220px);
	overflow-y: auto;
	/* Oculta la barra de desplazamiento (Firefox / IE) */
	scrollbar-width: none;
	-ms-overflow-style: none;
	border-radius: 18px;
	padding: 26px 24px 22px;
	box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
	pointer-events: auto; /* el pop up sí captura los clics */
	box-sizing: border-box;
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	-webkit-overflow-scrolling: touch;
}

/* Oculta la barra de desplazamiento (Chrome / Safari / Edge) */
#puc-popup::-webkit-scrollbar {
	width: 0;
	height: 0;
	display: none;
}

#puc-overlay.puc-open #puc-popup {
	opacity: 1;
	transform: translateY(0);
}

/* Botón de cierre */
#puc-close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	color: #ffffff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.8;
	padding: 0;
}

#puc-close:hover {
	opacity: 1;
}

#puc-close:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.9);
	outline-offset: 2px;
	border-radius: 4px;
}

/* Título y subtítulo (color/tamaño/fuente vienen del CSS dinámico) */
#puc-title {
	margin: 0 28px 6px 0;
	line-height: 1.2;
	font-weight: 700;
}

#puc-subtitle {
	margin: 0 0 18px 0;
	line-height: 1.4;
	font-weight: 400;
}

/* Zona del formulario */
#puc-form-wrap {
	color: #ffffff;
}

#puc-form-wrap label {
	color: inherit;
}

/* Mensaje de éxito */
#puc-success {
	color: #ffffff;
	line-height: 1.5;
}

#puc-success a {
	color: #ffffff;
	text-decoration: underline;
}

/* Botón azul "Escribir de nuevo" (color de fondo desde el CSS dinámico) */
#puc-rewrite {
	display: inline-block;
	margin-top: 16px;
	padding: 11px 22px;
	border: none;
	border-radius: 8px;
	color: #ffffff;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: filter 0.18s ease;
}

#puc-rewrite:hover {
	filter: brightness(1.12);
}

#puc-rewrite:focus-visible {
	outline: 3px solid rgba(255, 255, 255, 0.9);
	outline-offset: 2px;
}

/* ----------------------------- Responsive ------------------------------- */
@media (max-width: 600px) {
	#puc-popup {
		bottom: 0;
		right: 0;
		left: 0;
		width: 100%;
		max-width: 100%;
		max-height: 85vh;
		border-radius: 18px 18px 0 0;
		padding-bottom: 28px;
	}

	#puc-toggle {
		bottom: 16px;
		right: 16px;
	}

	/* En móvil la etiqueta no se muestra (la vista móvil queda intacta). */
	#puc-label {
		display: none;
	}
}

/* Respeta la preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
	#puc-toggle,
	#puc-popup {
		transition: none;
	}
}
