/* Atlantis Chat — chat de la web. Todo cuelga de #atlchat para no chocar con el tema. */
#atlchat {
	--atlchat-color: #0e5a8a;
	--atlchat-fondo: #ffffff;
	--atlchat-texto: #1d2327;
	--atlchat-suave: #f1f3f5;
	--atlchat-borde: #dcdfe3;
	--atlchat-gris: #5f6b76;
	position: fixed;
	bottom: 20px;
	z-index: 99990;
	font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--atlchat-texto);
	text-align: left;
}
#atlchat.atlchat--derecha { right: 20px; }
#atlchat.atlchat--izquierda { left: 20px; }
#atlchat *, #atlchat *::before, #atlchat *::after { box-sizing: border-box; }
#atlchat [hidden] { display: none !important; }

/* Botón flotante */
#atlchat .atlchat-lanzador {
	appearance: none; display: flex; align-items: center; justify-content: center;
	width: 58px; height: 58px; padding: 0; margin: 0; border: 0; border-radius: 50%;
	background: var(--atlchat-color); color: #fff; cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .22); transition: transform .15s ease;
}
#atlchat.atlchat--izquierda .atlchat-lanzador { margin-right: auto; }
#atlchat.atlchat--derecha .atlchat-lanzador { margin-left: auto; }
#atlchat .atlchat-lanzador:hover { transform: scale(1.06); }
#atlchat .atlchat-lanzador:focus-visible, #atlchat button:focus-visible, #atlchat a:focus-visible,
#atlchat input:focus-visible, #atlchat textarea:focus-visible {
	outline: 3px solid var(--atlchat-color); outline-offset: 2px;
}
#atlchat .atlchat-lanzador svg { width: 26px; height: 26px; fill: currentColor; stroke: currentColor; stroke-width: 0; }
#atlchat.atlchat--abierto .atlchat-lanzador svg { fill: none; stroke-width: 2.4; stroke-linecap: round; }

/* Globo de aviso */
#atlchat .atlchat-aviso {
	position: absolute; bottom: 70px; white-space: nowrap; cursor: pointer;
	background: var(--atlchat-fondo); color: var(--atlchat-texto);
	padding: 9px 14px; border-radius: 16px; box-shadow: 0 4px 16px rgba(0, 0, 0, .16);
	animation: atlchat-entra .3s ease;
}
#atlchat.atlchat--derecha .atlchat-aviso { right: 4px; }
#atlchat.atlchat--izquierda .atlchat-aviso { left: 4px; }

/* Panel */
#atlchat .atlchat-panel {
	position: absolute; bottom: 72px; width: 370px; height: 540px; max-height: calc(100vh - 110px);
	display: flex; flex-direction: column; overflow: hidden;
	background: var(--atlchat-fondo); border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .25); animation: atlchat-entra .2s ease;
}
#atlchat.atlchat--derecha .atlchat-panel { right: 0; }
#atlchat.atlchat--izquierda .atlchat-panel { left: 0; }

#atlchat .atlchat-cabecera {
	display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px;
	background: var(--atlchat-color); color: #fff;
}
#atlchat .atlchat-avatar {
	flex: none; width: 38px; height: 38px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: rgba(255, 255, 255, .2); font-weight: 700; font-size: 17px;
}
#atlchat .atlchat-cab-texto { flex: 1; min-width: 0; }
#atlchat .atlchat-titulo { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#atlchat .atlchat-subtitulo { font-size: 12.5px; opacity: .85; }
#atlchat .atlchat-cerrar {
	appearance: none; flex: none; width: 34px; height: 34px; padding: 6px; margin: 0; border: 0; border-radius: 8px;
	background: transparent; color: #fff; cursor: pointer;
}
#atlchat .atlchat-cerrar:hover { background: rgba(255, 255, 255, .15); }
#atlchat .atlchat-cerrar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* Conversación */
#atlchat .atlchat-log {
	position: relative; flex: 1; overflow-y: auto; padding: 16px 14px 8px; background: var(--atlchat-suave);
	display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain;
}
#atlchat .atlchat-msg {
	max-width: 86%; padding: 9px 13px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere;
	animation: atlchat-entra .2s ease;
}
#atlchat .atlchat-msg--bot { align-self: flex-start; background: var(--atlchat-fondo); border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
#atlchat .atlchat-msg--usuario { align-self: flex-end; background: var(--atlchat-color); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
#atlchat .atlchat-msg p { margin: 0 0 .5em; }
#atlchat .atlchat-msg p:last-child { margin-bottom: 0; }
#atlchat .atlchat-msg ul, #atlchat .atlchat-msg ol { margin: .4em 0; padding-left: 1.2em; }
#atlchat .atlchat-msg li { margin: .15em 0; }
#atlchat .atlchat-msg a { color: var(--atlchat-color); text-decoration: underline; font-weight: 600; }
#atlchat .atlchat-msg--usuario a { color: #fff; }

