/* ==========================================================================
   LYNX EMS INDUSTRIAL - AI CHAT WIDGET STYLES
   ========================================================================== */

/* Floating Chat Trigger Button */
.lynx-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: var(--font-body);
}

.lynx-chat-trigger {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-dark-card);
  border: 1px solid var(--border-cad);
  color: var(--color-laser-blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0, 240, 255, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.lynx-chat-trigger:hover {
  transform: scale(1.08) translateY(-2px);
  border-color: var(--color-laser-blue);
  box-shadow: 0 8px 32px rgba(0, 240, 255, 0.3);
}

.lynx-chat-trigger::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 1px solid var(--color-laser-blue);
  opacity: 0;
  animation: pulse-laser 2s infinite;
}

@keyframes pulse-laser {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

.lynx-chat-trigger svg {
  width: 26px;
  height: 26px;
  transition: transform 0.4s ease;
}

.lynx-chat-trigger.active svg {
  transform: rotate(90deg);
}

/* Chat Window Container */
.lynx-chat-container {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: rgba(16, 16, 19, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-cad);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.lynx-chat-container.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Chat Header */
.lynx-chat-header {
  background: #0c0c0e;
  border-bottom: 1px solid var(--border-cad);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.lynx-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid var(--color-laser-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-laser-blue);
  position: relative;
}

.lynx-chat-avatar::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981; /* green online indicator */
  border: 2px solid #0c0c0e;
}

.lynx-chat-info {
  flex-grow: 1;
}

.lynx-chat-title {
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
}

.lynx-chat-status {
  font-size: 0.75rem;
  color: #a0a0ab;
}

.lynx-chat-close {
  background: none;
  border: none;
  color: #a0a0ab;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.lynx-chat-close:hover {
  color: var(--text-primary);
}

/* Chat Body (Messages / Form) */
.lynx-chat-body {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Pre-Chat Form */
.lynx-prechat-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  gap: 14px;
}

.lynx-prechat-welcome {
  color: #a0a0ab;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 8px;
  text-align: center;
}

.lynx-prechat-welcome strong {
  color: var(--text-primary);
}

/* Messages styling */
.lynx-chat-message {
  max-width: 80%;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  word-break: break-word;
}

.lynx-chat-message.bot {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-cad);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.lynx-chat-message.user {
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid var(--color-laser-blue);
  color: var(--color-laser-blue);
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.lynx-chat-message a {
  color: var(--color-laser-orange);
  text-decoration: underline;
  word-break: break-all;
}

/* Typing Indicator Animation */
.lynx-chat-typing {
  align-self: flex-start;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-cad);
  padding: 10px 14px;
  border-radius: 8px;
  border-bottom-left-radius: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lynx-chat-typing span {
  width: 6px;
  height: 6px;
  background: var(--color-laser-blue);
  border-radius: 50%;
  display: inline-block;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.lynx-chat-typing span:nth-child(1) { animation-delay: -0.32s; }
.lynx-chat-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Chat Footer / Input area */
.lynx-chat-footer {
  border-top: 1px solid var(--border-cad);
  padding: 12px 16px;
  background: #0c0c0e;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lynx-chat-input {
  flex-grow: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-cad);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
  resize: none;
  height: 40px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.lynx-chat-input:focus {
  outline: none;
  border-color: var(--color-laser-blue);
}

.lynx-chat-send {
  background: var(--bg-dark-card);
  border: 1px solid var(--border-cad);
  color: var(--color-laser-blue);
  width: 40px;
  height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lynx-chat-send:hover:not(:disabled) {
  background: var(--color-laser-blue);
  color: #000;
  border-color: var(--color-laser-blue);
}

.lynx-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Responsive adjustment for small screens */
@media (max-width: 480px) {
  .lynx-chat-container {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }
  .lynx-chat-trigger {
    bottom: 16px;
    right: 16px;
  }
}
