/* ================================================================ Yolombo, el asistente */
:root { --jv-a: #2b75b0; --jv-b: #5aaee0; --jv-c: #084570; --jv-glass: #ffffff1f; }

/* ---------- botón flotante */
.jv-fab { position: fixed; right: 22px; bottom: 22px; z-index: 60; height: 56px; min-width: 56px; padding: 0 18px 0 16px;
  border: 0; border-radius: 28px; cursor: pointer; display: flex; align-items: center; gap: 10px; color: #fff;
  font: 600 14px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, var(--jv-a), var(--jv-b) 55%, var(--jv-c)); background-size: 200% 200%;
  box-shadow: 0 10px 28px #2b75b055, 0 2px 6px #0003; animation: jv-shift 8s ease infinite; transition: transform .2s; }
.jv-fab:hover { transform: translateY(-2px) scale(1.03); }
.jv-fab::after { content: ""; position: absolute; inset: -4px; border-radius: 32px; border: 2px solid var(--jv-a);
  opacity: 0; animation: jv-ring 3.2s ease-out infinite; pointer-events: none; }
.jv-fab-star { font-size: 22px; display: inline-block; animation: jv-twinkle 3.2s ease-in-out infinite; }
body.jv-open .jv-fab { display: none; }

/* ---------- panel */
.jv { position: fixed; top: 0; right: 0; bottom: 0; width: min(450px, 100vw); z-index: 70; background: var(--panel);
  border-left: 1px solid var(--line); box-shadow: -18px 0 48px #0003; display: flex; flex-direction: column;
  animation: jv-in .28s cubic-bezier(.2, .9, .3, 1.1); }
.jv[hidden] { display: none; }
.jv.jv-full { position: static; width: auto; height: calc(100vh - 44px); height: calc(100dvh - 44px); box-shadow: 0 8px 30px #0001;
  border: 1px solid var(--line); border-radius: 16px; max-width: 920px; margin: 0 auto; overflow: hidden; animation: none; }
body.jv-open .main { margin-right: 450px; }

.jv-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; color: #fff; position: relative;
  background: linear-gradient(120deg, #0c2238 0%, #0b3a5e 55%, #1f6aa5 100%); }
.jv-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--jv-a), var(--jv-b), var(--jv-c)); background-size: 200% 100%; animation: jv-shift 6s linear infinite; }
.jv-avatar, .jv-hello-avatar { position: relative; display: grid; place-items: center; border-radius: 50%; color: #fff; flex: none;
  background: radial-gradient(circle at 30% 30%, var(--jv-b), var(--jv-a) 55%, var(--jv-c)); box-shadow: 0 0 0 3px #ffffff22, 0 0 18px #5aaee066; }
.jv-avatar { width: 40px; height: 40px; font-size: 20px; }
.jv-avatar span, .jv-hello-avatar span { display: inline-block; animation: jv-twinkle 4s ease-in-out infinite; }
.jv[data-mode=thinking] .jv-avatar span { animation: jv-spin 1.6s linear infinite; }
.jv[data-mode=listening] .jv-avatar { box-shadow: 0 0 0 3px #ff6b6b88, 0 0 22px #ff6b6baa; animation: jv-pulse 1.1s ease-in-out infinite; }
.jv[data-mode=speaking] .jv-avatar { animation: jv-pulse .9s ease-in-out infinite; }
.jv-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.jv-title { font-size: 16px; letter-spacing: .2px; }
.jv-sub { font-size: 12px; color: #ffffffb3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.jv-dot { width: 7px; height: 7px; border-radius: 50%; background: #47cd89; box-shadow: 0 0 6px #47cd89; flex: none; }
.jv[data-mode=thinking] .jv-dot { background: var(--jv-b); box-shadow: 0 0 6px var(--jv-b); animation: jv-blink 1s infinite; }
.jv[data-mode=listening] .jv-dot { background: #ff6b6b; box-shadow: 0 0 6px #ff6b6b; animation: jv-blink .8s infinite; }
.jv-head button, .jv-head a { background: var(--jv-glass); border: 0; color: #fff; width: 32px; height: 32px; border-radius: 9px;
  font-size: 16px; cursor: pointer; display: grid; place-items: center; line-height: 1; transition: background .15s; flex: none; }
.jv-head button:hover, .jv-head a:hover { background: #ffffff38; text-decoration: none; }
.jv-head .jv-speak.on { background: #ffffffee; color: var(--jv-a); }
.jv-bar { padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.jv-convs { width: 100%; padding: 6px 10px; font-size: 13px; border-radius: 9px; background: var(--bg); }

/* ---------- conversación */
.jv-log { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth;
  background: radial-gradient(1200px 400px at 100% 0%, #2b75b00d, transparent 60%), var(--panel); }
.jv-row { display: flex; gap: 8px; align-items: flex-end; animation: jv-pop .25s ease-out; }
.jv-row-user { justify-content: flex-end; }
.jv-row-error { justify-content: stretch; }
.jv-mini { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 13px; color: #fff;
  background: radial-gradient(circle at 30% 30%, var(--jv-b), var(--jv-a) 60%, var(--jv-c)); }
.jv-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; line-height: 1.55; overflow-wrap: anywhere; font-size: 14px; }
.jv-msg p { margin: 0 0 8px; } .jv-msg p:last-child { margin-bottom: 0; }
.jv-msg ul, .jv-msg ol { margin: 4px 0 8px; padding-left: 20px; } .jv-msg li { margin-bottom: 3px; }
.jv-msg table { font-size: 12px; margin: 6px 0; } .jv-msg th, .jv-msg td { padding: 4px 6px; }
.jv-msg a { font-weight: 600; }
.jv-h { font-weight: 700; color: var(--jv-a); }
.jv-user { background: linear-gradient(135deg, var(--jv-a), #3f8fcc); color: #fff; white-space: pre-wrap; border-bottom-right-radius: 5px;
  box-shadow: 0 4px 14px #2b75b033; }
.jv-assistant { background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 5px; box-shadow: 0 2px 8px #0000000a; }
.jv-error { flex: 1; max-width: none; background: var(--accent-2); border-left: 4px solid var(--bad); border-radius: 10px; font-size: 13px; }

/* bienvenida */
.jv-hello { margin: auto 0; text-align: center; padding: 10px 6px 4px; animation: jv-pop .35s ease-out; }
.jv-hello-avatar { width: 72px; height: 72px; font-size: 34px; margin: 0 auto 12px; animation: jv-float 4s ease-in-out infinite; }
.jv-hello h3 { margin: 0 0 6px; font-size: 20px; }
.jv-hello p { margin: 0 auto 14px; color: var(--muted); max-width: 360px; font-size: 13.5px; line-height: 1.55; }
.jv-chips { display: grid; gap: 8px; }
.jv-chip { display: flex; align-items: center; gap: 10px; text-align: left; font: inherit; font-size: 13.5px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s; }
.jv-chip span { font-size: 18px; }
.jv-chip:hover { border-color: var(--jv-a); transform: translateY(-1px); box-shadow: 0 4px 14px #2b75b022; }

/* escribiendo */
.jv-typing { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; padding-left: 34px; }
.jv-dots { display: inline-flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.jv-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--jv-a); animation: jv-bounce 1.2s infinite ease-in-out; }
.jv-dots i:nth-child(2) { animation-delay: .15s; background: var(--jv-b); } .jv-dots i:nth-child(3) { animation-delay: .3s; background: var(--jv-c); }

/* propuestas */
.jv-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--panel); margin-left: 34px;
  box-shadow: 0 6px 20px #0000000f; position: relative; overflow: hidden; animation: jv-pop .3s ease-out; }
.jv-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--jv-a), var(--jv-b)); }
.jv-card[data-status=approved]::before { background: var(--good); } .jv-card[data-status=failed]::before { background: var(--bad); }
.jv-card[data-status=discarded] { opacity: .7; } .jv-card[data-status=discarded]::before { background: var(--line); }
.jv-card p { margin: 8px 0 0; font-size: 13.5px; }
.jv-card-top { display: flex; gap: 8px; align-items: center; }
.jv-card-top b { flex: 1; }
.jv-card-icon { font-size: 18px; }
.jv-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--accent-2); color: var(--jv-a); white-space: nowrap; }
.jv-card[data-status=approved] .jv-badge { background: #12804a1f; color: var(--good); }
.jv-card[data-status=failed] .jv-badge { background: #c4320a1f; color: var(--bad); }
.jv-card[data-status=discarded] .jv-badge { background: var(--bg); color: var(--muted); }
.jv-card-btns { display: flex; gap: 8px; margin-top: 10px; }
.jv-card-btns button { font: inherit; font-size: 13px; font-weight: 600; border-radius: 9px; padding: 7px 14px; cursor: pointer; border: 1px solid var(--line); }
.jv-ok { background: linear-gradient(135deg, var(--jv-a), #3f8fcc); color: #fff; border-color: transparent !important; box-shadow: 0 4px 12px #2b75b044; }
.jv-ok:hover { filter: brightness(1.07); }
.jv-no { background: var(--panel); color: var(--text); }
.jv-card-btns button:disabled { opacity: .6; cursor: wait; }

/* ---------- escribir y hablar */
.jv-form { display: flex; gap: 8px; padding: 12px 12px 6px; border-top: 1px solid var(--line); align-items: flex-end; background: var(--panel); }
.jv-input { flex: 1; display: flex; align-items: flex-end; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 22px;
  padding: 4px 4px 4px 14px; transition: border-color .15s, box-shadow .15s; }
.jv-input:focus-within { border-color: var(--jv-a); box-shadow: 0 0 0 3px #2b75b022; }
.jv-input textarea { flex: 1; resize: none; border: 0; background: transparent; padding: 8px 0; min-height: 22px; max-height: 160px;
  font-size: 16px; line-height: 1.4; outline: none; box-shadow: none; }
.jv-mic, .jv-send { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; transition: transform .15s, background .15s; }
.jv-mic svg, .jv-send svg { width: 20px; height: 20px; fill: currentColor; }
.jv-mic { background: transparent; color: var(--muted); }
.jv-mic:hover { color: var(--jv-a); background: var(--accent-2); }
.jv-mic.on { background: #e5484d; color: #fff; animation: jv-pulse 1.1s ease-in-out infinite; }
.jv-send { width: 44px; height: 44px; color: #fff; background: linear-gradient(135deg, var(--jv-a), var(--jv-b)); box-shadow: 0 4px 14px #2b75b055; }
.jv-send:hover { transform: scale(1.06); }
.jv-send:disabled { opacity: .5; cursor: wait; transform: none; }
.jv-mic[hidden], .jv-speak[hidden] { display: none; }
.jv-foot { margin: 0; padding: 0 14px 10px; font-size: 11px; color: var(--muted); text-align: center; background: var(--panel); }

/* ---------- animaciones */
@keyframes jv-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes jv-pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes jv-shift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes jv-ring { 0% { opacity: .55; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.18); } }
@keyframes jv-twinkle { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.18) rotate(20deg); } }
@keyframes jv-spin { to { transform: rotate(360deg); } }
@keyframes jv-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes jv-blink { 50% { opacity: .3; } }
@keyframes jv-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .6; } 40% { transform: translateY(-5px); opacity: 1; } }
@keyframes jv-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) {
  .jv, .jv *, .jv-fab, .jv-fab * { animation: none !important; transition: none !important; }
  .jv-fab::after { display: none; }
}

/* ---------- pantallas pequeñas */
@media (max-width: 1200px) { body.jv-open .main { margin-right: 0; } }
@media (max-width: 860px) {
  .jv { width: 100vw; border-left: 0; }
  .jv.jv-full { height: calc(100dvh - 44px); border-radius: 0; border: 0; }
  /* en el móvil, la página del asistente esconde el menú (se vuelve con el logo) para que el chat ocupe la pantalla */
  body.jv-page .side { padding: 10px 12px; }
  body.jv-page .side nav, body.jv-page .side .who { display: none; }
  body.jv-page .side .brand::after { content: "  ← menú"; font-size: 12px; font-weight: 400; color: var(--side-text); }
  body.jv-page .main { padding: 0; }
  .jv-fab { right: 14px; bottom: 14px; padding: 0; width: 56px; justify-content: center; }
  .jv-fab-label { display: none; }
  .jv-card { margin-left: 0; }
}