#atlchat .atlchat-escribiendo { display: flex; gap: 4px; padding: 13px 14px; }
#atlchat .atlchat-escribiendo span {
	width: 7px; height: 7px; border-radius: 50%; background: var(--atlchat-gris); opacity: .4;
	animation: atlchat-punto 1s infinite;
}
#atlchat .atlchat-escribiendo span:nth-child(2) { animation-delay: .15s; }
#atlchat .atlchat-escribiendo span:nth-child(3) { animation-delay: .3s; }

/* Botones de opciones */
#atlchat .atlchat-opciones { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
#atlchat .atlchat-opcion {
	appearance: none; display: inline-block; margin: 0; padding: 7px 12px; border-radius: 18px;
	border: 1.5px solid var(--atlchat-color); background: var(--atlchat-fondo); color: var(--atlchat-color);
	font: inherit; font-size: 14px; line-height: 1.3; text-decoration: none; cursor: pointer; text-align: left;
}
#atlchat .atlchat-opcion:hover { background: var(--atlchat-color); color: #fff; }

/* Formulario de mensaje */
#atlchat .atlchat-form {
	display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px;
	background: var(--atlchat-fondo); box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
#atlchat .atlchat-form label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--atlchat-gris); margin: 0; }
#atlchat .atlchat-form input:not([type=checkbox]), #atlchat .atlchat-form textarea {
	width: 100%; margin: 0; padding: 8px 10px; border: 1px solid var(--atlchat-borde); border-radius: 8px;
	background: #fff; color: var(--atlchat-texto); font: inherit; font-size: 15px; box-shadow: none;
}
#atlchat .atlchat-form textarea { resize: vertical; min-height: 64px; }
#atlchat .atlchat-form .atlchat-check { flex-direction: row; align-items: flex-start; gap: 7px; font-size: 12.5px; }
#atlchat .atlchat-form .atlchat-check input { margin: 2px 0 0; flex: none; }
#atlchat .atlchat-form .atlchat-check a { color: var(--atlchat-color); }
#atlchat .atlchat-trampa { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
#atlchat .atlchat-boton {
	appearance: none; margin: 2px 0 0; padding: 9px 14px; border: 0; border-radius: 8px;
	background: var(--atlchat-color); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
#atlchat .atlchat-boton:disabled { opacity: .6; cursor: default; }
#atlchat .atlchat-estado { color: #b32d2e; font-size: 13px; }
#atlchat .atlchat-estado:empty { display: none; }

/* Pie con la caja de texto */
#atlchat .atlchat-pie { display: flex; gap: 6px; padding: 10px; margin: 0; border-top: 1px solid var(--atlchat-borde); background: var(--atlchat-fondo); }
#atlchat .atlchat-entrada {
	flex: 1; min-width: 0; margin: 0; padding: 10px 12px; border: 1px solid var(--atlchat-borde); border-radius: 20px;
	background: #fff; color: var(--atlchat-texto); font: inherit; font-size: 15px; box-shadow: none; height: auto;
}
#atlchat .atlchat-enviar {
	appearance: none; flex: none; width: 42px; height: 42px; padding: 9px; margin: 0; border: 0; border-radius: 50%;
	background: var(--atlchat-color); color: #fff; cursor: pointer;
}
#atlchat .atlchat-enviar svg { width: 22px; height: 22px; fill: currentColor; }

@keyframes atlchat-entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes atlchat-punto { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* Móvil: el panel ocupa casi toda la pantalla */
@media (max-width: 480px) {
	#atlchat { bottom: 14px; }
	#atlchat.atlchat--derecha { right: 14px; }
	#atlchat.atlchat--izquierda { left: 14px; }
	#atlchat .atlchat-panel {
		position: fixed; left: 8px !important; right: 8px !important; bottom: 84px;
		width: auto; height: auto; top: 8px; max-height: none;
	}
	#atlchat .atlchat-entrada, #atlchat .atlchat-form input:not([type=checkbox]), #atlchat .atlchat-form textarea { font-size: 16px; }
}

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