/* Asistente Copropiedad — hereda la tipografía del tema para integrarse al sitio. */

.copro-root {
	--copro-accent: #1f5f5b;
	--copro-accent-soft: #e6efee;
	--copro-ink: #1d2422;
	--copro-muted: #5c6663;
	--copro-line: #dde3e1;
	--copro-surface: #ffffff;
	--copro-bg: #f5f7f6;
	position: fixed;
	bottom: 20px;
	z-index: 99990;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	color: var(--copro-ink);
	display: flex;
	flex-direction: column;
	gap: 12px;
}

@supports (background: color-mix(in srgb, red 10%, white)) {
	.copro-root {
		--copro-accent-soft: color-mix(in srgb, var(--copro-accent) 11%, white);
	}
}

.copro-root *,
.copro-root *::before,
.copro-root *::after {
	box-sizing: border-box;
}

.copro-pos-right { right: 20px; align-items: flex-end; }
.copro-pos-left  { left: 20px;  align-items: flex-start; }

/* Botón de apertura */
.copro-launcher {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 12px 18px 12px 14px;
	border: 0;
	border-radius: 999px;
	background: var(--copro-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	box-shadow: 0 6px 18px -6px rgba(20, 40, 38, 0.45);
}

.copro-launcher:hover { filter: brightness(1.08); }

.copro-root.is-open .copro-launcher-text { display: none; }
.copro-root.is-open .copro-launcher { padding: 12px; }

/* Panel */
.copro-panel {
	width: min(380px, calc(100vw - 40px));
	height: min(560px, calc(100vh - 120px));
	display: flex;
	flex-direction: column;
	background: var(--copro-surface);
	border: 1px solid var(--copro-line);
	border-radius: 18px 18px 6px 18px;
	box-shadow: 0 24px 48px -20px rgba(20, 40, 38, 0.35);
	overflow: hidden;
}

.copro-pos-left .copro-panel { border-radius: 18px 18px 18px 6px; }
.copro-panel[hidden] { display: none; }

.copro-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 12px 14px 18px;
	border-top: 4px solid var(--copro-accent);
	border-bottom: 1px solid var(--copro-line);
}

.copro-title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--copro-ink);
}

.copro-subtitle {
	margin: 2px 0 0;
	font-size: 13px;
	color: var(--copro-muted);
}

.copro-actions { display: flex; gap: 2px; }

.copro-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--copro-muted);
	cursor: pointer;
}

.copro-icon-btn:hover { background: var(--copro-bg); color: var(--copro-ink); }

/* Conversación */
.copro-log {
	flex: 1;
	overflow-y: auto;
	padding: 18px;
	background: var(--copro-bg);
	display: flex;
	flex-direction: column;
	gap: 14px;
	overscroll-behavior: contain;
}

.copro-msg {
	max-width: 88%;
	word-wrap: break-word;
}

.copro-msg p { margin: 0 0 6px; }
.copro-msg p:last-child { margin-bottom: 0; }
.copro-msg ul { margin: 4px 0 6px; padding-left: 18px; }
.copro-msg li { margin: 2px 0; }

.copro-assistant {
	align-self: flex-start;
	padding: 2px 0 2px 12px;
	border-left: 2px solid var(--copro-accent);
}

.copro-welcome { color: var(--copro-muted); }

.copro-user {
	align-self: flex-end;
	padding: 9px 13px;
	background: var(--copro-accent);
	color: #fff;
	border-radius: 14px 14px 4px 14px;
	white-space: pre-wrap;
}

.copro-error { border-left-color: #b4432f; color: #7a2c1f; }

.copro-sources {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	font-size: 13px;
}

.copro-sources-label { color: var(--copro-muted); }

.copro-source {
	display: inline-block;
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--copro-accent-soft);
	color: var(--copro-accent);
	text-decoration: none;
	font-weight: 600;
}

.copro-source:hover { text-decoration: underline; }

/* Indicador de escritura */
.copro-typing { display: flex; gap: 5px; padding: 8px 0 8px 12px; }
.copro-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--copro-accent);
	opacity: 0.35;
	animation: copro-blink 1.2s infinite ease-in-out;
}
.copro-typing span:nth-child(2) { animation-delay: 0.15s; }
.copro-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes copro-blink {
	0%, 80%, 100% { opacity: 0.25; }
	40% { opacity: 1; }
}

/* Formulario */
.copro-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin: 0;
	padding: 12px 12px 6px;
	border-top: 1px solid var(--copro-line);
	background: var(--copro-surface);
}

.copro-input {
	flex: 1;
	min-height: 42px;
	max-height: 120px;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid var(--copro-line);
	border-radius: 12px;
	background: var(--copro-surface);
	color: var(--copro-ink);
	font: inherit;
	line-height: 1.4;
	resize: none;
	box-shadow: none;
}

.copro-input:focus { outline: none; border-color: var(--copro-accent); }

.copro-send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 42px;
	width: 42px;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: var(--copro-accent);
	color: #fff;
	cursor: pointer;
}

.copro-send:disabled { opacity: 0.5; cursor: wait; }

.copro-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
}

.copro-note {
	margin: 0;
	padding: 0 14px 10px;
	font-size: 12px;
	color: var(--copro-muted);
	background: var(--copro-surface);
}

/* Accesibilidad */
.copro-root button:focus-visible,
.copro-root a:focus-visible,
.copro-input:focus-visible {
	outline: 2px solid var(--copro-accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.copro-typing span { animation: none; opacity: 0.6; }
}

/* Móvil: panel a ancho completo */
@media (max-width: 520px) {
	.copro-root { bottom: 12px; }
	.copro-pos-right { right: 12px; }
	.copro-pos-left { left: 12px; }

	.copro-root.is-open { left: 0; right: 0; bottom: 0; align-items: stretch; gap: 0; }
	.copro-root.is-open .copro-launcher { display: none; }

	.copro-panel,
	.copro-pos-left .copro-panel {
		width: 100%;
		height: 85vh;
		height: 85dvh;
		border-radius: 18px 18px 0 0;
		border-bottom: 0;
	}

	.copro-input { font-size: 16px; } /* evita zoom en iOS */
}
