/* ==================================================================
   MCL Chat IA — estilos del widget
   Se presenta como un formulario de recepción guiado (ancho, con
   panel de "datos del proyecto"), no como una app de mensajería.
   Paleta: negro / blanco / grises, acorde a la identidad de
   Madrid Corte Láser. Sin dependencias externas.
   ================================================================== */

.mcl-chat-widget {
	--mcl-black: #111111;
	--mcl-gray-50: #fafafa;
	--mcl-gray-100: #f5f5f5;
	--mcl-gray-200: #e7e7e7;
	--mcl-gray-300: #d4d4d4;
	--mcl-gray-500: #8a8a8a;
	--mcl-white: #ffffff;
	--mcl-ok: #1f9d55;
	--mcl-radius: 16px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	box-sizing: border-box;
	color: var(--mcl-black);
}
.mcl-chat-widget *,
.mcl-chat-widget *::before,
.mcl-chat-widget *::after {
	box-sizing: inherit;
}

/* ---------- Modo incrustado: formulario ancho ---------- */
.mcl-chat-widget--embedded {
	max-width: 920px;
	margin: 0 auto;
}

/* ---------- Modo flotante (burbuja compacta abajo a la derecha) ---------- */
.mcl-chat-widget--floating {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
}
.mcl-chat-widget--floating .mcl-chat-panel {
	display: none;
	position: fixed;
	right: 20px;
	bottom: 96px;
	width: 400px;
	max-width: calc(100vw - 32px);
	height: 600px;
	max-height: calc(100vh - 140px);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.mcl-chat-widget--floating.mcl-chat-open .mcl-chat-panel {
	display: flex;
}
.mcl-chat-widget--floating.mcl-chat-open .mcl-chat-launcher {
	display: none;
}
/* En flotante no hay sitio para el panel lateral de datos */
.mcl-chat-widget--floating .mcl-chat-checklist {
	display: none;
}
.mcl-chat-widget--floating .mcl-chat-welcome {
	display: none;
}

.mcl-chat-launcher {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--mcl-black);
	color: var(--mcl-white);
	border: none;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
	font-size: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease;
}
.mcl-chat-launcher:hover {
	transform: scale(1.06);
}

/* ---------- Panel general ---------- */
.mcl-chat-panel {
	display: flex;
	flex-direction: column;
	width: 100%;
	background: var(--mcl-white);
	border-radius: var(--mcl-radius);
	overflow: hidden;
	border: 1px solid var(--mcl-gray-200);
}

/* ---------- Cabecera de bienvenida ---------- */
.mcl-chat-intro {
	background: var(--mcl-black);
	color: var(--mcl-white);
	padding: 22px 26px;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
}
.mcl-chat-title {
	font-size: 19px;
	font-weight: 700;
	line-height: 1.3;
}
.mcl-chat-subtitle {
	font-size: 13.5px;
	color: rgba(255, 255, 255, 0.75);
	margin-top: 4px;
	line-height: 1.4;
}
.mcl-chat-welcome {
	margin: 12px 0 0;
	font-size: 13px;
	line-height: 1.55;
	color: rgba(255, 255, 255, 0.88);
	max-width: 60ch;
}
.mcl-chat-close {
	background: transparent;
	border: none;
	color: var(--mcl-white);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 0 2px;
	flex-shrink: 0;
}

/* ---------- Cuerpo: conversación + panel de datos ---------- */
.mcl-chat-body {
	display: flex;
	align-items: stretch;
	flex: 1;
	min-height: 0;
}

.mcl-chat-main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	background: var(--mcl-gray-50);
}

.mcl-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 20px 22px 6px;
	min-height: 220px;
	max-height: 460px;
}

/* --- turnos de la conversación, estilo "documento", no burbujas --- */
.mcl-turn {
	margin-bottom: 16px;
	max-width: 640px;
}
.mcl-turn-label {
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-weight: 700;
	color: var(--mcl-gray-500);
	margin-bottom: 5px;
}
.mcl-turn-bot .mcl-turn-label { color: var(--mcl-black); }
.mcl-turn-text {
	font-size: 14px;
	line-height: 1.55;
	white-space: pre-wrap;
	word-break: break-word;
	padding: 12px 15px;
	border-radius: 10px;
}
.mcl-turn-bot .mcl-turn-text {
	background: var(--mcl-white);
	border: 1px solid var(--mcl-gray-200);
	border-left: 3px solid var(--mcl-black);
}
.mcl-turn-user {
	margin-left: 22px;
}
.mcl-turn-user .mcl-turn-text {
	background: var(--mcl-gray-100);
	border: 1px solid var(--mcl-gray-200);
	border-left: 3px solid var(--mcl-gray-300);
}
.mcl-turn-system .mcl-turn-text {
	background: transparent;
	border: none;
	color: var(--mcl-gray-500);
	font-size: 12.5px;
	padding: 4px 0;
}

.mcl-typing {
	display: inline-flex;
	gap: 4px;
	padding: 12px 15px;
	background: var(--mcl-white);
	border: 1px solid var(--mcl-gray-200);
	border-left: 3px solid var(--mcl-black);
	border-radius: 10px;
	margin-bottom: 16px;
}
.mcl-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--mcl-gray-500);
	animation: mcl-blink 1.2s infinite ease-in-out;
}
.mcl-typing span:nth-child(2) { animation-delay: 0.2s; }
.mcl-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mcl-blink {
	0%, 80%, 100% { opacity: 0.25; }
	40% { opacity: 1; }
}

