/* =================================================================
   LUMNIA · Chat widget
   Inyectable en cualquier página. Aislado por prefijo .lc-
   ================================================================= */

.lc-root {
  --lc-bg: #0b0a0d;
  --lc-bg-2: #131116;
  --lc-bg-3: #1a181e;
  --lc-ink: #f5f1ea;
  --lc-ink-dim: #93908a;
  --lc-ink-faint: #3a3740;
  --lc-line: rgba(255,255,255,0.08);
  --lc-line-strong: rgba(255,255,255,0.15);
  --lc-acc-a: oklch(0.88 0.17 35);
  --lc-acc-b: oklch(0.78 0.22 340);
  --lc-acc-c: oklch(0.85 0.15 220);
  --lc-display: 'Archivo', sans-serif;
  --lc-body: 'Space Grotesk', sans-serif;
  --lc-mono: 'JetBrains Mono', monospace;
  --lc-serif: 'Instrument Serif', serif;
}

/* ---- Floating launcher (mini halo orb) ---- */
.lc-launcher {
  position: fixed;
  bottom: 28px; right: 28px;
  z-index: 9998;
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 0; padding: 0; cursor: pointer;
  background: rgba(11,10,13,0.6);
  backdrop-filter: blur(14px);
  border: 1px solid var(--lc-line-strong);
  display: flex; align-items: center; justify-content: center;
  transition: transform .4s cubic-bezier(.2,.8,.2,1), box-shadow .4s;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 24px oklch(0.78 0.22 340 / 0.3);
}
.lc-launcher:hover {
  transform: scale(1.06) translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 32px oklch(0.78 0.22 340 / 0.5);
}
.lc-launcher-orb {
  width: 32px; height: 32px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--lc-acc-a), var(--lc-acc-b), var(--lc-acc-c), var(--lc-acc-a));
  filter: blur(0.5px) saturate(1.3);
  animation: lcRotate 10s linear infinite;
  box-shadow: 0 0 20px oklch(0.78 0.22 340 / 0.6);
}
.lc-launcher-pulse {
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1px solid oklch(0.78 0.22 340 / 0.5);
  opacity: 0;
  animation: lcPulse 2.4s ease-out infinite;
}
@keyframes lcRotate { to { transform: rotate(360deg); } }
@keyframes lcPulse {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* ---- Notification dot when closed ---- */
.lc-launcher-dot {
  position: absolute; top: 8px; right: 8px;
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--lc-acc-a), var(--lc-acc-b));
  box-shadow: 0 0 10px var(--lc-acc-b);
  animation: lcDotPulse 1.6s ease-in-out infinite;
}
@keyframes lcDotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
.lc-root.lc-open .lc-launcher-dot { display: none; }

/* ---- Hide launcher when open ---- */
.lc-root.lc-open .lc-launcher {
  transform: scale(0.6) translateY(20px);
  opacity: 0;
  pointer-events: none;
}

/* ---- Chat panel ---- */
.lc-panel {
  position: fixed;
  bottom: 28px; right: 28px;
  z-index: 9999;
  width: 380px; max-width: calc(100vw - 32px);
  height: 580px; max-height: calc(100vh - 56px);
  background: var(--lc-bg);
  border: 1px solid var(--lc-line-strong);
  border-radius: 24px;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px oklch(0.78 0.22 340 / 0.15);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform .4s cubic-bezier(.2,.8,.2,1), opacity .3s;
  font-family: var(--lc-body);
  color: var(--lc-ink);
}
.lc-root.lc-open .lc-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Halo background inside panel */
.lc-panel::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 80% 0%, oklch(0.78 0.22 340 / 0.12) 0%, transparent 40%),
    radial-gradient(circle at 0% 100%, oklch(0.88 0.17 35 / 0.08) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
}
.lc-panel > * { position: relative; z-index: 1; }

