/* =========================================================================
   Luxi — Widget de IA de MySaaSLux (frontend)
   Burbuja flotante en todas las páginas + panel embebido en la home.
   Gradiente violeta→cyan SOLO aquí (el agente "se ve" distinto = producto).
   ========================================================================= */
.luxi { --luxi-grad: linear-gradient(135deg, #8B5CF6 0%, #22D3EE 100%); font-family: var(--font-body, 'Inter', system-ui, sans-serif); }

/* ---- Floating bubble ---- */
.luxi-fab { position: fixed; right: 22px; bottom: 22px; z-index: 9000; width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer; background: var(--luxi-grad); box-shadow: 0 10px 34px rgba(139,92,246,.45); display: flex; align-items: center; justify-content: center; transition: transform .2s cubic-bezier(.22,.61,.36,1), box-shadow .2s; }
.luxi-fab:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 14px 42px rgba(34,211,238,.5); }
.luxi-fab:focus-visible { outline: 3px solid #AEF639; outline-offset: 3px; }
.luxi-fab img, .luxi-fab svg { width: 34px; height: 34px; }
.luxi-fab .luxi-fab-close { display: none; }
.luxi.is-open .luxi-fab .luxi-fab-orb { display: none; }
.luxi.is-open .luxi-fab .luxi-fab-close { display: block; }
.luxi-fab-ping { position: absolute; inset: 0; border-radius: 50%; background: var(--luxi-grad); opacity: .55; animation: luxiPing 2.6s cubic-bezier(0,0,.2,1) infinite; z-index: -1; }
@keyframes luxiPing { 0% { transform: scale(1); opacity: .5; } 80%,100% { transform: scale(1.55); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .luxi-fab-ping { animation: none; display: none; } }

/* ---- Panel (floating) ---- */
.luxi-panel { position: fixed; right: 22px; bottom: 94px; z-index: 9000; width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 130px)); background: #12151A; border: 1px solid #262B33; border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6); display: flex; flex-direction: column; overflow: hidden; opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none; transition: opacity .22s cubic-bezier(.22,.61,.36,1), transform .22s cubic-bezier(.22,.61,.36,1); }
.luxi.is-open .luxi-panel { opacity: 1; transform: none; pointer-events: auto; }

/* ---- Embedded panel (home) ---- */
.luxi-embed { width: 100%; max-width: 440px; height: 520px; background: #12151A; border: 1px solid #262B33; border-radius: 18px; box-shadow: 0 24px 70px rgba(0,0,0,.5); display: flex; flex-direction: column; overflow: hidden; }
.luxi-embed .luxi-panel-head { border-radius: 0; }

/* ---- Panel header ---- */
.luxi-panel-head { padding: 16px 18px; background: linear-gradient(135deg, rgba(139,92,246,.18), rgba(34,211,238,.12)); border-bottom: 1px solid #262B33; display: flex; align-items: center; gap: 12px; }
.luxi-ava { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #8B5CF6, #22D3EE); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 0 18px rgba(139,92,246,.5); }
.luxi-ava svg { width: 26px; height: 26px; }
.luxi-ava img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.luxi-fab-orb { width: 46px; height: 46px; display: block; }
.luxi-fab-orb img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.luxi-panel-head .luxi-meta { display: flex; flex-direction: column; line-height: 1.25; }
.luxi-name { font-family: var(--font-head, 'Space Grotesk', sans-serif); font-weight: 700; font-size: 1rem; color: #F2F4F7; }
.luxi-status { font-size: .74rem; color: #9BA3AF; display: flex; align-items: center; gap: 6px; }
.luxi-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #AEF639; box-shadow: 0 0 8px #AEF639; }
.luxi-close { margin-left: auto; background: none; border: none; color: #9BA3AF; cursor: pointer; padding: 6px; border-radius: 6px; line-height: 0; }
.luxi-close:hover { color: #F2F4F7; background: rgba(255,255,255,.06); }
.luxi-embed .luxi-close { display: none; }

/* ---- Messages ---- */
.luxi-log { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: #262B33 transparent; }
.luxi-log::-webkit-scrollbar { width: 6px; }
.luxi-log::-webkit-scrollbar-thumb { background: #262B33; border-radius: 3px; }
.luxi-msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: .9rem; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.luxi-msg--bot { align-self: flex-start; background: #1A1E24; color: #F2F4F7; border-bottom-left-radius: 4px; }
.luxi-msg--user { align-self: flex-end; background: linear-gradient(135deg, #8B5CF6, #22D3EE); color: #0B0D10; font-weight: 500; border-bottom-right-radius: 4px; }
.luxi-msg--sys { align-self: center; background: transparent; color: #6B7280; font-size: .78rem; text-align: center; max-width: 95%; }
.luxi-msg a { color: #AEF639; text-decoration: underline; }
.luxi-embed .luxi-msg--user, .luxi-panel .luxi-msg--user { }

/* typing */
.luxi-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: #1A1E24; border-radius: 14px; border-bottom-left-radius: 4px; }
.luxi-typing span { width: 7px; height: 7px; border-radius: 50%; background: #6B7280; animation: luxiDot 1.2s infinite ease-in-out; }
.luxi-typing span:nth-child(2) { animation-delay: .15s; }
.luxi-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes luxiDot { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* quick prompts */
.luxi-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.luxi-quick button { font-family: var(--font-mono, monospace); font-size: .74rem; color: #9BA3AF; background: #1A1E24; border: 1px solid #262B33; border-radius: 100px; padding: 5px 11px; cursor: pointer; transition: color .15s, border-color .15s; }
.luxi-quick button:hover { color: #F2F4F7; border-color: #8B5CF6; }

/* ---- Composer ---- */
.luxi-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid #262B33; background: #0F1215; }
.luxi-input { flex: 1; background: #1A1E24; border: 1px solid #262B33; border-radius: 12px; color: #F2F4F7; font-family: inherit; font-size: .9rem; padding: 10px 12px; resize: none; max-height: 96px; line-height: 1.4; }
.luxi-input:focus { outline: none; border-color: #8B5CF6; }
.luxi-input::placeholder { color: #6B7280; }
.luxi-send { flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px; border: none; cursor: pointer; background: linear-gradient(135deg, #8B5CF6, #22D3EE); color: #0B0D10; display: flex; align-items: center; justify-content: center; transition: transform .15s, opacity .15s; }
.luxi-send:hover { transform: translateY(-1px); }
.luxi-send:disabled { opacity: .4; cursor: default; transform: none; }
.luxi-send svg { width: 18px; height: 18px; }

.luxi-foot { text-align: center; font-size: .68rem; color: #6B7280; padding: 0 14px 10px; background: #0F1215; }

@media (max-width: 480px) {
  .luxi-panel { right: 12px; left: 12px; bottom: 88px; width: auto; height: min(70vh, 520px); }
  .luxi-fab { right: 20px; bottom: 18px; }
}
