/**
 * Ecomed WhatsApp – estilos del componente (réplica del widget de almapet.cl).
 * Mobile-first: la base es móvil; @media (min-width: 481px) ajusta a escritorio.
 * Modificadores: .ecomed-wa--floating (flotante) y .ecomed-wa--embedded (shortcode).
 */

.ecomed-wa {
	--ecomed-green: #00c033;
	--ecomed-bubble-out: #dcf8c6;
	--ecomed-chat-bg: #e5ddd5;
	--ecomed-btn: #0b6156;
	--ecomed-btn-hover: #04433b;
	--ecomed-text: #2a2f32;
	font-family: Helvetica, Arial, sans-serif;
	line-height: normal;
}

.ecomed-wa *,
.ecomed-wa *::before,
.ecomed-wa *::after {
	box-sizing: border-box;
}

/* ---------- Botón flotante ---------- */

.ecomed-wa .ecomed-wa__launcher {
	position: fixed;
	right: 8%;
	bottom: 15%;
	z-index: 100000030;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 45px;
	height: 45px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--ecomed-green);
	color: #fff;
	box-shadow: rgba(0, 0, 0, 0.25) 0 4px 14px;
	cursor: pointer;
}

.ecomed-wa .ecomed-wa__launcher:hover,
.ecomed-wa .ecomed-wa__launcher:focus {
	background: var(--ecomed-green);
	color: #fff;
}

.ecomed-wa__launcher .ecomed-wa__icon {
	width: 22px;
	height: 22px;
}

.ecomed-wa--floating.is-open .ecomed-wa__launcher {
	display: none;
}

/* ---------- Capa oscura ---------- */

.ecomed-wa__overlay {
	position: fixed;
	inset: 0;
	z-index: -3;
	background: rgba(0, 0, 0, 0.7);
	opacity: 0;
	visibility: hidden;
	transition: 0.3s;
}

.ecomed-wa--floating.is-open .ecomed-wa__overlay {
	z-index: 100000000;
	opacity: 1;
	visibility: visible;
}

/* ---------- Panel ---------- */

.ecomed-wa__panel {
	overflow: hidden;
	border-radius: 7px;
	background: var(--ecomed-chat-bg);
	box-shadow: rgba(0, 0, 0, 0.25) 0 4px 4px;
}

.ecomed-wa--floating .ecomed-wa__panel {
	/* Fondo de doodles tipo WhatsApp; el color queda de respaldo mientras carga la imagen. */
	background: var(--ecomed-chat-bg) url("../img/chat-bg.jpg") center top / cover no-repeat;
	position: fixed;
	left: 2.5%;
	bottom: -800px;
	z-index: 100000031;
	display: flex;
	flex-direction: column;
	width: 95%;
	max-height: 85vh;
	opacity: 0;
	visibility: hidden;
	transition: 0.3s;
}

.ecomed-wa--floating.is-open .ecomed-wa__panel {
	bottom: 10%;
	opacity: 1;
	visibility: visible;
}

/* ---------- Header ---------- */

.ecomed-wa__header {
	display: flex;
	flex-shrink: 0;
	justify-content: space-between;
	align-items: flex-start;
	width: 100%;
	padding: 4px 8px;
	border-bottom: 1px solid #bcbcbc;
	border-radius: 7px 7px 0 0;
	background: #fafafa;
}

.ecomed-wa__profile {
	display: flex;
	align-items: flex-start;
}

.ecomed-wa__avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	min-width: 30px;
	height: 30px;
	overflow: hidden;
	border-radius: 50%;
	background: #fff;
}

.ecomed-wa__avatar img {
	width: auto;
	max-width: 70%;
	height: auto;
	max-height: 25px;
}

.ecomed-wa__meta {
	margin-top: 4px;
	padding-left: 8px;
	text-align: left;
}

.ecomed-wa__name {
	font-size: 11px;
	font-weight: 700;
	color: var(--ecomed-text);
}

.ecomed-wa__status {
	font-size: 10px;
	color: #a0a0a0;
}

.ecomed-wa .ecomed-wa__close {
	display: block;
	margin: 0;
	padding: 0 10px 0 0;
	border: 0;
	background: none;
	font-family: inherit;
	font-size: 24px;
	line-height: 1.2;
	color: var(--ecomed-text);
	cursor: pointer;
}

/* ---------- Conversación ---------- */

.ecomed-wa__body {
	display: flex;
	flex-direction: column;
	width: 100%;
	padding: 16px 8px;
	overflow-y: auto;
}

.ecomed-wa__form {
	display: flex;
	flex-direction: column;
	margin: 0;
}

