/* ========================================
   LIVESTOCK TRACKER CHAT WIDGET
   ======================================== */

.lt-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  transition: transform 0.15s ease, background 0.15s ease;
}

.lt-chat-launcher:hover {
  background: var(--brand-dark);
  transform: scale(1.05);
}

.lt-chat-launcher[hidden] {
  display: none !important;
}

.lt-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  width: min(360px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 100px));
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
  color: var(--text);
}

.lt-chat-panel[hidden] {
  display: none !important;
}

.lt-chat-header {
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.lt-chat-header-title {
  font-weight: 700;
  font-size: 15px;
}

.lt-chat-header-subtitle {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 2px;
}

.lt-chat-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.lt-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-alt);
}

.lt-chat-bubble {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.lt-chat-bubble-assistant {
  align-self: flex-start;
  background: var(--bg);
  box-shadow: var(--shadow);
  border-bottom-left-radius: 4px;
}

.lt-chat-bubble-user {
  align-self: flex-end;
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.lt-chat-bubble-error {
  align-self: flex-start;
  background: #fdecea;
  color: #7a1f1f;
  border-bottom-left-radius: 4px;
}

.lt-chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}

.lt-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.4;
  animation: lt-chat-typing-bounce 1s infinite ease-in-out;
}

.lt-chat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.lt-chat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes lt-chat-typing-bounce {
  0%, 60%, 100% {
    opacity: 0.4;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.lt-chat-consent {
  align-self: stretch;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.lt-chat-consent p {
  margin: 0 0 10px 0;
}

.lt-chat-consent a {
  color: var(--brand);
}

.lt-chat-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--bg-alt);
  padding: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg);
}

.lt-chat-escape {
  flex-shrink: 0;
  padding: 6px 10px 0 10px;
  font-size: 11px;
  text-align: center;
  color: var(--text);
  opacity: 0.7;
}

.lt-chat-escape a {
  color: var(--brand);
}

.lt-chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--bg-alt);
  border-radius: 10px;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13.5px;
  max-height: 90px;
  min-height: 38px;
}

.lt-chat-input:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
}

.lt-chat-send,
.lt-chat-consent-accept {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.lt-chat-send:hover,
.lt-chat-consent-accept:hover {
  background: var(--brand-dark);
}

.lt-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .lt-chat-panel {
    right: 16px;
    left: 16px;
    width: auto;
  }
}