/* ---- Header ---- */
.lc-header {
  padding: 18px 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--lc-line);
  background: rgba(11,10,13,0.6);
  backdrop-filter: blur(12px);
}
.lc-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--lc-acc-a), var(--lc-acc-b), var(--lc-acc-c), var(--lc-acc-a));
  filter: blur(0.4px) saturate(1.2);
  animation: lcRotate 10s linear infinite;
  box-shadow: 0 0 16px oklch(0.78 0.22 340 / 0.5);
  flex-shrink: 0;
}
.lc-header-text { flex: 1; min-width: 0; }
.lc-header-name {
  font-family: var(--lc-display); font-weight: 700; font-size: 15px;
  letter-spacing: -0.01em; line-height: 1.2;
}
.lc-header-name em {
  font-family: var(--lc-serif); font-style: italic; font-weight: 400;
  background: linear-gradient(120deg, var(--lc-acc-a), var(--lc-acc-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lc-header-status {
  font-family: var(--lc-mono); font-size: 10px;
  color: var(--lc-ink-dim); letter-spacing: 0.1em; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
}
.lc-header-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: oklch(0.78 0.16 155);
  box-shadow: 0 0 8px oklch(0.78 0.16 155 / 0.8);
  animation: lcStatusPulse 1.6s ease-in-out infinite;
}
@keyframes lcStatusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.lc-close {
  background: none; border: 0; padding: 6px;
  color: var(--lc-ink-dim); cursor: pointer;
  border-radius: 8px;
  transition: color .2s, background .2s;
}
.lc-close:hover { color: var(--lc-ink); background: rgba(255,255,255,0.05); }
.lc-close svg { width: 18px; height: 18px; display: block; }

/* ---- Messages area ---- */
.lc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 8px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--lc-line-strong) transparent;
}
.lc-messages::-webkit-scrollbar { width: 6px; }
.lc-messages::-webkit-scrollbar-track { background: transparent; }
.lc-messages::-webkit-scrollbar-thumb { background: var(--lc-line-strong); border-radius: 3px; }

.lc-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px; line-height: 1.5;
  animation: lcMsgIn .3s cubic-bezier(.2,.8,.2,1);
  word-wrap: break-word;
}
@keyframes lcMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.lc-msg.bot {
  align-self: flex-start;
  background: var(--lc-bg-2);
  border: 1px solid var(--lc-line);
  border-bottom-left-radius: 6px;
  color: var(--lc-ink);
}
.lc-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, oklch(0.78 0.22 340 / 0.15), oklch(0.88 0.17 35 / 0.1));
  border: 1px solid oklch(0.78 0.22 340 / 0.25);
  border-bottom-right-radius: 6px;
  color: var(--lc-ink);
}
.lc-msg em {
  font-family: var(--lc-serif); font-style: italic; font-weight: 400;
  background: linear-gradient(120deg, var(--lc-acc-a), var(--lc-acc-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lc-msg strong { font-weight: 600; color: var(--lc-ink); }
.lc-msg a {
  color: var(--lc-acc-a);
  text-decoration: underline;
  text-decoration-color: oklch(0.88 0.17 35 / 0.4);
  text-underline-offset: 2px;
}
.lc-msg a:hover { text-decoration-color: var(--lc-acc-a); }

/* Typing indicator */
.lc-typing {
  align-self: flex-start;
  background: var(--lc-bg-2);
  border: 1px solid var(--lc-line);
  border-radius: 18px; border-bottom-left-radius: 6px;
  padding: 14px 18px;
  display: inline-flex; gap: 4px; align-items: center;
}
.lc-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--lc-ink-dim);
  animation: lcDot 1.4s ease-in-out infinite;
}
.lc-typing span:nth-child(2) { animation-delay: 0.15s; }
.lc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes lcDot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ---- Suggestions (chips) ---- */
.lc-suggestions {
  padding: 0 20px 12px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.lc-suggestions.lc-hidden { display: none; }
.lc-suggestion {
  font-family: var(--lc-mono); font-size: 11px;
  letter-spacing: 0.05em;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--lc-line-strong);
  background: rgba(255,255,255,0.02);
  color: var(--lc-ink-dim);
  cursor: pointer;
  transition: all .2s;
}
.lc-suggestion:hover {
  color: var(--lc-ink);
  border-color: var(--lc-acc-b);
  background: oklch(0.78 0.22 340 / 0.08);
}

/* ---- Input area ---- */
.lc-input-row {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--lc-line);
  display: flex; gap: 10px; align-items: flex-end;
  background: rgba(11,10,13,0.6);
  backdrop-filter: blur(12px);
}
.lc-input {
  flex: 1;
  background: var(--lc-bg-2);
  border: 1px solid var(--lc-line);
  border-radius: 18px;
  padding: 12px 16px;
  color: var(--lc-ink);
  font-family: var(--lc-body);
  font-size: 14px; line-height: 1.4;
  resize: none;
  max-height: 120px; min-height: 44px;
  outline: none;
  transition: border-color .2s;
}
.lc-input:focus { border-color: var(--lc-acc-b); }
.lc-input::placeholder { color: var(--lc-ink-faint); }

