/* =========================================================
   EVA · la asistente de Edén (chat). Usa los tokens de styles.css.
   La manzana dorada = el fruto del conocimiento: Eva es quien conoce el fruto.
   ========================================================= */
.eva{ --eva-ease:var(--ease-out, cubic-bezier(.16,1,.3,1)); font-family:var(--f-ui, system-ui, sans-serif); }
.eva-sr{ position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

/* ---------- La manzana ---------- */
.eva-apple{ display:block; overflow:visible; }
.eva-apple__fruit{ transform-box:fill-box; transform-origin:50% 100%; }
.eva-apple__leaf{ transform-box:fill-box; transform-origin:0% 85%; animation:eva-leaf 4.2s ease-in-out infinite; }
.eva-apple__shine{ animation:eva-shine 5.5s ease-in-out infinite; }

/* ---------- Botón flotante ---------- */
.eva-launch{
  position:fixed; right:22px; bottom:22px; z-index:86;
  width:66px; height:66px; padding:0; border:0; border-radius:50%; cursor:pointer;
  display:grid; place-items:center; color:var(--text, #F7F1E2);
  background:radial-gradient(circle at 50% 36%, #2b2213 0%, #130f07 70%);
  box-shadow:0 0 0 1px rgba(255,221,130,.3), 0 18px 40px -14px rgba(0,0,0,.92), 0 0 34px -8px rgba(255,190,60,.5);
  transition:transform .35s var(--eva-ease), opacity .3s;
  animation:eva-glow 3.8s ease-in-out infinite;
}
.eva-launch:hover{ transform:translateY(-3px) scale(1.04); }
.eva-launch:active{ transform:scale(.97); }
.eva-launch:focus-visible{ outline:2px solid var(--gold, #FFD24A); outline-offset:4px; }
.eva-launch__ring{
  position:absolute; inset:-4px; border-radius:50%; pointer-events:none;
  background:conic-gradient(from 0deg, transparent 0 22%, rgba(255,226,140,.95) 34%, transparent 46% 72%, rgba(255,190,60,.55) 82%, transparent 92%);
  -webkit-mask:radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
          mask:radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  animation:eva-spin 7s linear infinite;
}
.eva-apple--launch{ width:34px; height:38px; filter:drop-shadow(0 5px 8px rgba(0,0,0,.55)); animation:eva-bob 4.6s ease-in-out infinite;
  transition:opacity .25s, transform .35s var(--eva-ease); }
.eva-launch__x{ position:absolute; width:22px; height:22px; opacity:0; transform:rotate(-90deg) scale(.6);
  fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; transition:opacity .25s, transform .35s var(--eva-ease); }
.eva-launch__dot{ position:absolute; top:6px; right:6px; width:12px; height:12px; border-radius:50%;
  background:#5ee08a; box-shadow:0 0 0 2.5px #130f07, 0 0 10px rgba(94,224,138,.8); }
/* abierto en compu: la manzana se vuelve una cruz para cerrar */
.eva.is-open .eva-apple--launch{ opacity:0; transform:scale(.5) rotate(25deg); }
.eva.is-open .eva-launch__x{ opacity:1; transform:none; }
.eva.is-open .eva-launch__dot{ opacity:0; }
body.menu-open .eva-launch, body.menu-open .eva-teaser{ opacity:0; pointer-events:none; }

/* ---------- Aviso de bienvenida ---------- */
.eva-teaser{
  position:fixed; right:22px; bottom:100px; z-index:86; max-width:290px;
  display:flex; align-items:flex-start; gap:4px; padding:12px 8px 12px 15px;
  border-radius:18px 18px 6px 18px; background:rgba(22,18,10,.94); border:1px solid rgba(255,221,130,.24);
  -webkit-backdrop-filter:blur(12px); backdrop-filter:blur(12px); box-shadow:0 22px 44px -18px rgba(0,0,0,.92);
  opacity:0; transform:translateY(10px) scale(.96); transform-origin:100% 100%;
  transition:opacity .4s var(--eva-ease), transform .5s var(--eva-ease);
}
.eva-teaser.is-in{ opacity:1; transform:none; }
.eva-teaser[hidden]{ display:none; }
.eva-teaser__text{ all:unset; cursor:pointer; color:var(--text, #F7F1E2); font-size:.92rem; line-height:1.42; }
.eva-teaser__text b{ color:var(--gold, #FFD24A); font-weight:600; }
.eva-teaser__x{ all:unset; cursor:pointer; flex:none; width:24px; height:24px; display:grid; place-items:center; border-radius:8px; color:var(--muted, #b3a888); }
.eva-teaser__x svg{ width:13px; height:13px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
.eva-teaser__x:hover{ color:var(--text, #F7F1E2); background:rgba(255,236,180,.07); }
.eva-teaser__text:focus-visible, .eva-teaser__x:focus-visible{ outline:2px solid var(--gold, #FFD24A); outline-offset:3px; border-radius:6px; }

/* ---------- Panel ---------- */
.eva-panel{
  position:fixed; right:22px; bottom:100px; z-index:120;
  width:min(396px, calc(100vw - 32px)); height:min(640px, calc(100vh - 124px)); height:min(640px, calc(100dvh - 124px));
  display:flex; flex-direction:column; overflow:hidden; border-radius:26px;
  background:linear-gradient(180deg, rgba(27,21,10,.97), rgba(12,10,5,.98));
  border:1px solid rgba(255,221,130,.2);
  box-shadow:0 44px 90px -30px rgba(0,0,0,.96), 0 0 70px -24px rgba(255,190,60,.3);
  -webkit-backdrop-filter:blur(18px); backdrop-filter:blur(18px);
  opacity:0; transform:translateY(16px) scale(.94); transform-origin:calc(100% - 33px) calc(100% + 60px);
  transition:opacity .28s var(--eva-ease), transform .42s var(--eva-ease);
}
.eva-panel.is-in{ opacity:1; transform:none; }
.eva-panel[hidden]{ display:none; }

.eva-head{ flex:none; display:flex; align-items:center; gap:12px; padding:14px 12px 14px 16px;
  border-bottom:1px solid rgba(255,221,130,.12);
  background:radial-gradient(130% 160% at 0% 0%, rgba(255,201,60,.14), transparent 62%); }
.eva-avatar{ position:relative; flex:none; width:46px; height:46px; border-radius:50%; display:grid; place-items:center;
  background:radial-gradient(circle at 50% 38%, #2b2213, #130f07 74%);
  box-shadow:0 0 0 1px rgba(255,221,130,.32), 0 0 20px -4px rgba(255,190,60,.55); }
.eva-apple--avatar{ width:25px; height:28px; }
.eva.is-typing .eva-avatar{ animation:eva-think 1.4s ease-in-out infinite; }
.eva-id{ flex:1; min-width:0; }
.eva-id h2{ font-family:var(--f-display, Georgia, serif); font-weight:600; font-size:1.3rem; line-height:1.05; letter-spacing:-.01em;
  color:var(--text, #F7F1E2); text-wrap:nowrap; }
.eva-id p{ margin-top:4px; display:flex; align-items:center; gap:6px; color:var(--muted, #b3a888); font-size:.78rem; line-height:1.2;
  white-space:nowrap; overflow:hidden; }
.eva-status{ overflow:hidden; text-overflow:ellipsis; }
.eva.is-typing .eva-status{ color:var(--gold, #FFD24A); }
.eva-live{ flex:none; width:7px; height:7px; border-radius:50%; background:#5ee08a; box-shadow:0 0 8px rgba(94,224,138,.85); }
.eva-icon{ flex:none; width:38px; height:38px; border-radius:12px; display:grid; place-items:center; cursor:pointer;
  color:var(--text-2, #d3c8aa); background:rgba(255,236,180,.04); border:1px solid rgba(255,221,130,.14);
  transition:background-color .2s, color .2s, border-color .2s; }
.eva-icon:hover{ color:var(--text, #F7F1E2); background:rgba(255,236,180,.09); border-color:rgba(255,221,130,.3); }
.eva-icon:focus-visible{ outline:2px solid var(--gold, #FFD24A); outline-offset:2px; }
.eva-icon svg{ width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

/* ---------- Mensajes ---------- */
.eva-body{ position:relative; flex:1; min-height:0; display:flex; }
.eva-log{ position:relative; flex:1; min-width:0; overflow-y:auto; overscroll-behavior:contain; padding:18px 14px 12px;
  display:flex; flex-direction:column; gap:10px; scrollbar-width:thin; scrollbar-color:#4a3507 transparent; }
.eva-log::-webkit-scrollbar{ width:6px; }
.eva-log::-webkit-scrollbar-thumb{ background:#4a3507; border-radius:6px; }
.eva-msg{ max-width:86%; padding:11px 14px; border-radius:18px; font-size:.95rem; line-height:1.52; overflow-wrap:anywhere; }
.eva-msg p + p, .eva-msg p + ul, .eva-msg ul + p{ margin-top:8px; }
.eva-msg ul{ margin-top:6px; padding-left:18px; }
.eva-msg li + li{ margin-top:4px; }
.eva-msg strong{ font-weight:600; color:var(--cream, #FFF3C4); }
.eva-msg a:not(.eva-cta){ color:var(--gold, #FFD24A); text-decoration:underline; text-underline-offset:2px; }
.eva-msg--eva{ align-self:flex-start; color:var(--text, #F7F1E2); background:rgba(255,236,180,.065);
  border:1px solid rgba(255,221,130,.14); border-bottom-left-radius:6px; }
.eva-msg--me{ align-self:flex-end; color:#1a1300; font-weight:500; white-space:pre-wrap;
  background:linear-gradient(180deg, #FFE07A, #F5B301); border-bottom-right-radius:6px;
  box-shadow:0 10px 22px -14px rgba(245,179,1,.75); }
.eva-msg.is-new{ animation:eva-pop .45s var(--eva-ease) both; }
.eva-msg--eva.is-new > *{ animation:eva-rise .5s var(--eva-ease) both; }
.eva-msg--eva.is-new > :nth-child(2){ animation-delay:.08s; }
.eva-msg--eva.is-new > :nth-child(3){ animation-delay:.16s; }
.eva-msg--eva.is-new > :nth-child(n+4){ animation-delay:.24s; }

/* botón de acción que propone Eva */
.eva-cta{ display:inline-flex; align-items:center; gap:8px; margin-top:11px; padding:9px 15px; border-radius:999px;
  color:#1a1300; font-weight:600; font-size:.86rem; line-height:1.2; text-decoration:none;
  background:linear-gradient(180deg, #FFE07A, #F5B301); box-shadow:0 10px 22px -12px rgba(245,179,1,.75);
  transition:transform .25s var(--eva-ease), box-shadow .25s; }
.eva-cta:hover{ transform:translateY(-1px); box-shadow:0 14px 26px -12px rgba(245,179,1,.85); }
.eva-cta:focus-visible{ outline:2px solid var(--cream, #FFF3C4); outline-offset:3px; }
.eva-cta__arrow{ width:15px; height:15px; flex:none; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }

/* escribiendo… */
.eva-typing{ display:inline-flex; gap:5px; padding:15px 16px; }
.eva-typing i{ width:7px; height:7px; border-radius:50%; background:var(--gold, #FFD24A); opacity:.35; animation:eva-dot 1.2s ease-in-out infinite; }
.eva-typing i:nth-child(2){ animation-delay:.15s; }
.eva-typing i:nth-child(3){ animation-delay:.3s; }

/* avisos (sin conexión, límites) */
.eva-note{ align-self:center; max-width:94%; text-align:center; color:var(--text-2, #d3c8aa); font-size:.86rem;
  background:rgba(255,236,180,.035); border:1px dashed rgba(255,221,130,.3); }
.eva-note__actions{ display:flex; flex-wrap:wrap; justify-content:center; gap:8px; margin-top:9px; }
.eva-mini{ display:inline-flex; align-items:center; padding:7px 13px; border-radius:999px; cursor:pointer;
  font:600 .8rem/1 var(--f-ui, system-ui, sans-serif); color:var(--gold, #FFD24A); text-decoration:none;
  background:transparent; border:1px solid rgba(255,221,130,.35); }
.eva-mini:hover{ background:rgba(255,210,74,.1); }
.eva-mini:focus-visible{ outline:2px solid var(--gold, #FFD24A); outline-offset:2px; }

.eva-jump{ position:absolute; left:50%; bottom:10px; transform:translateX(-50%); display:inline-flex; align-items:center; gap:6px;
  padding:7px 13px; border-radius:999px; cursor:pointer; font:600 .78rem/1 var(--f-ui, system-ui, sans-serif);
  color:#1a1300; background:var(--gold, #FFD24A); border:0; box-shadow:0 10px 24px -10px rgba(0,0,0,.8); }
.eva-jump[hidden]{ display:none; }
.eva-jump svg{ width:13px; height:13px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }

/* ---------- Sugerencias ---------- */
.eva-chips{ flex:none; display:flex; flex-wrap:wrap; gap:8px; padding:2px 14px 12px; }
.eva-chips[hidden]{ display:none; }
.eva-chip{ flex:none; padding:8px 13px; border-radius:999px; cursor:pointer; text-align:left;
  font:500 .84rem/1.25 var(--f-ui, system-ui, sans-serif); color:var(--text-2, #d3c8aa);
  background:rgba(255,236,180,.05); border:1px solid rgba(255,221,130,.24);
  transition:color .2s, border-color .2s, background-color .2s, transform .25s var(--eva-ease); }
.eva-chip:hover{ color:var(--cream, #FFF3C4); border-color:var(--gold, #FFD24A); background:rgba(255,210,74,.08); transform:translateY(-1px); }
.eva-chip:focus-visible{ outline:2px solid var(--gold, #FFD24A); outline-offset:2px; }

/* ---------- Escribir (crece como WhatsApp) ---------- */
.eva-form{ flex:none; display:flex; align-items:flex-end; gap:10px; padding:10px 12px 6px;
  border-top:1px solid rgba(255,221,130,.1); background:rgba(12,10,5,.55); }
.eva-input{ flex:1; min-width:0; display:block; resize:none; margin:0;
  min-height:46px; max-height:156px; padding:12px 16px; border-radius:23px;
  font:400 16px/1.4 var(--f-ui, system-ui, sans-serif); color:var(--text, #F7F1E2); caret-color:var(--gold, #FFD24A);
  background:rgba(255,236,180,.055); border:1px solid rgba(255,221,130,.2); overflow-y:hidden;
  transition:border-color .2s, box-shadow .2s; scrollbar-width:thin; }
.eva-input::placeholder{ color:rgba(179,168,136,.75); }
.eva-input:focus{ outline:none; border-color:rgba(255,210,74,.6); box-shadow:0 0 0 3px rgba(255,210,74,.13); }
.eva-send{ flex:none; width:46px; height:46px; border-radius:50%; border:0; cursor:pointer; display:grid; place-items:center;
  color:#1a1300; background:linear-gradient(180deg, #FFE07A, #F5B301);
  box-shadow:0 10px 22px -10px rgba(245,179,1,.8); transition:transform .2s var(--eva-ease), opacity .2s, box-shadow .2s; }
.eva-send:hover:not(:disabled){ transform:translateY(-1px) scale(1.04); }
.eva-send:disabled{ cursor:default; opacity:.32; box-shadow:none; }
.eva-send:focus-visible{ outline:2px solid var(--cream, #FFF3C4); outline-offset:3px; }
.eva-send svg{ width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:2.1; stroke-linecap:round; stroke-linejoin:round; }
.eva-foot{ flex:none; display:flex; justify-content:center; gap:10px; padding:2px 16px 10px; text-align:center;
  color:rgba(179,168,136,.8); font-size:.7rem; line-height:1.35; }
.eva-count{ color:var(--gold, #FFD24A); font-variant-numeric:tabular-nums; }
.eva-count[hidden]{ display:none; }

/* ---------- Celular: pantalla completa que siempre deja ver lo que escribís ---------- */
@media (max-width:640px){
  .eva-launch{ right:16px; bottom:16px; width:60px; height:60px; }
  .eva-apple--launch{ width:31px; height:35px; }
  .eva-teaser{ right:16px; bottom:88px; max-width:calc(100vw - 32px); }
  .eva-panel{ top:var(--eva-top, 0px); right:0; bottom:auto; left:0; width:100%;
    height:100vh; height:var(--eva-vh, 100dvh); border-radius:0; border:0; transform:translateY(28px); transform-origin:50% 100%; }
  .eva-head{ padding-top:max(12px, env(safe-area-inset-top)); }
  .eva-form{ padding-bottom:max(6px, env(safe-area-inset-bottom)); }
  .eva-foot{ padding-bottom:max(8px, env(safe-area-inset-bottom)); }
  .eva-chips{ flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; padding-bottom:10px; }
  .eva-chips::-webkit-scrollbar{ display:none; }
  .eva-msg{ max-width:88%; }
}
html.eva-lock, html.eva-lock body{ overflow:hidden; }

/* ---------- Animaciones ---------- */
@keyframes eva-spin{ to{ transform:rotate(360deg); } }
@keyframes eva-bob{ 0%,100%{ transform:translateY(0) rotate(-3deg); } 50%{ transform:translateY(-3px) rotate(3deg); } }
@keyframes eva-leaf{ 0%,100%{ transform:rotate(0deg); } 50%{ transform:rotate(-10deg); } }
@keyframes eva-shine{ 0%,55%{ transform:translateX(0); } 100%{ transform:translateX(300px); } }
@keyframes eva-glow{
  0%,100%{ box-shadow:0 0 0 1px rgba(255,221,130,.3), 0 18px 40px -14px rgba(0,0,0,.92), 0 0 30px -10px rgba(255,190,60,.45); }
  50%{ box-shadow:0 0 0 1px rgba(255,221,130,.42), 0 18px 40px -14px rgba(0,0,0,.92), 0 0 46px -6px rgba(255,190,60,.7); }
}
@keyframes eva-think{ 0%,100%{ box-shadow:0 0 0 1px rgba(255,221,130,.32), 0 0 18px -4px rgba(255,190,60,.5); } 50%{ box-shadow:0 0 0 1px rgba(255,221,130,.55), 0 0 28px 0 rgba(255,190,60,.8); } }
@keyframes eva-pop{ from{ opacity:0; transform:translateY(10px) scale(.97); } to{ opacity:1; transform:none; } }
@keyframes eva-rise{ from{ opacity:0; transform:translateY(5px); } to{ opacity:1; transform:none; } }
@keyframes eva-dot{ 0%,80%,100%{ opacity:.3; transform:translateY(0); } 40%{ opacity:1; transform:translateY(-4px); } }

@media (prefers-reduced-motion:reduce){
  .eva *, .eva-launch, .eva-launch__ring, .eva-apple--launch{ animation:none !important; }
  .eva-panel, .eva-teaser{ transition:opacity .01ms !important; transform:none !important; }
}
