/* ─────────────────────────────────────────────────────────────────────────
   FaenApp Aprende · Eco, tu profesor (botón flotante + panel de chat)
   Usa los tokens de estilo.css (claro y oscuro): --accion, --resalte, --carta, --papel, --tinta…
   ───────────────────────────────────────────────────────────────────────── */

/* Botón de lección: "Pregúntale a Eco" */
.boton--eco { display: inline-flex; align-items: center; gap: 9px; }
.boton--eco .eco-chispa { width: 20px; height: 20px; border-radius: 50%; background: var(--brillo); display: inline-grid; place-items: center; box-shadow: 0 0 0 0 rgba(127, 196, 255, .7); animation: eco-latido 2.2s ease-out infinite; flex: none; }
.boton--eco .eco-chispa::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.marca-eco { font-size: 12px; font-weight: 600; color: var(--suave); }
@keyframes eco-latido { 0% { box-shadow: 0 0 0 0 rgba(127, 196, 255, .7); } 100% { box-shadow: 0 0 0 12px rgba(127, 196, 255, 0); } }

/* Franja "Conoce a Eco" en la portada */
.seccion--eco { background: radial-gradient(900px 400px at 85% 0%, rgba(18, 139, 236, .45), transparent 60%), linear-gradient(135deg, #02165a, #0437b3); color: #fff; }
.seccion--eco .seccion__kicker { color: var(--cielo); }
.seccion--eco h2 { color: #fff; }
.seccion--eco .seccion__bajada { color: rgba(255, 255, 255, .82); }
.eco-presentacion { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 40px; align-items: center; }
.eco-ejemplos { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.eco-ejemplo { padding: 10px 14px; border-radius: 999px; border: 1.5px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08); color: #fff; font: 600 14px Montserrat, sans-serif; cursor: pointer; transition: background .2s, transform .2s; }
.eco-ejemplo:hover { background: rgba(255, 255, 255, .18); transform: translateY(-2px); }
.eco-demo { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); border-radius: 22px; padding: 18px; display: grid; gap: 12px; }
.eco-demo .eco-msj--eco { background: #fff; color: #0a1230; }
.eco-demo .eco-msj--eco b { color: #0437b3; }
.eco-demo .eco-msj--eco .eco-camino { background: rgba(4, 55, 179, .08); color: #0437b3; }
.eco-demo .eco-msj--yo { background: rgba(255, 255, 255, .16); color: #fff; }
.animar .eco-demo .eco-msj { animation: eco-entra .5s ease backwards; }
.animar .eco-demo .eco-msj:nth-child(2) { animation-delay: .35s; } .animar .eco-demo .eco-msj:nth-child(3) { animation-delay: .7s; } .animar .eco-demo .eco-msj:nth-child(4) { animation-delay: 1.05s; }

/* Botón flotante */
.eco-flota { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: inline-flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 20px 0 12px; border: 0; border-radius: 999px; background: var(--accion); color: #fff; font: 700 15px Montserrat, sans-serif; cursor: pointer; box-shadow: 0 18px 40px -12px rgba(4, 55, 179, .7); transition: transform .25s ease, box-shadow .25s, background .2s; animation: eco-flotar 4.4s ease-in-out infinite; }
.eco-flota:hover { background: var(--accion-hover); box-shadow: 0 22px 44px -12px rgba(4, 55, 179, .8); }
.eco-flota .eco-avatar { width: 34px; height: 34px; }
.eco-flota[hidden] { display: none; }
@keyframes eco-flotar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.eco-avatar { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #7fc4ff, #128bec 55%, #0a5ad6); box-shadow: 0 0 0 0 rgba(127, 196, 255, .6); animation: eco-latido 2.4s ease-out infinite; flex: none; }
.eco-avatar::before { content: ''; width: 38%; height: 38%; border-radius: 50%; background: #fff; box-shadow: 0 0 10px rgba(255, 255, 255, .9); }
.eco-avatar--chica { width: 28px; height: 28px; animation: none; }

/* Burbuja de primera visita */
.eco-globo { position: fixed; right: 18px; bottom: 84px; z-index: 60; max-width: 260px; padding: 12px 14px; border-radius: 16px 16px 4px 16px; background: var(--carta); color: var(--tinta); font: 600 13.5px/1.4 Montserrat, sans-serif; box-shadow: var(--sombra-tarjeta), 0 0 0 1px var(--borde); animation: eco-entra .4s ease; cursor: pointer; }
.eco-globo b { color: var(--resalte); }
.eco-globo button { position: absolute; top: 6px; right: 8px; border: 0; background: transparent; color: var(--suave); font-size: 16px; cursor: pointer; }
@keyframes eco-entra { from { opacity: 0; transform: translateY(8px); } }

/* Panel */
.eco-panel { position: fixed; right: 18px; bottom: 18px; z-index: 70; width: min(420px, calc(100vw - 36px)); height: min(640px, calc(100vh - 36px)); display: flex; flex-direction: column; border-radius: 24px; background: var(--papel); color: var(--tinta); box-shadow: 0 40px 90px -20px rgba(0, 0, 0, .45), 0 0 0 1px var(--borde); overflow: hidden; animation: eco-abre .32s cubic-bezier(.16, 1, .3, 1); }
.eco-panel[hidden] { display: none; }
@keyframes eco-abre { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.eco-cab { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px; background: linear-gradient(135deg, #02165a, #0437b3); color: #fff; flex: none; }
.eco-cab b { display: block; font-size: 15px; }
.eco-cab small { display: block; font-size: 12px; color: rgba(255, 255, 255, .75); }
.eco-cab .eco-estado { margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--cielo); white-space: nowrap; }
.eco-cab .eco-estado--vivo::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #5df0a0; margin-right: 6px; animation: eco-latido-chico 1.2s ease-out infinite; }
@keyframes eco-latido-chico { 0% { box-shadow: 0 0 0 0 rgba(93, 240, 160, .7); } 100% { box-shadow: 0 0 0 7px rgba(93, 240, 160, 0); } }
.eco-cab .eco-icono { border: 0; background: rgba(255, 255, 255, .12); color: #fff; width: 32px; height: 32px; border-radius: 10px; cursor: pointer; font-size: 16px; display: grid; place-items: center; flex: none; }
.eco-cab .eco-icono:hover { background: rgba(255, 255, 255, .22); }
.eco-cab .eco-cerrar { font-size: 18px; }
.eco-msjs { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; overscroll-behavior: contain; }
.eco-msj { max-width: 92%; padding: 11px 14px; border-radius: 16px; font: 500 14px/1.5 Montserrat, sans-serif; overflow-wrap: anywhere; animation: eco-entra .25s ease; }
.eco-msj p { margin: 0; white-space: pre-wrap; }
.eco-msj p + p, .eco-msj ol + p, .eco-msj ul + p, .eco-msj p + ol, .eco-msj p + ul { margin-top: 8px; }
.eco-msj--eco { align-self: flex-start; background: var(--carta); color: var(--tinta); border-left: 4px solid var(--brillo); border-radius: 4px 16px 16px 16px; box-shadow: 0 10px 24px -16px rgba(4, 55, 179, .35); }
.eco-msj--yo { align-self: flex-end; background: var(--accion); color: #fff; border-radius: 16px 4px 16px 16px; }
.eco-msj--error { align-self: stretch; background: var(--error-fondo); color: var(--error-texto); border-left: 4px solid var(--error-borde); }
.eco-msj--error button { margin-top: 8px; padding: 7px 12px; border-radius: 10px; border: 1.5px solid currentColor; background: transparent; color: inherit; font: 700 12.5px Montserrat, sans-serif; cursor: pointer; }
.eco-msj ol, .eco-msj ul { margin: 6px 0 0; padding-left: 20px; }
.eco-msj ol { list-style: decimal; } .eco-msj ul { list-style: disc; }
.eco-msj li { margin: 3px 0; }
.eco-msj b { font-weight: 800; color: var(--resalte); }
.eco-msj--yo b { color: #fff; }
.eco-msj h4 { margin: 8px 0 2px; font-size: 14px; font-weight: 800; }
.eco-msj a { color: var(--resalte); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.eco-msj .eco-camino { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 8px; background: var(--tono-10); font-weight: 700; font-size: 12.5px; color: var(--resalte); }
.eco-msj .eco-cursor { display: inline-block; width: 2px; height: 1em; background: var(--brillo); vertical-align: -2px; margin-left: 2px; animation: eco-parpadeo .8s steps(2) infinite; }
@keyframes eco-parpadeo { to { opacity: 0; } }
.eco-fuente { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; font: 600 11.5px Montserrat, sans-serif; color: var(--suave); }
.eco-fuente a { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; background: var(--tono-6); color: var(--resalte); text-decoration: none; font-weight: 700; }
.eco-fuente a:hover { background: var(--tono-16); }
.eco-tiempo { font: 600 10.5px Montserrat, sans-serif; color: var(--suave); opacity: .8; align-self: flex-start; margin: -6px 0 0 4px; }
.eco-pensando { align-self: flex-start; display: inline-flex; gap: 5px; padding: 12px 16px; background: var(--carta); border-radius: 4px 16px 16px 16px; border-left: 4px solid var(--brillo); }
.eco-pensando i { width: 7px; height: 7px; border-radius: 50%; background: var(--brillo); animation: eco-punto 1.1s ease-in-out infinite; }
.eco-pensando i:nth-child(2) { animation-delay: .18s; } .eco-pensando i:nth-child(3) { animation-delay: .36s; }
@keyframes eco-punto { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }
.eco-chips { display: flex; gap: 8px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; flex: none; }
.eco-chips::-webkit-scrollbar { display: none; }
.eco-chip { flex: none; padding: 8px 12px; border-radius: 999px; border: 1.5px solid var(--borde-fuerte); background: var(--carta); color: var(--resalte); font: 600 12.5px Montserrat, sans-serif; cursor: pointer; white-space: nowrap; transition: background .2s, border-color .2s, transform .2s; }
.eco-chip:hover { background: var(--carta-2); border-color: var(--brillo); transform: translateY(-1px); }
.eco-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--borde); background: var(--carta); flex: none; }
.eco-form textarea { flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: 11px 14px; border-radius: 14px; border: 1.5px solid var(--borde-fuerte); background: var(--papel); color: var(--tinta); font: 500 14px/1.4 Montserrat, sans-serif; outline: none; }
.eco-form textarea::placeholder { color: var(--suave); opacity: .8; }
.eco-form textarea:focus { border-color: var(--brillo); box-shadow: 0 0 0 3px rgba(18, 139, 236, .18); }
.eco-form button { width: 46px; height: 46px; border: 0; border-radius: 14px; background: var(--accion); color: #fff; font-size: 18px; cursor: pointer; flex: none; display: grid; place-items: center; transition: background .2s, transform .2s; }
.eco-form button:hover { background: var(--accion-hover); transform: translateY(-1px); }
.eco-form button:disabled { opacity: .45; cursor: wait; transform: none; }
.eco-form button.eco-parar { background: var(--error-borde); }
.eco-pie { padding: 0 14px 10px; font: 500 11px/1.4 Montserrat, sans-serif; color: var(--suave); background: var(--carta); flex: none; }
.eco-pie a { color: var(--resalte); font-weight: 700; }

@media (max-width: 720px) {
  .eco-presentacion { grid-template-columns: 1fr; }
  .eco-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; }
  .eco-flota { right: 12px; bottom: 12px; padding: 0 12px; }
  .eco-flota span.eco-texto { display: none; }
  .eco-globo { right: 12px; bottom: 78px; }
}
@media (prefers-reduced-motion: reduce) {
  .eco-flota, .eco-avatar, .boton--eco .eco-chispa, .eco-cursor { animation: none !important; }
}
