/* Chat IA — cristal oscuro, estilo Apple. Cada web puede cambiar los colores redefiniendo estas variables en su tema. */
.pauchat {
	--pauchat-accent: #5ee6c3;
	--pauchat-accent-2: #34cfa9;
	--pauchat-accent-fg: #052018;
	--pauchat-bg: rgba(17, 19, 26, .74);
	--pauchat-fg: #f5f5f7;
	--pauchat-muted: #a9acb8;
	--pauchat-bot: rgba(255, 255, 255, .08);
	--pauchat-line: rgba(255, 255, 255, .13);
	--pauchat-ease: cubic-bezier(.22, .9, .28, 1.04);
	position: fixed; right: var(--pauchat-r, 22px); left: var(--pauchat-l, auto); bottom: calc(var(--pauchat-b, 22px) + env(safe-area-inset-bottom)); z-index: 99990;
	font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}
.pauchat *, .pauchat *::before, .pauchat *::after { box-sizing: border-box; }
.pauchat [hidden] { display: none !important; }
.pauchat-pre { visibility: hidden; }

/* ── Burbuja (el logo) ── */
.pauchat-fab {
	position: relative; display: block; width: 66px; height: 66px; margin-left: auto; padding: 0; border: 0; border-radius: 22px;
	background: #101218; cursor: pointer; opacity: 0; transform: translateY(26px) scale(.4);
	box-shadow: 0 12px 34px rgba(0, 0, 0, .42), 0 0 0 1px rgba(255, 255, 255, .12);
	transition: transform .35s var(--pauchat-ease), box-shadow .35s;
}
.pauchat-show .pauchat-fab { animation: pauchat-pop 1s var(--pauchat-ease) forwards; }
.pauchat-fab:hover { transform: scale(1.07); box-shadow: 0 16px 42px rgba(0, 0, 0, .5), 0 0 0 1px color-mix(in srgb, var(--pauchat-accent) 55%, transparent); }
.pauchat-fab:active { transform: scale(.95); }
.pauchat-fab:focus-visible, .pauchat-x:focus-visible, .pauchat-send:focus-visible, .pauchat-chip:focus-visible,
.pauchat-teaser-text:focus-visible, .pauchat-teaser-x:focus-visible { outline: 2px solid var(--pauchat-accent); outline-offset: 3px; }
.pauchat-fab-av { position: relative; display: block; width: 100%; height: 100%; border-radius: 22px; object-fit: cover; z-index: 1; }
.pauchat-av-fallback { display: flex; align-items: center; justify-content: center; background: var(--pauchat-accent); color: var(--pauchat-accent-fg); }
/* Halo mentolado que gira despacio detrás de la burbuja. */
.pauchat-glow {
	position: absolute; inset: -9px; border-radius: 30px; z-index: 0; opacity: 0; filter: blur(13px);
	background: conic-gradient(from 0deg, var(--pauchat-accent), #7aa8ff, #ffffff, var(--pauchat-accent));
}
.pauchat-show .pauchat-glow { animation: pauchat-halo 3.4s ease-out .5s 1 forwards, pauchat-spin 9s linear infinite; }
@keyframes pauchat-pop {
	0% { opacity: 0; transform: translateY(26px) scale(.4); filter: blur(10px); }
	55% { opacity: 1; transform: translateY(-5px) scale(1.09); filter: blur(0); }
	100% { opacity: 1; transform: none; filter: none; }
}
@keyframes pauchat-halo { 0% { opacity: 0; } 25% { opacity: .75; } 100% { opacity: .22; } }
@keyframes pauchat-spin { to { transform: rotate(360deg); } }

/* Lado izquierdo: se refleja la disposición. */
.pauchat-left .pauchat-fab { margin-left: 0; margin-right: auto; }
.pauchat-left .pauchat-panel { right: auto; left: 0; transform-origin: bottom left; }
.pauchat-left .pauchat-teaser { right: auto; left: 78px; transform-origin: left center; }

/* ── Saludo junto a la burbuja ── */
.pauchat-teaser {
	position: absolute; right: 78px; bottom: 11px; display: flex; align-items: center; gap: 2px; width: max-content; max-width: min(300px, calc(100vw - 120px));
	padding: 4px 4px 4px 4px; border-radius: 20px; color: var(--pauchat-fg); background: var(--pauchat-bg);
	border: 1px solid var(--pauchat-line); box-shadow: 0 14px 36px rgba(0, 0, 0, .4);
	-webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
	opacity: 0; transform: translateX(22px) scale(.9); transform-origin: right center; transition: opacity .45s, transform .6s var(--pauchat-ease);
}
.pauchat-teaser.is-in { opacity: 1; transform: none; }
.pauchat-teaser-text { border: 0; background: none; color: inherit; font: inherit; font-weight: 500; text-align: left; padding: 8px 6px 8px 14px; cursor: pointer; }
.pauchat-teaser-x { border: 0; background: none; color: var(--pauchat-muted); font-size: 20px; line-height: 1; padding: 6px 10px 6px 4px; cursor: pointer; }

/* ── Panel ── */
.pauchat-panel {
	position: absolute; right: 0; bottom: 82px; width: min(400px, calc(100vw - 24px)); height: min(640px, calc(100vh - 120px)); min-height: 380px;
	display: flex; flex-direction: column; overflow: hidden; border-radius: 28px; color: var(--pauchat-fg);
	background: radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--pauchat-accent) 14%, transparent), transparent 60%), linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0) 38%), var(--pauchat-bg);
	border: 1px solid var(--pauchat-line);
	box-shadow: 0 34px 90px rgba(0, 0, 0, .55), 0 2px 0 rgba(255, 255, 255, .07) inset;
	-webkit-backdrop-filter: blur(34px) saturate(190%); backdrop-filter: blur(34px) saturate(190%);
	opacity: 0; transform: translateY(18px) scale(.92); filter: blur(10px); transform-origin: bottom right;
	transition: opacity .35s ease, transform .55s var(--pauchat-ease), filter .45s ease;
}
.pauchat-panel.is-open { opacity: 1; transform: none; filter: none; }