.lc-send {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, var(--lc-acc-a), var(--lc-acc-b));
  color: var(--lc-bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, opacity .2s;
  flex-shrink: 0;
}
.lc-send:hover:not(:disabled) { transform: scale(1.05); }
.lc-send:disabled { opacity: 0.3; cursor: not-allowed; }
.lc-send svg { width: 18px; height: 18px; display: block; }

/* ---- Lead capture form (inline in chat) ---- */
.lc-lead-form {
  align-self: stretch;
  flex-shrink: 0;
  margin: 8px 0;
  background:
    linear-gradient(135deg, oklch(0.78 0.22 340 / 0.10), oklch(0.88 0.17 35 / 0.06)),
    var(--lc-bg-2);
  border: 1px solid oklch(0.78 0.22 340 / 0.35);
  border-radius: 20px;
  padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  animation: lcFormIn .5s cubic-bezier(.2,.8,.2,1);
  position: relative; overflow: hidden;
  box-shadow: 0 0 24px oklch(0.78 0.22 340 / 0.12);
}
@keyframes lcFormIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.lc-lead-form::before {
  content: ''; position: absolute; top: -40%; right: -25%;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, oklch(0.78 0.22 340 / 0.5) 0%, transparent 70%);
  filter: blur(50px); opacity: 0.55; pointer-events: none;
  animation: lcFormGlow 4s ease-in-out infinite;
}
@keyframes lcFormGlow {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.65; }
}
.lc-lead-form > * { position: relative; z-index: 1; }

.lc-lead-eyebrow {
  font-family: var(--lc-mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--lc-acc-a);
  display: inline-flex; align-items: center; gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid oklch(0.78 0.22 340 / 0.2);
  width: fit-content;
}
.lc-lead-eyebrow-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: linear-gradient(135deg, var(--lc-acc-a), var(--lc-acc-b));
  box-shadow: 0 0 8px var(--lc-acc-b);
}

