/* ==================== CHATBOT WIDGET ==================== */

#lime-chat-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
}

/* Chat Button */
.chat-toggle-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--terracotta, #B7410E);
  color: white;
  border: 3px solid rgba(255,255,255,0.85);
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(183, 65, 14, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
  padding: 0;
}

.toggle-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 50%;
}

.chat-toggle-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 28px rgba(183, 65, 14, 0.65);
}

.chat-toggle-btn .badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #28a745;
  border-radius: 50%;
  border: 2px solid white;
}

/* Chat Window */
.chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 350px;
  height: 500px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transform-origin: bottom right;
  animation: chatPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-window.open {
  display: flex;
}

@keyframes chatPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #2a2a2a 0%, #3d1a0a 100%);
  color: white;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-info img,
.agent-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 0 0 3px rgba(255, 183, 90, 0.5);
}

.chat-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
}

.chat-header p {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.8;
}

.chat-close-btn {
  background: transparent;
  color: white;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.chat-close-btn:hover {
  opacity: 1;
}

/* Chat Messages Area */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f9f9f9;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-message.bot {
  background: white;
  color: var(--charcoal);
  border: 1px solid rgba(0,0,0,0.05);
  border-bottom-left-radius: 2px;
  align-self: flex-start;
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.chat-message.user {
  background: var(--terracotta);
  color: white;
  border-bottom-right-radius: 2px;
  align-self: flex-end;
  box-shadow: 0 2px 5px rgba(183, 65, 14, 0.2);
}

/* Format markdown from bot */
.chat-message.bot strong { font-weight: 700; color: var(--terracotta); }
.chat-message.bot p { margin: 0 0 8px 0; }
.chat-message.bot p:last-child { margin: 0; }

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 12px;
  border-bottom-left-radius: 2px;
  align-self: flex-start;
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
  width: fit-content;
  display: none;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #bbb;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

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

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

/* Chat Input */
.chat-input-area {
  padding: 15px;
  background: white;
  border-top: 1px solid rgba(0,0,0,0.05);
  display: flex;
  gap: 10px;
}

.chat-input-area input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 20px;
  outline: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.chat-input-area input:focus {
  border-color: var(--terracotta);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  background: var(--terracotta);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: transform 0.2s;
}

.chat-send-btn:hover {
  transform: scale(1.1);
}

.chat-send-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .chat-window {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
    animation: slideUp 0.3s ease;
  }
  
  @keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
  
  #lime-chat-widget.mobile-open .chat-toggle-btn {
    display: none;
  }
}