.pauchat-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 18px; border-bottom: 1px solid var(--pauchat-line); }
.pauchat-head-av { width: 44px; height: 44px; flex: none; border-radius: 14px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255, 255, 255, .14); }
.pauchat-who { flex: 1; min-width: 0; }
.pauchat-namerow { display: flex; align-items: center; gap: 8px; }
.pauchat-title { font-weight: 650; font-size: 16px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pauchat-badge { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border-radius: 99px; background: color-mix(in srgb, var(--pauchat-accent) 16%, transparent); color: var(--pauchat-accent); border: 1px solid color-mix(in srgb, var(--pauchat-accent) 35%, transparent); }
.pauchat-status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--pauchat-muted); }
.pauchat-online { width: 7px; height: 7px; border-radius: 50%; background: var(--pauchat-accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--pauchat-accent) 60%, transparent); animation: pauchat-live 2.2s infinite; }
@keyframes pauchat-live { 70% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--pauchat-accent) 0%, transparent); } 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pauchat-accent) 0%, transparent); } }
.pauchat-lang { display: inline-flex; gap: 2px; padding: 2px; border-radius: 99px; background: rgba(255, 255, 255, .08); border: 1px solid var(--pauchat-line); margin-right: 2px; }
.pauchat-lang button { border: 0; background: none; color: var(--pauchat-muted); font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; padding: 4px 7px; border-radius: 99px; cursor: pointer; transition: background .2s, color .2s; }
.pauchat-lang button:hover { color: var(--pauchat-fg); }
.pauchat-lang button[aria-pressed="true"] { background: var(--pauchat-accent); color: var(--pauchat-accent-fg); }
.pauchat-lang button:focus-visible { outline: 2px solid var(--pauchat-accent); outline-offset: 1px; }
.pauchat-new { width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .08); color: var(--pauchat-fg); font-size: 17px; line-height: 1; cursor: pointer; transition: background .2s; margin-right: 2px; }
.pauchat-new:hover { background: rgba(255, 255, 255, .16); }
.pauchat-new[hidden] { display: none; }
.pauchat-x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .08); color: var(--pauchat-fg); font-size: 20px; line-height: 1; cursor: pointer; transition: background .2s; }
.pauchat-x:hover { background: rgba(255, 255, 255, .16); }

/* ── Conversación ── */
.pauchat-log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain; }
.pauchat-log::-webkit-scrollbar { width: 6px; }
.pauchat-log::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 6px; }
.pauchat-msg { max-width: 86%; padding: 10px 14px; border-radius: 20px; overflow-wrap: anywhere; animation: pauchat-rise .42s var(--pauchat-ease) both; }
.pauchat-msg p { margin: 0 0 8px; }
.pauchat-msg p:last-child { margin-bottom: 0; }
.pauchat-bot { align-self: flex-start; background: var(--pauchat-bot); border: 1px solid var(--pauchat-line); border-bottom-left-radius: 7px; }
.pauchat-user { align-self: flex-end; color: var(--pauchat-accent-fg); font-weight: 500; background: linear-gradient(160deg, var(--pauchat-accent), var(--pauchat-accent-2)); border-bottom-right-radius: 7px; box-shadow: 0 6px 18px rgba(52, 207, 169, .25); }
.pauchat-msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
@keyframes pauchat-rise { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

.pauchat-typing { display: flex; gap: 5px; align-items: center; padding: 14px 16px; }
.pauchat-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--pauchat-muted); animation: pauchat-dot 1.2s infinite ease-in-out; }
.pauchat-typing i:nth-child(2) { animation-delay: .15s; }
.pauchat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes pauchat-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }

.pauchat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 10px; }
.pauchat-chips:empty { display: none; }
.pauchat-chip {
	border: 1px solid color-mix(in srgb, var(--pauchat-accent) 40%, transparent); background: color-mix(in srgb, var(--pauchat-accent) 8%, transparent); color: var(--pauchat-fg); font: inherit; font-size: 13.5px;
	padding: 8px 13px; border-radius: 99px; cursor: pointer; text-align: left; animation: pauchat-rise .5s var(--pauchat-ease) both; transition: background .2s, transform .2s;
}
.pauchat-chip:hover { background: color-mix(in srgb, var(--pauchat-accent) 20%, transparent); transform: translateY(-1px); }

.pauchat-note { padding: 8px 18px 6px; font-size: 11.5px; line-height: 1.4; color: var(--pauchat-muted); }
.pauchat-note a { color: var(--pauchat-fg); }
.pauchat-test { margin-top: 3px; color: #ffd166; font-weight: 600; }

.pauchat-form { display: flex; align-items: flex-end; gap: 8px; margin: 4px 12px 12px; padding: 5px 5px 5px 16px; border-radius: 24px; background: rgba(255, 255, 255, .08); border: 2px solid var(--pauchat-line); transition: border-color .25s, box-shadow .25s; }
.pauchat-form:focus-within { border-color: color-mix(in srgb, var(--pauchat-accent) 60%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pauchat-accent) 14%, transparent); }
.pauchat textarea:focus, .pauchat textarea:focus-visible { outline: none; box-shadow: none; }
.pauchat textarea { flex: 1; resize: none; max-height: 110px; padding: 8px 0; border: 0; background: none; font: inherit; color: var(--pauchat-fg); outline: none; }
.pauchat textarea::placeholder { color: var(--pauchat-muted); }
.pauchat-send { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--pauchat-accent-fg); background: linear-gradient(160deg, var(--pauchat-accent), var(--pauchat-accent-2)); transition: transform .2s, opacity .2s; }
.pauchat-send:hover { transform: scale(1.08); }
.pauchat-send:disabled { opacity: .45; cursor: default; transform: none; }

@media (max-width: 520px) {
	.pauchat-fab { width: 44px; height: 44px; border-radius: 15px; }
	.pauchat-fab-av { border-radius: 15px; }
	/* Doble selector: con el chat a la izquierda (.pauchat-left) la regla de escritorio pesaba más y el panel se salía de la pantalla. */
	.pauchat .pauchat-panel, .pauchat-left .pauchat-panel {
		position: fixed; left: 8px; right: 8px; width: auto; max-width: none; min-height: 0; border-radius: 22px; transform-origin: bottom center;
		bottom: calc(var(--pauchat-b, 14px) + 62px + env(safe-area-inset-bottom)); height: min(calc(100vh - 200px), 700px); height: min(calc(100dvh - 200px), 700px);
	}
	.pauchat-head { padding: 12px 12px 10px 14px; gap: 10px; }
	.pauchat-head > * { min-width: 0; }
	.pauchat-head-av { width: 38px; height: 38px; }
	.pauchat-log { padding: 14px 12px 6px; min-height: 150px; }
	.pauchat-msg { max-width: 92%; font-size: 14px; padding: 9px 13px; }
	/* Las sugerencias se muestran enteras (se parten en varias lineas), nunca cortadas a un lado. */
	.pauchat-chips { flex-wrap: wrap; gap: 7px; padding: 0 12px 8px; }
	.pauchat-chip { white-space: normal; max-width: 100%; font-size: 13.5px; line-height: 1.3; padding: 7px 13px; }
	.pauchat-note { padding: 4px 14px; font-size: 10.5px; line-height: 1.35; }
	.pauchat-form { margin: 4px 8px 8px; }
	/* La burbuja de saludo no puede salirse de la pantalla, sea cual sea el margen del boton (derecha o izquierda). */
	.pauchat-teaser { right: 54px; font-size: 13.5px; max-width: calc(100vw - var(--pauchat-r, 22px) - 54px - 10px); }
	.pauchat-left .pauchat-teaser { right: auto; left: 56px; font-size: 13.5px; max-width: calc(100vw - var(--pauchat-l, 22px) - 56px - 10px); }
}
@media (prefers-reduced-motion: reduce) {
	.pauchat *, .pauchat *::before, .pauchat *::after { animation: none !important; transition: none !important; }
	.pauchat-fab { opacity: 1; transform: none; }
	.pauchat-panel { filter: none; }
}

.pauchat-who { min-width: 0; flex: 1 1 auto; }
.pauchat-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* La caja de escribir es solo la cápsula redondeada (.pauchat-form): el campo de dentro nunca lleva borde, contorno ni sombra propios,
   ni siquiera si el tema o el navegador móvil intentan pintárselos al enfocar o pulsar. */
.pauchat .pauchat-form textarea,
.pauchat .pauchat-form textarea:hover,
.pauchat .pauchat-form textarea:focus,
.pauchat .pauchat-form textarea:focus-visible,
.pauchat .pauchat-form textarea:active {
	border: 0 !important; outline: 0 !important; box-shadow: none !important; background: transparent !important; border-radius: 0 !important;
	-webkit-appearance: none; appearance: none; margin: 0 !important; padding: 8px 0 !important; min-height: 0;
	-webkit-tap-highlight-color: transparent;
}