/* Contenedores de globos (entrante a la izquierda, salientes a la derecha). */
.ecomed-wa__in,
.ecomed-wa__out {
	width: 90%;
	max-width: 266px;
	border-bottom: 1px solid #ccc;
	border-radius: 4px;
	text-align: right;
}

.ecomed-wa__in {
	align-self: flex-start;
	margin-bottom: 20px;
	padding-left: 10px;
	overflow: hidden;
}

.ecomed-wa__out {
	align-self: flex-end;
	margin-bottom: 8px;
	padding-right: 10px;
}

.ecomed-wa__bubble-in,
.ecomed-wa__bubble-out {
	position: relative;
	display: block;
	width: 100%;
	font-size: 11px;
	text-align: left;
}

.ecomed-wa__bubble-in::after,
.ecomed-wa__bubble-out::after {
	content: "";
	position: absolute;
	width: 0;
	height: 0;
}

.ecomed-wa__bubble-in {
	padding: 8px;
	border-radius: 4px 0 0;
	background: #fff;
	color: gray;
}

.ecomed-wa__bubble-in::after {
	left: -10px;
	bottom: 0;
	border-top: 10px solid transparent;
	border-right: 10px solid #fff;
}

.ecomed-wa__bubble-out {
	padding: 2px 8px;
	border-radius: 4px 0 4px 4px;
	background: var(--ecomed-bubble-out);
}

.ecomed-wa__bubble-out::after {
	top: 0;
	right: -10px;
	border-bottom: 10px solid transparent;
	border-left: 10px solid var(--ecomed-bubble-out);
}

/* ---------- Campos ---------- */

.ecomed-wa__label {
	display: block;
	margin: 0;
	font-size: 11px;
	font-weight: 400;
	color: #737373;
}

/* Selector reforzado para anular estilos de inputs del tema/Elementor. */
.ecomed-wa .ecomed-wa__field {
	display: block;
	width: 100%;
	min-height: 0;
	height: auto;
	margin: 0;
	padding: 2px 8px;
	border: 0;
	border-radius: 0;
	outline: 0;
	background: transparent;
	box-shadow: none;
	font-family: inherit;
	font-size: 12px;
	line-height: 18px;
	color: #333;
}

.ecomed-wa .ecomed-wa__field::placeholder {
	color: #757575;
	opacity: 1;
}

.ecomed-wa .ecomed-wa__field:focus {
	border: 0;
	outline: 0;
	box-shadow: none;
}

.ecomed-wa .ecomed-wa__message {
	max-height: 100px;
	resize: none;
}

.ecomed-wa__error {
	display: block;
	font-size: 0.6rem;
	text-align: center;
	color: #c0392b;
}

.ecomed-wa__error:empty {
	display: none;
}

/* ---------- Aceptación de políticas ---------- */

.ecomed-wa__privacy {
	align-self: flex-end;
	width: 90%;
	max-width: 266px;
	margin-bottom: 8px;
	padding-right: 10px;
	text-align: right;
}

.ecomed-wa .ecomed-wa__privacy-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	font-size: 12px;
	font-weight: 400;
	color: #000;
	cursor: pointer;
}

.ecomed-wa .ecomed-wa__privacy-label input {
	width: 13px;
	height: 13px;
	margin: 0;
}

.ecomed-wa .ecomed-wa__privacy-label a {
	color: #397a9e;
	text-decoration: underline;
}

/* ---------- Botón enviar y mensajes ---------- */

.ecomed-wa .ecomed-wa__submit {
	align-self: flex-end;
	width: 180px;
	margin: 10px 10px 40px 0;
	padding: 10px 0;
	border: 0;
	border-radius: 4px;
	background: var(--ecomed-btn);
	font-family: inherit;
	font-size: 12px;
	font-weight: 700;
	color: #fff;
	cursor: pointer;
}

.ecomed-wa .ecomed-wa__submit:hover,
.ecomed-wa .ecomed-wa__submit:focus {
	background: var(--ecomed-btn-hover);
	color: #fff;
}

.ecomed-wa .ecomed-wa__submit[hidden] {
	display: none;
}

.ecomed-wa .ecomed-wa__submit:disabled {
	opacity: 0.7;
	cursor: wait;
}

.ecomed-wa__feedback {
	align-self: flex-start;
	width: 90%;
	max-width: 266px;
	margin-left: 10px;
	font-size: 11px;
}

.ecomed-wa__feedback:empty {
	display: none;
}

