/* Chat Overlay */

.ls-chat {
  position: fixed;
  bottom: 1.5em;
  right: 1.5em;
  z-index: 1000;
  font-family: var(--wb-font-body);
}

.ls-chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--wb-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: background 0.2s, transform 0.2s;
}
.ls-chat-toggle:hover {
  background: var(--wb-primary-hover);
  transform: scale(1.05);
}

/* Pulse animation on load */
.ls-chat-toggle {
  animation: ls-pulse 2s ease-in-out 3;
}
@keyframes ls-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
  50% { box-shadow: 0 4px 16px rgba(0,0,0,0.2), 0 0 0 8px rgba(27, 107, 74, 0.2); }
}

.ls-chat-panel {
  display: none;
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 360px;
  max-height: 480px;
  background: #fff;
  border-radius: var(--wb-radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  flex-direction: column;
  overflow: hidden;
}
.ls-chat-panel.open {
  display: flex;
}

.ls-chat-header {
  background: var(--wb-dark);
  color: #fff;
  padding: 0.8em 1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
}
.ls-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
}
.ls-chat-close:hover { opacity: 1; }

.ls-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1em;
  min-height: 250px;
  max-height: 340px;
}

.ls-msg {
  margin-bottom: 0.8em;
  max-width: 85%;
  padding: 0.6em 1em;
  border-radius: var(--wb-radius-md);
  font-size: 0.9rem;
  line-height: 1.5;
  animation: ls-msg-in 0.3s ease;
}
@keyframes ls-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ls-msg--agent {
  background: var(--wb-light);
  color: var(--wb-text);
  border-bottom-left-radius: 4px;
  margin-right: auto;
}
.ls-msg--user {
  background: var(--wb-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  margin-left: auto;
}

.ls-msg--typing {
  background: var(--wb-light);
  color: var(--wb-text-light);
  border-bottom-left-radius: 4px;
  margin-right: auto;
}
.ls-typing-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wb-text-light);
  margin: 0 2px;
  animation: ls-dot-bounce 1.2s infinite;
}
.ls-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ls-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ls-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

.ls-chat-form {
  display: flex;
  border-top: 1px solid #e5e7eb;
  padding: 0.6em;
  gap: 0.5em;
}
.ls-chat-form input {
  flex: 1;
  padding: 0.6em 0.8em;
  border: 1px solid #d1d5db;
  border-radius: var(--wb-radius-md);
  font-family: var(--wb-font-body);
  font-size: 0.9rem;
  outline: none;
}
.ls-chat-form input:focus {
  border-color: var(--wb-primary);
}
.ls-chat-form button {
  padding: 0.6em 1.2em;
  background: var(--wb-primary);
  color: #fff;
  border: none;
  border-radius: var(--wb-radius-md);
  font-family: var(--wb-font-body);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}
.ls-chat-form button:hover { background: var(--wb-primary-hover); }

@media (max-width: 480px) {
  .ls-chat-panel {
    width: calc(100vw - 2em);
    right: -0.5em;
    bottom: 65px;
    max-height: 70vh;
  }
}
