/* =====================================================
   Lucy chat widget
   Embedded launcher + floating panel for lucylabs.ai
   ===================================================== */

:root {
  --lc-indigo: #3b55e6;
  --lc-indigo-deep: #2a3dc4;
  --lc-paper: #f4f1ea;
  --lc-paper-soft: #faf8f2;
  --lc-ivory: #fbfaf5;
  --lc-ink: #0e1330;
  --lc-ink-70: #3a3f5c;
  --lc-ink-50: #6b6f86;
  --lc-ink-15: #d7d8e0;
  --lc-bubble-lucy: #eae6db;
  --lc-bubble-user: #3b55e6;
  --lc-radius: 18px;
  --lc-shadow: 0 20px 60px rgba(14, 19, 48, 0.22);
  --lc-sans: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.lc-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--lc-ink);
  color: var(--lc-ivory);
  font: 500 15px/1 var(--lc-sans);
  cursor: pointer;
  box-shadow: var(--lc-shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}

.lc-launcher:hover {
  transform: translateY(-2px);
  background: #1a1f45;
}

.lc-launcher img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--lc-paper-soft);
  object-fit: cover;
}

.lc-launcher.is-hidden {
  display: none;
}

.lc-panel {
  font-family: var(--lc-sans);
  color: var(--lc-ink);
  background: var(--lc-paper-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lc-panel.is-embedded {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  width: min(380px, calc(100vw - 44px));
  height: min(620px, calc(100vh - 44px));
  border-radius: 22px;
  box-shadow: var(--lc-shadow);
  border: 1px solid rgba(14, 19, 48, 0.08);
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.lc-panel.is-embedded.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.lc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--lc-ivory);
  border-bottom: 1px solid var(--lc-ink-15);
}

.lc-head img.lc-head-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--lc-paper-soft);
  object-fit: cover;
  flex-shrink: 0;
}

.lc-head .lc-head-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lc-head .lc-head-name {
  font-weight: 600;
  font-size: 15px;
}

.lc-head .lc-head-status {
  color: var(--lc-ink-50);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 10px;
}

.lc-head .lc-head-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2ebf7b;
  box-shadow: 0 0 0 3px rgba(46, 191, 123, 0.18);
}

.lc-head button {
  border: 0;
  background: transparent;
  color: var(--lc-ink-50);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}

.lc-head button:hover {
  color: var(--lc-ink);
  background: var(--lc-ink-15);
}

.lc-voice-toggle[aria-pressed="true"] {
  color: var(--lc-indigo);
}

.lc-transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    radial-gradient(circle at 10% 0%, rgba(59, 85, 230, 0.06), transparent 40%),
    var(--lc-paper-soft);
  scroll-behavior: smooth;
}

.lc-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 100%;
}

.lc-row.lc-row-lucy {
  justify-content: flex-start;
}

.lc-row.lc-row-user {
  justify-content: flex-end;
}

.lc-row .lc-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--lc-paper);
  flex-shrink: 0;
  object-fit: cover;
}

.lc-row.lc-row-user .lc-avatar {
  display: none;
}

.lc-row.lc-row-stacked .lc-avatar {
  visibility: hidden;
}

.lc-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: var(--lc-radius);
  line-height: 1.42;
  font-size: 15px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.lc-row-lucy .lc-bubble {
  background: var(--lc-bubble-lucy);
  color: var(--lc-ink);
  border-bottom-left-radius: 6px;
}

.lc-cta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.lc-cta-list a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--lc-ivory);
  color: var(--lc-indigo-deep);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(59, 85, 230, 0.22);
}

.lc-cta-list a:hover {
  border-color: rgba(59, 85, 230, 0.5);
}

.lc-row-user .lc-bubble {
  background: var(--lc-bubble-user);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.lc-typing .lc-bubble {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
}

.lc-typing .lc-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lc-ink-50);
  animation: lc-blink 1.2s infinite ease-in-out;
}

.lc-typing .lc-bubble span:nth-child(2) {
  animation-delay: 0.2s;
}

.lc-typing .lc-bubble span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes lc-blink {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.lc-intro {
  align-self: center;
  max-width: 320px;
  text-align: center;
  margin: 8px 0 4px;
  color: var(--lc-ink-50);
  font-size: 13px;
  line-height: 1.4;
}

.lc-intro strong {
  color: var(--lc-ink);
  font-weight: 600;
}

.lc-composer {
  padding: 10px 10px 12px;
  border-top: 1px solid var(--lc-ink-15);
  background: var(--lc-ivory);
}

.lc-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--lc-paper);
  border: 1px solid var(--lc-ink-15);
  border-radius: 22px;
  padding: 6px 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lc-composer-row:focus-within {
  border-color: var(--lc-indigo);
  box-shadow: 0 0 0 3px rgba(59, 85, 230, 0.15);
}

.lc-composer textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  resize: none;
  color: var(--lc-ink);
  font: 400 15px/1.4 var(--lc-sans);
  padding: 8px 6px;
  max-height: 140px;
  min-height: 20px;
  outline: 0;
}

.lc-composer textarea::placeholder {
  color: var(--lc-ink-50);
}

.lc-icon-btn {
  border: 0;
  background: transparent;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--lc-ink-70);
  transition: background 0.15s ease, color 0.15s ease, transform 0.08s ease;
}

.lc-icon-btn:hover:not(:disabled) {
  background: var(--lc-ink-15);
  color: var(--lc-ink);
}

.lc-icon-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.lc-icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.lc-icon-btn svg {
  width: 20px;
  height: 20px;
}

.lc-mic-btn.is-recording {
  background: #e6273d;
  color: #fff;
  animation: lc-pulse 1.2s infinite;
}

.lc-mic-btn.is-recording:hover {
  background: #c31f31;
  color: #fff;
}

@keyframes lc-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(230, 39, 61, 0.5);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(230, 39, 61, 0);
  }
}

.lc-send-btn {
  background: var(--lc-indigo);
  color: #fff;
}

.lc-send-btn:hover:not(:disabled) {
  background: var(--lc-indigo-deep);
  color: #fff;
}

.lc-send-btn:disabled {
  background: var(--lc-ink-15);
  color: var(--lc-ink-50);
}

.lc-hint {
  color: var(--lc-ink-50);
  font-size: 11px;
  padding: 4px 8px 0;
  text-align: center;
}

.lc-error {
  color: #a11425;
  font-size: 12px;
  padding: 4px 10px 0;
  text-align: center;
}

.lc-turnstile {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 680px) {
  .lc-panel.is-embedded {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
    height: min(78vh, 620px);
  }

  .lc-launcher {
    right: 12px;
    bottom: 12px;
    padding-right: 14px;
  }

  .lc-launcher .lc-launcher-label {
    display: none;
  }

  .lc-bubble {
    max-width: 84%;
  }
}