.ecomed-wa__feedback.is-success,
.ecomed-wa__feedback.is-error {
	margin-bottom: 8px;
	padding: 8px;
	border-radius: 4px;
	background: #fff;
}

.ecomed-wa__feedback.is-success {
	color: var(--ecomed-btn);
}

.ecomed-wa__feedback.is-error {
	color: #c0392b;
}

.ecomed-wa__feedback a {
	color: #397a9e;
	text-decoration: underline;
}

/* ---------- Accesibilidad / anti-spam ---------- */

.ecomed-wa__sr,
.ecomed-wa__hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.ecomed-wa__hp {
	left: -9999px;
}

/* ---------- Escritorio ---------- */

@media (min-width: 481px) {
	.ecomed-wa .ecomed-wa__launcher {
		right: 2%;
		bottom: 12%;
		width: 70px;
		height: 70px;
	}

	.ecomed-wa__launcher .ecomed-wa__icon {
		width: 42px;
		height: 42px;
	}

	.ecomed-wa--floating .ecomed-wa__panel {
		left: auto;
		right: 50px;
		width: 350px;
	}

	.ecomed-wa--floating.is-open .ecomed-wa__panel {
		bottom: 75px;
	}
}

/* ==========================================================================
   Modo embebido [ecomed_form]: mismo formulario con estilo de formulario normal
   (colores del formulario de Contacto del sitio). Va al final para prevalecer
   sobre los estilos de chat de arriba.
   ========================================================================== */

.ecomed-wa--embedded {
	--ecomed-field-bg: #f5f5f5;
	--ecomed-label: #7a7a7a;
	--ecomed-accent: #45c8c8;
	--ecomed-accent-hover: #36b0b0;
	font-family: inherit;
}

.ecomed-wa--embedded .ecomed-wa__panel {
	position: relative;
	width: 100%;
	overflow: visible;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}

.ecomed-wa--embedded .ecomed-wa__body {
	padding: 0;
	overflow: visible;
}

/* Los contenedores de globos pasan a ser filas de campo a todo el ancho. */
.ecomed-wa--embedded .ecomed-wa__out {
	align-self: stretch;
	width: 100%;
	max-width: none;
	margin-bottom: 16px;
	padding: 0;
	border: 0;
	border-radius: 0;
	text-align: left;
}

.ecomed-wa--embedded .ecomed-wa__bubble-out {
	padding: 0;
	border-radius: 0;
	background: transparent;
	font-size: inherit;
}

.ecomed-wa--embedded .ecomed-wa__bubble-out::after {
	display: none;
}

.ecomed-wa--embedded .ecomed-wa__label {
	margin-bottom: 6px;
	font-size: 14px;
	color: var(--ecomed-label);
}

.ecomed-wa--embedded .ecomed-wa__field {
	padding: 12px 16px;
	border: 1px solid transparent;
	border-radius: 4px;
	background: var(--ecomed-field-bg);
	font-size: 15px;
	line-height: 1.4;
	color: #333;
}

.ecomed-wa--embedded .ecomed-wa__field:focus {
	border: 1px solid var(--ecomed-accent);
}

.ecomed-wa--embedded .has-error .ecomed-wa__field {
	border-color: #c0392b;
}

.ecomed-wa--embedded .ecomed-wa__message {
	min-height: 110px;
	max-height: none;
	resize: vertical;
}

.ecomed-wa--embedded .ecomed-wa__error {
	margin-top: 4px;
	font-size: 13px;
	text-align: left;
}

.ecomed-wa--embedded .ecomed-wa__privacy {
	align-self: stretch;
	width: 100%;
	max-width: none;
	padding: 0;
	text-align: left;
}

.ecomed-wa--embedded .ecomed-wa__privacy-label {
	font-size: 14px;
	color: var(--ecomed-label);
}

.ecomed-wa--embedded .ecomed-wa__submit {
	width: auto;
	margin: 8px 0 0;
	padding: 18px 42px;
	border-radius: 46px;
	background: var(--ecomed-accent);
	font-size: 15px;
	font-weight: 600;
}

.ecomed-wa--embedded .ecomed-wa__submit:hover,
.ecomed-wa--embedded .ecomed-wa__submit:focus {
	background: var(--ecomed-accent-hover);
}

.ecomed-wa--embedded .ecomed-wa__feedback {
	align-self: stretch;
	width: 100%;
	max-width: none;
	margin: 0 0 12px;
	font-size: 14px;
}

.ecomed-wa--embedded .ecomed-wa__feedback.is-success,
.ecomed-wa--embedded .ecomed-wa__feedback.is-error {
	padding: 12px 16px;
	background: var(--ecomed-field-bg);
}