.lc-lead-title {
  font-family: var(--lc-display); font-weight: 600;
  font-size: 14px; line-height: 1.45; color: var(--lc-ink);
}
.lc-lead-title em {
  font-family: var(--lc-serif); font-style: italic; font-weight: 400;
  background: linear-gradient(120deg, var(--lc-acc-a), var(--lc-acc-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lc-lead-fields {
  display: flex; flex-direction: column; gap: 8px;
}
.lc-lead-input {
  background: rgba(11,10,13,0.7);
  border: 1px solid var(--lc-line-strong);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--lc-ink);
  font-family: var(--lc-body);
  font-size: 13px; line-height: 1.4;
  outline: none;
  transition: border-color .2s, background .2s;
  width: 100%;
}
.lc-lead-input:focus {
  border-color: var(--lc-acc-b);
  background: rgba(11,10,13,0.85);
}
.lc-lead-input::placeholder { color: var(--lc-ink-faint); }
.lc-lead-input.lc-error { border-color: oklch(0.65 0.22 25); }
.lc-lead-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.lc-lead-submit {
  background: linear-gradient(135deg, var(--lc-acc-a), var(--lc-acc-b));
  color: var(--lc-bg);
  border: 0; border-radius: 999px;
  padding: 10px 20px;
  font-family: var(--lc-display); font-weight: 600;
  font-size: 13px; letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform .2s, opacity .2s, box-shadow .2s;
  box-shadow: 0 4px 16px oklch(0.78 0.22 340 / 0.3);
}
.lc-lead-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px oklch(0.78 0.22 340 / 0.45);
}
.lc-lead-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.lc-lead-skip {
  font-family: var(--lc-mono); font-size: 11px;
  color: var(--lc-ink-dim); letter-spacing: 0.05em;
  background: none; border: 0; cursor: pointer; padding: 6px 0;
  text-decoration: underline; text-decoration-color: var(--lc-line-strong);
  text-underline-offset: 3px;
  transition: color .2s;
}
.lc-lead-skip:hover { color: var(--lc-ink); }
.lc-lead-error-msg {
  font-family: var(--lc-mono); font-size: 10px;
  color: oklch(0.85 0.15 25); letter-spacing: 0.05em;
  margin-top: -4px;
}
.lc-lead-form.lc-sending { opacity: 0.6; pointer-events: none; }
.lc-lead-form.lc-done {
  text-align: center;
  padding: 28px 22px;
  align-items: center;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}
.lc-lead-form.lc-done .lc-lead-fields,
.lc-lead-form.lc-done .lc-lead-actions { display: none; }
.lc-lead-form.lc-done .lc-lead-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--lc-ink);
  padding: 4px 0;
}
.lc-lead-form.lc-done .lc-lead-eyebrow {
  margin: 0 auto;
}
.lc-lead-eyebrow-success {
  color: oklch(0.78 0.16 155) !important;
  border-bottom-color: oklch(0.78 0.16 155 / 0.25) !important;
}
.lc-lead-eyebrow-success .lc-lead-eyebrow-dot {
  background: oklch(0.78 0.16 155) !important;
  box-shadow: 0 0 8px oklch(0.78 0.16 155) !important;
}
.lc-lead-success-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.78 0.16 155 / 0.2), oklch(0.78 0.16 155 / 0.05));
  border: 1.5px solid oklch(0.78 0.16 155 / 0.5);
  color: oklch(0.78 0.16 155);
  font-size: 24px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  margin: 4px auto 4px;
  box-shadow: 0 0 20px oklch(0.78 0.16 155 / 0.25);
  animation: lcSuccessPop .5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes lcSuccessPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.lc-lead-success-msg {
  font-size: 13px; line-height: 1.55;
  color: var(--lc-ink-dim);
  max-width: 280px;
  margin: 0 auto;
}

/* ---- Footer note ---- */
.lc-foot-note {
  padding: 0 20px 14px;
  font-family: var(--lc-mono); font-size: 9px;
  color: var(--lc-ink-faint); letter-spacing: 0.1em;
  text-transform: uppercase; text-align: center;
}
.lc-foot-note span {
  background: linear-gradient(120deg, var(--lc-acc-a), var(--lc-acc-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---- Error message ---- */
.lc-msg.error {
  align-self: flex-start;
  background: oklch(0.65 0.22 25 / 0.1);
  border: 1px solid oklch(0.65 0.22 25 / 0.4);
  color: oklch(0.85 0.15 25);
  font-size: 13px;
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
  .lc-launcher { bottom: 18px; right: 18px; width: 56px; height: 56px; }
  .lc-launcher-orb { width: 28px; height: 28px; }
  .lc-panel {
    bottom: 0; right: 0; left: 0;
    width: 100%; max-width: 100%;
    height: 92vh; max-height: 92vh;
    border-radius: 24px 24px 0 0;
  }
}

/* ---- Reduce motion ---- */
@media (prefers-reduced-motion: reduce) {
  .lc-launcher-orb, .lc-avatar { animation: none; }
  .lc-launcher-pulse, .lc-launcher-dot { animation: none; }
}
