/* LegalFA · Asistente Sofía — ventana de chat */
.lfa-ai, .lfa-ai * { box-sizing: border-box; }
.lfa-ai { --lfa-dark: #0B0E18; --lfa-dark2: #1a1e2e; --lfa-gold: #C9A961; --lfa-gold2: #b8964e; --lfa-bg: #f5f5f3; --lfa-text: #1f2230; font-family: 'Source Sans Pro', 'Open Sans', Arial, sans-serif; }

/* Botón flotante (encima del botón de WhatsApp) */
.lfa-ai-launcher { position: fixed; right: 20px; bottom: 96px; z-index: 2147483000; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; cursor: pointer; }
.lfa-ai-launcher .lfa-ai-bubble { width: 58px; height: 58px; border-radius: 50%; background: var(--lfa-dark); border: 2px solid var(--lfa-gold); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 22px rgba(0,0,0,.28); transition: transform .2s ease; }
.lfa-ai-launcher:hover .lfa-ai-bubble, .lfa-ai-launcher:focus-visible .lfa-ai-bubble { transform: scale(1.06); }
.lfa-ai-launcher svg { width: 26px; height: 26px; fill: var(--lfa-gold); }
.lfa-ai-launcher .lfa-ai-tip { background: var(--lfa-dark); color: #fff; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 18px; box-shadow: 0 6px 18px rgba(0,0,0,.22); white-space: nowrap; opacity: 0; transform: translateX(8px); transition: all .2s ease; pointer-events: none; }
.lfa-ai-launcher:hover .lfa-ai-tip, .lfa-ai-launcher:focus-visible .lfa-ai-tip, .lfa-ai-launcher.lfa-ai-tease .lfa-ai-tip { opacity: 1; transform: none; }
.lfa-ai-open .lfa-ai-launcher { display: none; }

/* Panel */
.lfa-ai-panel { position: fixed; right: 20px; bottom: 20px; z-index: 2147483001; width: 380px; height: min(620px, calc(100vh - 40px)); background: #fff; border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.32); display: none; flex-direction: column; overflow: hidden; color: var(--lfa-text); }
.lfa-ai-open .lfa-ai-panel { display: flex; }

.lfa-ai-head { background: linear-gradient(135deg, var(--lfa-dark) 0%, var(--lfa-dark2) 100%); color: #fff; padding: 14px 14px 14px 16px; display: flex; align-items: center; gap: 12px; border-bottom: 2px solid var(--lfa-gold); }
.lfa-ai-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--lfa-gold); color: var(--lfa-dark); font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 20px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.lfa-ai-title { flex: 1 1 auto; min-width: 0; }
.lfa-ai-title strong { display: block; font-size: 16px; line-height: 1.2; color: #fff; }
.lfa-ai-title span { display: block; font-size: 12px; color: rgba(255,255,255,.72); line-height: 1.3; }
.lfa-ai-badge { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; letter-spacing: .5px; background: #b32d2e; color: #fff; padding: 2px 6px; border-radius: 3px; vertical-align: middle; }
.lfa-ai-close { background: none; border: 0; color: #fff; font-size: 26px; line-height: 1; width: 36px; height: 36px; border-radius: 6px; cursor: pointer; }
.lfa-ai-close:hover, .lfa-ai-close:focus-visible { background: rgba(255,255,255,.1); }

/* Cuerpo */
.lfa-ai-body { flex: 1 1 auto; overflow-y: auto; background: var(--lfa-bg); padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.lfa-ai-msg { max-width: 88%; padding: 10px 13px; border-radius: 12px; font-size: 14.5px; line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere; }
.lfa-ai-msg p { margin: 0 0 8px; } .lfa-ai-msg p:last-child { margin-bottom: 0; }
.lfa-ai-msg ul, .lfa-ai-msg ol { margin: 4px 0 8px 18px; padding: 0; } .lfa-ai-msg li { margin: 2px 0; }
.lfa-ai-msg a { color: #8a6d2f; text-decoration: underline; font-weight: 600; }
.lfa-ai-bot { align-self: flex-start; background: #fff; border: 1px solid #e3e3df; border-top-left-radius: 4px; }
.lfa-ai-user { align-self: flex-end; background: var(--lfa-dark); color: #fff; border-top-right-radius: 4px; white-space: pre-wrap; }
.lfa-ai-error { align-self: flex-start; background: #fff4f4; border: 1px solid #f0c9c9; color: #7a1f1f; }
.lfa-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.lfa-ai-chip { background: #fff; border: 1px solid var(--lfa-gold); color: var(--lfa-dark); border-radius: 16px; padding: 6px 11px; font-size: 13px; cursor: pointer; font-family: inherit; }
.lfa-ai-chip:hover, .lfa-ai-chip:focus-visible { background: var(--lfa-gold); }
.lfa-ai-typing { align-self: flex-start; background: #fff; border: 1px solid #e3e3df; border-radius: 12px; padding: 12px 14px; display: inline-flex; gap: 4px; }
.lfa-ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9a9a9a; animation: lfa-ai-dot 1.2s infinite ease-in-out; }
.lfa-ai-typing i:nth-child(2) { animation-delay: .15s; } .lfa-ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes lfa-ai-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Aviso inicial (IA y datos personales) */
.lfa-ai-consent { background: #fff; border: 1px solid #e3e3df; border-radius: 12px; padding: 16px; font-size: 14px; line-height: 1.55; }
.lfa-ai-consent h3 { font-family: 'Playfair Display', Georgia, serif; font-size: 18px; margin: 0 0 8px; color: var(--lfa-dark); }
.lfa-ai-consent p { margin: 0 0 10px; }
.lfa-ai-consent a { color: #8a6d2f; font-weight: 600; }
.lfa-ai-accept { width: 100%; margin-top: 4px; background: var(--lfa-gold); color: var(--lfa-dark); border: 0; border-radius: 6px; padding: 11px 14px; font-weight: 700; font-size: 14px; letter-spacing: .3px; cursor: pointer; font-family: inherit; }
.lfa-ai-accept:hover, .lfa-ai-accept:focus-visible { background: var(--lfa-gold2); }

/* Pie */
.lfa-ai-foot { border-top: 1px solid #e3e3df; background: #fff; padding: 10px 12px 8px; }
.lfa-ai-form { display: flex; align-items: flex-end; gap: 8px; }
.lfa-ai-input { flex: 1 1 auto; resize: none; border: 1px solid #d6d6d0; border-radius: 10px; padding: 9px 11px; font-size: 14.5px; line-height: 1.4; max-height: 110px; min-height: 40px; font-family: inherit; color: var(--lfa-text); background: #fff; }
.lfa-ai-input:focus { outline: none; border-color: var(--lfa-gold); box-shadow: 0 0 0 2px rgba(201,169,97,.25); }
.lfa-ai-send { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 10px; border: 0; background: var(--lfa-gold); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lfa-ai-send svg { width: 20px; height: 20px; fill: var(--lfa-dark); }
.lfa-ai-send:disabled { opacity: .45; cursor: default; }
.lfa-ai-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.lfa-ai-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 7px; font-size: 11.5px; color: #636363; }
.lfa-ai-meta a { color: #1f7a3a; font-weight: 700; text-decoration: none; white-space: nowrap; }
.lfa-ai-meta a:hover { text-decoration: underline; }
.lfa-ai-count { color: #b32d2e; }

@media (max-width: 600px) {
	.lfa-ai-launcher { right: 16px; bottom: 88px; }
	.lfa-ai-launcher .lfa-ai-tip { display: none; }
	.lfa-ai-panel { right: 0; bottom: 0; left: 0; top: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
	html.lfa-ai-open, html.lfa-ai-open body { overflow: hidden; }
	.lfa-ai-msg { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .lfa-ai * { animation: none !important; transition: none !important; } }

/* Transferencia a WhatsApp al cumplir el tiempo máximo */
.lfa-ai-handoff p { margin: 0 0 12px; }
.lfa-ai-wa-btn { display: block; text-align: center; text-decoration: none !important; background: #25D366 !important; color: #fff !important; }
.lfa-ai-wa-btn:hover, .lfa-ai-wa-btn:focus-visible { background: #1ebe5a !important; }

/* Aislar los botones del estilo general del tema (Astra pone relleno, mayúsculas y fondo al pasar el cursor) */
.lfa-ai button { text-transform: none; letter-spacing: normal; box-shadow: none; min-height: 0; font-family: inherit; }
.lfa-ai .lfa-ai-launcher, .lfa-ai .lfa-ai-launcher:hover, .lfa-ai .lfa-ai-launcher:focus { background: none; border: 0; padding: 0; color: inherit; }
.lfa-ai .lfa-ai-close, .lfa-ai .lfa-ai-close:focus { background: none; color: #fff; padding: 0; border: 0; }
.lfa-ai .lfa-ai-close:hover, .lfa-ai .lfa-ai-close:focus-visible { background: rgba(255,255,255,.1); color: #fff; }
.lfa-ai .lfa-ai-send, .lfa-ai .lfa-ai-send:focus, .lfa-ai .lfa-ai-send:disabled { background: var(--lfa-gold); color: var(--lfa-dark); padding: 0; border: 0; }
.lfa-ai .lfa-ai-send:hover, .lfa-ai .lfa-ai-send:focus-visible { background: var(--lfa-gold2); }
.lfa-ai .lfa-ai-send svg { flex: 0 0 20px; }
.lfa-ai .lfa-ai-chip, .lfa-ai .lfa-ai-chip:focus { background: #fff; color: var(--lfa-dark); border: 1px solid var(--lfa-gold); padding: 6px 11px; }
.lfa-ai .lfa-ai-chip:hover, .lfa-ai .lfa-ai-chip:focus-visible { background: var(--lfa-gold); color: var(--lfa-dark); }
.lfa-ai .lfa-ai-accept, .lfa-ai .lfa-ai-accept:focus { background: var(--lfa-gold); color: var(--lfa-dark); padding: 11px 14px; border: 0; letter-spacing: .3px; }
.lfa-ai .lfa-ai-accept:hover, .lfa-ai .lfa-ai-accept:focus-visible { background: var(--lfa-gold2); color: var(--lfa-dark); }
.lfa-ai-title .lfa-ai-badge { display: inline-block; }

/* 1.3.3 · Versión gratuita (preguntas limitadas) y versión premium (Plan IA) */
.lfa-ai .lfa-ai-tier { font-size: 12.5px; line-height: 1.45; color: #575756; background: #fff8e6; border-left: 3px solid var(--lfa-gold); padding: 8px 10px; border-radius: 6px; }
.lfa-ai .lfa-ai-tier a { color: var(--lfa-dark); text-decoration: underline; font-weight: 600; }
.lfa-ai .lfa-ai-plan-btn, .lfa-ai .lfa-ai-plan-btn:focus { display: block; text-align: center; text-decoration: none !important; background: var(--lfa-dark); color: #fff; margin-bottom: 8px; }
.lfa-ai .lfa-ai-plan-btn:hover, .lfa-ai .lfa-ai-plan-btn:focus-visible { background: var(--lfa-dark2); color: #fff; }
/* 1.3.4 · Aviso previo y traslado a WhatsApp: WhatsApp primero, versión premium debajo */
.lfa-ai .lfa-ai-consent .lfa-ai-tier { margin: 0 0 12px; }
.lfa-ai .lfa-ai-wa-btn + .lfa-ai-plan-btn { margin: 8px 0 0; }
