/* Cody · chat de la web de código360 */
.cody {
  --c-bg: #fffcf8; --c-ink: #1a0f0c; --c-soft: #5d5551; --c-line: #e8ddc8;
  --c-acc: #7c3aed; --c-grad: linear-gradient(120deg, #ff3d7f, #c13ee0 50%, #8b5cf6);
  position: fixed; z-index: 2147483000; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  width: min(400px, calc(100vw - 32px)); height: min(640px, calc(100dvh - 32px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--c-bg); color: var(--c-ink); border-radius: 24px;
  box-shadow: 0 30px 80px -24px rgb(26 15 12 / 0.45), 0 0 0 1px rgb(26 15 12 / 0.06);
  font: 400 15px/1.5 var(--font, system-ui, sans-serif);
  transform-origin: 100% 100%; transition: opacity 220ms ease, transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}
.cody[hidden] { display: flex; opacity: 0; transform: translateY(12px) scale(0.96); pointer-events: none; visibility: hidden; }
@media (max-width: 520px) {
  .cody { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; }
}
.cody-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 18px; background: #1a0f0c; color: #fbf8f3; }
.cody-avatar { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: rgb(255 255 255 / 0.08); }
.cody-avatar img { width: 26px; height: 26px; }
.cody-title { flex: 1; min-width: 0; }
.cody-title b { display: block; font: 800 16px/1.2 var(--title, inherit); letter-spacing: -0.01em; }
.cody-title span { font-size: 12.5px; color: rgb(251 248 243 / 0.7); }
.cody-title .ia { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 700; color: #fff; background: var(--c-grad); vertical-align: 1px; }
.cody-x { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: inherit; cursor: pointer; }
.cody-x:hover { background: rgb(255 255 255 / 0.1); }
.cody-x svg { width: 20px; height: 20px; }
.cody-log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain; }
.cody-msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; animation: cody-in 220ms ease both; }
.cody-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--c-line); border-bottom-left-radius: 6px; }
.cody-msg.yo { align-self: flex-end; background: var(--c-acc); color: #fff; border-bottom-right-radius: 6px; }
.cody-msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.cody-msg.aviso { align-self: center; max-width: 100%; padding: 8px 12px; background: #f3ecff; color: #4c1d95; font-size: 13.5px; border-radius: 12px; text-align: center; }
.cody-typing { align-self: flex-start; display: flex; gap: 4px; padding: 14px 16px; background: #fff; border: 1px solid var(--c-line); border-radius: 18px 18px 18px 6px; }
.cody-typing i { width: 7px; height: 7px; border-radius: 50%; background: #c4b5fd; animation: cody-dot 1.2s infinite ease-in-out; }
.cody-typing i:nth-child(2) { animation-delay: 0.15s; } .cody-typing i:nth-child(3) { animation-delay: 0.3s; }
.cody-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 10px; }
.cody-chips button { padding: 8px 12px; border: 1px solid #ddd0f9; border-radius: 99px; background: #fff; color: #5b21b6; font: 600 13.5px/1.2 inherit; cursor: pointer; }
.cody-chips button:hover { background: #f3ecff; }
.cody-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 8px; border-top: 1px solid var(--c-line); background: var(--c-bg); }
.cody-form textarea { flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: 11px 14px; border: 1px solid var(--c-line); border-radius: 14px; background: #fff; color: var(--c-ink); font: inherit; }
.cody-form textarea:focus { outline: 2px solid var(--c-acc); outline-offset: 0; border-color: transparent; }
.cody-send { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 14px; background: var(--c-ink); color: #fff; cursor: pointer; }
.cody-send:disabled { opacity: 0.4; cursor: default; }
.cody-send svg { width: 20px; height: 20px; }
.cody-foot { display: flex; justify-content: space-between; gap: 12px; padding: 0 14px 12px; font-size: 12px; color: var(--c-soft); }
.cody-foot a, .cody-foot button { color: var(--c-soft); background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.cody-foot button:hover, .cody-foot a:hover { color: var(--c-acc); }
.cody :focus-visible { outline: 3px solid #a78bfa; outline-offset: 2px; }
@keyframes cody-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes cody-dot { 0%, 80%, 100% { opacity: 0.35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .cody, .cody-msg { transition: none; animation: none; } .cody-typing i { animation: none; } }