.mcl-chat-complete-card {
	background: var(--mcl-white);
	border: 1px solid var(--mcl-gray-200);
	border-left: 3px solid var(--mcl-ok);
	border-radius: 10px;
	padding: 16px;
	font-size: 13.5px;
	max-width: 640px;
	margin-bottom: 16px;
}
.mcl-chat-complete-card strong {
	display: block;
	margin-bottom: 4px;
	font-size: 14.5px;
}

/* --- adjuntos pendientes de enviar --- */
.mcl-chat-pending-files {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 22px;
}
.mcl-chat-pending-files:empty {
	display: none;
}
.mcl-pending-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--mcl-gray-200);
	border-radius: 20px;
	padding: 5px 10px;
	font-size: 12px;
}
.mcl-pending-chip button {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 13px;
	line-height: 1;
	color: var(--mcl-gray-500);
	padding: 0;
}

/* --- barra de entrada, con pinta de campo de formulario --- */
.mcl-chat-inputbar {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 14px 22px;
}
.mcl-chat-attach {
	cursor: pointer;
	font-size: 19px;
	padding: 9px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--mcl-gray-500);
	flex-shrink: 0;
	background: var(--mcl-white);
	border: 1px solid var(--mcl-gray-200);
}
.mcl-chat-attach:hover {
	background: var(--mcl-gray-100);
}
.mcl-chat-text-input {
	flex: 1;
	border: 1px solid var(--mcl-gray-300);
	border-radius: 10px;
	padding: 11px 14px;
	font-size: 14px;
	font-family: inherit;
	outline: none;
	min-width: 0;
	resize: none;
	max-height: 120px;
	background: var(--mcl-white);
	line-height: 1.4;
}
.mcl-chat-text-input:focus {
	border-color: var(--mcl-black);
}
.mcl-chat-send {
	background: var(--mcl-black);
	color: var(--mcl-white);
	border: none;
	border-radius: 10px;
	padding: 11px 18px;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	flex-shrink: 0;
}
.mcl-chat-send:disabled {
	opacity: 0.5;
	cursor: default;
}

.mcl-chat-footnote {
	font-size: 10.5px;
	color: var(--mcl-gray-500);
	padding: 0 22px 16px;
}

/* ---------- Panel lateral: "Datos de tu proyecto" ---------- */
.mcl-chat-checklist {
	width: 260px;
	flex-shrink: 0;
	background: var(--mcl-white);
	border-left: 1px solid var(--mcl-gray-200);
	padding: 22px 20px;
}
.mcl-checklist-title {
	font-size: 12.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 12px;
}
.mcl-checklist-progress {
	margin-bottom: 16px;
}
.mcl-checklist-progress-bar {
	height: 5px;
	background: var(--mcl-gray-200);
	border-radius: 4px;
	overflow: hidden;
}
.mcl-checklist-progress-bar span {
	display: block;
	height: 100%;
	background: var(--mcl-ok);
	transition: width 0.35s ease;
}
.mcl-checklist-progress-label {
	display: block;
	font-size: 11px;
	color: var(--mcl-gray-500);
	margin-top: 6px;
}

.mcl-checklist-list {
	list-style: none;
	margin: 0 0 16px;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.mcl-checklist-item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}
.mcl-checklist-dot {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 2px solid var(--mcl-gray-300);
	flex-shrink: 0;
	margin-top: 1px;
	position: relative;
}
.mcl-checklist-item.is-done .mcl-checklist-dot {
	border-color: var(--mcl-ok);
	background: var(--mcl-ok);
}
.mcl-checklist-item.is-done .mcl-checklist-dot::after {
	content: "";
	position: absolute;
	left: 4px;
	top: 1px;
	width: 4px;
	height: 8px;
	border-right: 2px solid var(--mcl-white);
	border-bottom: 2px solid var(--mcl-white);
	transform: rotate(45deg);
}
.mcl-checklist-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.mcl-checklist-label {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--mcl-gray-500);
}
.mcl-checklist-item.is-done .mcl-checklist-label {
	color: var(--mcl-black);
}
.mcl-checklist-value {
	font-size: 12px;
	color: var(--mcl-black);
	margin-top: 1px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.mcl-checklist-value:empty {
	display: none;
}
.mcl-checklist-footnote {
	font-size: 11px;
	color: var(--mcl-gray-500);
	line-height: 1.5;
	margin: 0;
	padding-top: 14px;
	border-top: 1px solid var(--mcl-gray-200);
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
	.mcl-chat-body {
		flex-direction: column;
	}
	.mcl-chat-checklist {
		width: auto;
		border-left: none;
		border-top: 1px solid var(--mcl-gray-200);
	}
	.mcl-chat-messages {
		max-height: none;
	}
}

@media (max-width: 480px) {
	.mcl-chat-widget--floating .mcl-chat-panel {
		right: 8px;
		left: 8px;
		bottom: 88px;
		width: auto;
		max-width: none;
	}
	.mcl-chat-widget--floating {
		right: 12px;
		bottom: 12px;
	}
	.mcl-turn-user {
		margin-left: 8px;
	}
}
