/* LS3 Chat Widget — floating bubble + slide-up panel.
   Theme tokens reuse the main site CSS variables (--gold, --text, --border)
   defined in index.html. Falls back if loaded standalone. */

:root {
  --ls3c-gold:   #9bd44a;
  --ls3c-bg:     #0e1620;
  --ls3c-bg-2:   #131c28;
  --ls3c-border: rgba(255,255,255,0.08);
  --ls3c-text:   #e2eaf5;
  --ls3c-muted:  #8da0b8;
}

#ls3-chat-launcher {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9990;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ls3c-gold);
  color: #0e1620;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 32px rgba(0,0,0,0.40), 0 0 0 4px rgba(155,212,74,0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
#ls3-chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(0,0,0,0.50), 0 0 0 6px rgba(155,212,74,0.18); }
#ls3-chat-launcher svg { width: 26px; height: 26px; }
#ls3-chat-launcher .ls3c-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(155,212,74,0.45);
  animation: ls3c-pulse 2s infinite;
  pointer-events: none;
}
@keyframes ls3c-pulse {
  0%   { transform: scale(1);   opacity: 0.7; }
  100% { transform: scale(1.4); opacity: 0;   }
}

#ls3-chat-panel {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9991;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: 580px;
  max-height: calc(100vh - 48px);
  background: var(--ls3c-bg);
  border: 1px solid var(--ls3c-border);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--ls3c-text);
  font-size: 14px;
  animation: ls3c-slide 0.22s ease;
}
#ls3-chat-panel.open { display: flex; }

@keyframes ls3c-slide {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.ls3c-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--ls3c-border);
  background: linear-gradient(180deg, rgba(155,212,74,0.06), transparent);
}
.ls3c-header-title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: var(--ls3c-text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.ls3c-header-title::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ls3c-gold);
  box-shadow: 0 0 8px var(--ls3c-gold);
}
.ls3c-header-sub {
  font-size: 11px;
  color: var(--ls3c-muted);
  margin-top: 2px;
  letter-spacing: 0.05em;
}
.ls3c-header-meta { line-height: 1.2; }
.ls3c-close {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--ls3c-border);
  color: var(--ls3c-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ls3c-close:hover { background: rgba(255,255,255,0.04); color: var(--ls3c-text); border-color: rgba(255,255,255,0.18); }

.ls3c-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.ls3c-messages::-webkit-scrollbar { width: 8px; }
.ls3c-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 8px; }

.ls3c-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 13.5px;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.ls3c-msg.assistant {
  align-self: flex-start;
  background: var(--ls3c-bg-2);
  border: 1px solid var(--ls3c-border);
  border-top-left-radius: 4px;
}
.ls3c-msg.user {
  align-self: flex-end;
  background: rgba(155,212,74,0.12);
  border: 1px solid rgba(155,212,74,0.22);
  color: var(--ls3c-text);
  border-top-right-radius: 4px;
}
.ls3c-msg a {
  color: var(--ls3c-gold);
  text-decoration: none;
  border-bottom: 1px dotted rgba(155,212,74,0.4);
}
.ls3c-msg a:hover { border-bottom-style: solid; }

.ls3c-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--ls3c-bg-2);
  border: 1px solid var(--ls3c-border);
  border-radius: 12px;
  border-top-left-radius: 4px;
}
.ls3c-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ls3c-muted);
  animation: ls3c-bounce 1.2s infinite;
}
.ls3c-typing span:nth-child(2) { animation-delay: 0.15s; }
.ls3c-typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes ls3c-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

.ls3c-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}
.ls3c-suggest-btn {
  font-family: inherit;
  font-size: 12px;
  padding: 7px 11px;
  background: rgba(155,212,74,0.06);
  color: var(--ls3c-text);
  border: 1px solid rgba(155,212,74,0.20);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ls3c-suggest-btn:hover {
  background: rgba(155,212,74,0.14);
  border-color: rgba(155,212,74,0.40);
}

.ls3c-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--ls3c-border);
  background: rgba(255,255,255,0.015);
}
.ls3c-textarea {
  flex: 1;
  background: var(--ls3c-bg-2);
  border: 1px solid var(--ls3c-border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ls3c-text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  resize: none;
  min-height: 22px;
  max-height: 110px;
  outline: none;
  transition: border-color 0.15s;
}
.ls3c-textarea:focus { border-color: rgba(155,212,74,0.45); }
.ls3c-textarea::placeholder { color: var(--ls3c-muted); }

.ls3c-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--ls3c-gold);
  color: #0e1620;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, opacity 0.15s;
  flex-shrink: 0;
}
.ls3c-send:hover { transform: translateY(-1px); }
.ls3c-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.ls3c-send svg { width: 18px; height: 18px; }

.ls3c-footer {
  padding: 8px 14px 10px;
  font-size: 10.5px;
  color: var(--ls3c-muted);
  text-align: center;
  letter-spacing: 0.03em;
  border-top: 1px solid var(--ls3c-border);
}
.ls3c-footer .ls3c-gold-pulse { color: var(--ls3c-gold); }

.ls3c-error {
  margin: 0 16px 8px;
  padding: 9px 12px;
  background: rgba(255, 92, 92, 0.10);
  border: 1px solid rgba(255, 92, 92, 0.30);
  border-radius: 8px;
  color: #ff9b9b;
  font-size: 12px;
}

@media (max-width: 480px) {
  #ls3-chat-panel {
    bottom: 0; right: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: 0;
  }
  #ls3-chat-launcher { bottom: 16px; right: 16px; width: 54px; height: 54px; }
}
