/* Chatbot IA - estilos frontend */
.cia-widget {
	--cia-accent: #2563eb;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.4;
}

/* --- Flotante --- */
.cia-mode-floating {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 999999;
}
.cia-pos-left.cia-mode-floating {
	left: 20px;
	right: auto;
}

.cia-launcher {
	width: var(--cia-launcher-size, 60px);
	height: var(--cia-launcher-size, 60px);
	border-radius: 50%;
	border: none;
	background: var(--cia-accent);
	color: var(--cia-accent-text, #fff);
	font-size: 26px;
	cursor: pointer;
	padding: 0;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 20px rgba( 0, 0, 0, 0.25 );
	transition: transform 0.15s ease;
}
.cia-launcher:hover { transform: scale( 1.06 ); }
.cia-launcher img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.cia-launcher svg {
	width: 52%;
	height: 52%;
}

.cia-mode-floating .cia-panel {
	position: absolute;
	right: 0;
	bottom: calc( var(--cia-launcher-size, 60px) + 16px );
	width: 360px;
	max-width: calc( 100vw - 40px );
	height: 520px;
	max-height: calc( 100vh - 120px );
	display: none;
	flex-direction: column;
	background: #fff;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, 0.25 );
}
.cia-mode-floating.cia-open .cia-panel { display: flex; }
.cia-mode-floating.cia-open .cia-launcher { display: none; }
.cia-pos-left.cia-mode-floating .cia-panel { left: 0; right: auto; }

/* --- Inline --- */
.cia-mode-inline .cia-panel {
	display: flex;
	flex-direction: column;
	height: 520px;
	max-height: 80vh;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 16px;
	overflow: hidden;
}

/* --- Comunes --- */
.cia-header {
	background: var(--cia-accent);
	color: var(--cia-accent-text, #fff);
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.cia-title { font-weight: 600; }
.cia-close {
	background: transparent;
	border: none;
	color: var(--cia-accent-text, #fff);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}

.cia-log {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #f7f8fa;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.cia-msg { display: flex; }
.cia-msg.cia-user { justify-content: flex-end; }

.cia-bubble {
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 14px;
	word-wrap: break-word;
}
.cia-assistant .cia-bubble {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-bottom-left-radius: 4px;
	color: #111827;
}
.cia-user .cia-bubble {
	background: var(--cia-accent);
	color: var(--cia-accent-text, #fff);
	border-bottom-right-radius: 4px;
}
.cia-typing .cia-bubble { opacity: 0.6; }

.cia-input {
	display: flex;
	border-top: 1px solid #e5e7eb;
	background: #fff;
}
.cia-input input {
	flex: 1;
	border: none;
	padding: 14px;
	font-size: 16px; /* 16px evita el zoom automático al enfocar en iOS */
	outline: none;
	background: transparent;
	color: #111827;
}
.cia-send {
	border: none;
	background: var(--cia-accent);
	color: var(--cia-accent-text, #fff);
	padding: 0 18px;
	cursor: pointer;
	font-weight: 600;
}
.cia-send:hover { filter: brightness( 0.95 ); }

/* --- Responsive (móviles) --- */
@media ( max-width: 480px ) {
	.cia-mode-floating {
		right: 12px;
		bottom: 12px;
	}
	.cia-pos-left.cia-mode-floating {
		left: 12px;
		right: auto;
	}
	/* El panel abierto ocupa casi toda la pantalla, con márgenes pequeños. */
	.cia-mode-floating .cia-panel {
		width: calc( 100vw - 24px );
		max-width: calc( 100vw - 24px );
		height: calc( 100vh - 90px );
		max-height: calc( 100dvh - 90px ); /* dvh evita saltos con la barra del navegador móvil */
	}
}
