/* ============================================================================
   ASISTENTE GECOTEL
   ----------------------------------------------------------------------------
   Los estilos van en el plugin y no en el tema porque el asistente debe
   funcionar aunque mañana se cambie de tema. Por eso tampoco usa las
   variables del tema: lleva sus propios colores, con los de marca por
   defecto y la posibilidad de sobrescribirlos.
   ========================================================================= */

.gm-asis,
.gm-asis-boton {
	--gm-rojo: #cc0000;
	--gm-rojo-osc: #990000;
	--gm-amarillo: #ffcc00;
	--gm-sup: #ffffff;
	--gm-fondo: #f6f6f6;
	--gm-txt: #171717;
	--gm-txt2: #585858;
	--gm-borde: #e5e5e5;
	font-family: "Source Sans 3", -apple-system, "Segoe UI", Roboto, sans-serif;
	box-sizing: border-box;
}
.gm-asis *, .gm-asis *::before, .gm-asis *::after { box-sizing: border-box; }

@media (prefers-color-scheme: dark) {
	.gm-asis, .gm-asis-boton {
		--gm-sup: #1b1b1b;
		--gm-fondo: #121212;
		--gm-txt: #f2f2f2;
		--gm-txt2: #a8a8a8;
		--gm-borde: #2e2e2e;
	}
}

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

.gm-asis-boton {
	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 9998;
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--gm-rojo);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0,0,0,.24);
	transition: transform .15s ease, background .15s ease;
}
.gm-asis-boton:hover { background: var(--gm-rojo-osc); transform: scale(1.05); }
.gm-asis-boton[hidden] { display: none; }

/* --- Panel --- */

.gm-asis {
	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	width: min(380px, calc(100vw - 32px));
	height: min(560px, calc(100vh - 100px));
	background: var(--gm-sup);
	border: 1px solid var(--gm-borde);
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 12px 40px rgba(0,0,0,.26);
}
.gm-asis[hidden] { display: none; }

/* --- Cabecera --- */

.gm-asis__cab {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 13px 16px;
	background: var(--gm-rojo);
	color: #fff;
	flex-shrink: 0;
}
.gm-asis__ident { display: flex; align-items: center; gap: 10px; }
.gm-asis__ident strong { display: block; font-size: 15px; font-weight: 700; line-height: 1.2; }
.gm-asis__ident small { display: block; font-size: 12px; opacity: .88; }

.gm-asis__punto {
	width: 9px; height: 9px;
	border-radius: 50%;
	background: #39d353;
	box-shadow: 0 0 0 3px rgba(57,211,83,.28);
}

.gm-asis__cerrar {
	width: 32px; height: 32px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}
.gm-asis__cerrar:hover { background: rgba(255,255,255,.18); }

/* --- Hilo de mensajes --- */

.gm-asis__hilo {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	background: var(--gm-fondo);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.gm-msj {
	max-width: 85%;
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.5;
	white-space: pre-line;
	overflow-wrap: break-word;
}
.gm-msj--bot {
	align-self: flex-start;
	background: var(--gm-sup);
	border: 1px solid var(--gm-borde);
	border-bottom-left-radius: 4px;
	color: var(--gm-txt);
}
.gm-msj--yo {
	align-self: flex-end;
	background: var(--gm-rojo);
	border-bottom-right-radius: 4px;
	color: #fff;
}

/* Puntos de "escribiendo". Son una pequeña mentira útil: la respuesta es
   instantánea, pero sin una pausa mínima el usuario no percibe que ha
   habido una consulta y la conversación resulta brusca. */
.gm-msj--espera { display: flex; gap: 4px; padding: 14px 15px; }
.gm-msj--espera span {
	width: 7px; height: 7px;
	border-radius: 50%;
	background: #b3b3b3;
	animation: gm-latido 1.2s infinite ease-in-out;
}
.gm-msj--espera span:nth-child(2) { animation-delay: .18s; }
.gm-msj--espera span:nth-child(3) { animation-delay: .36s; }

@keyframes gm-latido {
	0%, 60%, 100% { opacity: .3; transform: translateY(0); }
	30% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
	.gm-msj--espera span { animation: none; opacity: .6; }
	.gm-asis-boton { transition: none; }
}

/* --- Sugerencias y acciones --- */

.gm-asis__sug { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; max-width: 100%; }

.gm-asis__sug button,
.gm-asis__sug a {
	padding: 7px 13px;
	border: 1px solid var(--gm-rojo);
	border-radius: 999px;
	background: var(--gm-sup);
	color: var(--gm-rojo);
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}
.gm-asis__sug button:hover,
.gm-asis__sug a:hover { background: var(--gm-rojo); color: #fff; }

/* Canales de contacto cuando se escala a una persona. */
.gm-asis__canales {
	display: flex;
	flex-direction: column;
	gap: 6px;
	align-self: flex-start;
	width: 85%;
}
.gm-asis__canales a {
	display: block;
	padding: 11px 14px;
	border-radius: 10px;
	background: var(--gm-rojo);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
}
.gm-asis__canales a:hover { background: var(--gm-rojo-osc); color: #fff; }
.gm-asis__canales a[href^="https://wa.me"] { background: #25d366; }
.gm-asis__canales a[href^="https://wa.me"]:hover { background: #1fb855; }

/* --- Pie --- */

.gm-asis__pie {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--gm-borde);
	background: var(--gm-sup);
	flex-shrink: 0;
}
.gm-asis__pie input {
	flex: 1 1 auto;
	min-width: 0;
	height: 42px;
	padding: 0 14px;
	border: 1px solid var(--gm-borde);
	border-radius: 999px;
	background: var(--gm-fondo);
	color: var(--gm-txt);
	font-family: inherit;
	/* 16px: por debajo de eso, iOS hace zoom al tocar el campo. */
	font-size: 16px;
}
.gm-asis__pie input:focus { outline: 2px solid var(--gm-rojo); outline-offset: 1px; }

.gm-asis__pie button {
	flex-shrink: 0;
	display: grid;
	place-items: center;
	width: 42px; height: 42px;
	border: 0;
	border-radius: 50%;
	background: var(--gm-rojo);
	color: #fff;
	cursor: pointer;
}
.gm-asis__pie button:hover { background: var(--gm-rojo-osc); }
.gm-asis__pie button:disabled { opacity: .5; cursor: default; }

.gm-asis__aviso {
	margin: 0;
	padding: 8px 14px 11px;
	background: var(--gm-sup);
	color: var(--gm-txt2);
	font-size: 11px;
	line-height: 1.4;
	text-align: center;
	flex-shrink: 0;
}

/* --- Móvil: a pantalla completa --- */

@media (max-width: 560px) {
	.gm-asis {
		right: 0; left: 0; bottom: 0; top: 0;
		width: 100%;
		height: 100%;
		border: 0;
		border-radius: 0;
	}
	/* Hueco para no tapar la barra inferior del tema. */
	.gm-asis-boton { bottom: 72px; right: 14px; width: 50px; height: 50px; }
}
