/* El Codaíno — estilo moderno y liviano (tema Codao Moderno). */
.codaino {
	--c-verde: #34492C;
	--c-verde-osc: #3A2E22;
	--c-sol: #E8A83E;
	--c-tinta: #17191A;
	--c-suave: #6B6F6C;
	--c-borde: rgba(23, 25, 26, 0.08);
	--c-fondo: #FFFFFF;
	--c-burbuja: #F3F2ED;

	display: flex;
	flex-direction: column;
	height: min(86vh, 860px);
	border: 1px solid var(--c-borde);
	border-radius: 28px;
	background: var(--c-fondo);
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(23, 25, 26, 0.04), 0 24px 60px -24px rgba(15, 31, 23, 0.18);
}

/* Cabecera clara con avatar */
.codaino__cabecera {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--c-borde);
	background: rgba(255, 255, 255, 0.9);
	color: var(--c-tinta);
}

.codaino__cabecera > div {
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr;
	column-gap: 0.8rem;
	align-items: center;
}

.codaino__cabecera > div::before {
	content: "";
	grid-row: 1 / 3;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background:
		radial-gradient(circle at 50% 38%, #F4C977 0 30%, var(--c-sol) 31% 46%, transparent 47%),
		linear-gradient(180deg, #FFF4DC 0 62%, var(--c-verde) 63%);
	box-shadow: inset 0 0 0 1px var(--c-borde);
}

.codaino__cabecera > div::after {
	content: "";
	position: absolute;
	left: 31px;
	top: 31px;
	width: 11px;
	height: 11px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: #2EB872;
}

.codaino__cabecera p {
	margin: 0;
	line-height: 1.2;
}

.codaino__nombre {
	font-family: var(--wp--preset--font-family--comfortaa, sans-serif);
	font-weight: 800;
	font-size: 1.05rem;
	letter-spacing: -0.02em;
}

.codaino__lema {
	color: var(--c-suave);
	font-size: 0.8rem;
}

.codaino__reiniciar {
	display: flex;
	padding: 0.5rem;
	border: 0;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.3s ease;
}

.codaino__reiniciar svg {
	width: 20px;
	height: 20px;
	fill: var(--c-suave);
}

.codaino__reiniciar:hover {
	background: var(--c-burbuja);
	transform: rotate(-90deg);
}

/* Mensajes */
.codaino__mensajes {
	flex: 1;
	padding: 1.5rem 1.25rem 0.5rem;
	overflow-y: auto;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	scrollbar-color: rgba(23, 25, 26, 0.15) transparent;
}

.codaino__msj {
	display: flex;
	margin-bottom: 0.75rem;
	animation: codaino-entra 0.25s ease-out;
}

.codaino__msj--yo {
	justify-content: flex-end;
}

.codaino__burbuja {
	max-width: min(80%, 620px);
	padding: 0.75rem 1.05rem;
	border-radius: 20px;
	font-size: 0.97rem;
	line-height: 1.6;
	overflow-wrap: anywhere;
}

.codaino__burbuja p {
	margin: 0 0 0.6rem;
}

.codaino__burbuja p:last-child {
	margin-bottom: 0;
}

.codaino__burbuja ul {
	margin: 0.3rem 0 0.6rem;
	padding-left: 1.2rem;
}

.codaino__msj--yo .codaino__burbuja {
	background: var(--c-verde);
	color: #FFFFFF;
	border-bottom-right-radius: 6px;
}

.codaino__msj--ia .codaino__burbuja {
	background: var(--c-burbuja);
	color: var(--c-tinta);
	border-bottom-left-radius: 6px;
}

.codaino__msj--ia .codaino__burbuja a {
	color: var(--c-verde);
	font-weight: 600;
}

@keyframes codaino-entra {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

/* Escribiendo… */
.codaino__puntos {
	display: flex;
	gap: 5px;
	padding: 0.2rem 0;
}

.codaino__puntos span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--c-suave);
	animation: codaino-salto 1.2s infinite ease-in-out;
}

.codaino__puntos span:nth-child(2) {
	animation-delay: 0.15s;
}

.codaino__puntos span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes codaino-salto {
	0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
	40% { transform: translateY(-4px); opacity: 1; }
}

/* Sugerencias */
.codaino__sugerencias {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	padding: 0 1.25rem 0.75rem;
}

.codaino__sugerencias[hidden] {
	display: none;
}

.codaino__sugerencias button {
	padding: 0.5rem 0.95rem;
	border: 1px solid var(--c-borde);
	border-radius: 999px;
	background: #FFFFFF;
	color: var(--c-tinta);
	font: inherit;
	font-size: 0.85rem;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.codaino__sugerencias button:hover {
	background: #FFF6E3;
	border-color: rgba(232, 168, 62, 0.6);
}

/* Barra de escritura tipo cápsula */
.codaino__entrada {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0 1rem 1rem;
	padding: 0.35rem 0.35rem 0.35rem 1.1rem;
	border: 1px solid var(--c-borde);
	border-radius: 999px;
	background: var(--c-burbuja);
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.codaino__entrada:focus-within {
	border-color: rgba(31, 77, 58, 0.35);
	background: #FFFFFF;
	box-shadow: 0 0 0 4px rgba(31, 77, 58, 0.08);
}

.codaino__entrada input {
	flex: 1;
	min-width: 0;
	padding: 0.6rem 0;
	border: 0;
	background: transparent;
	color: var(--c-tinta);
	font: inherit;
	font-size: 16px;
}

.codaino__entrada input:focus {
	outline: none;
}

.codaino__entrada input::placeholder {
	color: var(--c-suave);
}

.codaino__entrada button {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 50%;
	background: var(--c-verde);
	cursor: pointer;
	transition: transform 0.15s ease, background 0.15s ease;
}

.codaino__entrada button:hover {
	background: var(--c-verde-osc);
	transform: scale(1.05);
}

.codaino__entrada button:disabled {
	opacity: 0.45;
	cursor: wait;
	transform: none;
}

.codaino__entrada svg {
	width: 18px;
	height: 18px;
	margin-left: 2px;
	fill: #FFFFFF;
}

/* Voz y avisos */
.codaino-voz {
	margin-top: 1.4rem;
	text-align: center;
}

.codaino-voz .wp-element-button {
	background: #FFFFFF;
	color: var(--wp--preset--color--tinta, #17191A);
	border: 1px solid rgba(23, 25, 26, 0.12);
	box-shadow: 0 1px 2px rgba(23, 25, 26, 0.05);
}

.codaino-voz .wp-element-button:hover {
	border-color: rgba(232, 168, 62, 0.7);
	background: #FFF6E3;
}

.codao-aviso-ia {
	max-width: 620px;
	margin: 1.2rem auto 0;
	padding-left: 1.2rem;
	color: #6B6F6C;
	font-size: 0.85rem;
	opacity: 1;
}

@media (max-width: 600px) {
	.codaino {
		height: min(80vh, 760px);
		border-radius: 22px;
	}
	.codaino__burbuja {
		max-width: 88%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.codaino__msj, .codaino__puntos span { animation: none; }
}
