/* Chat Widget - eradigital.dev */
/* Modal e Overlay */

.chat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.chat-overlay.active {
  opacity: 1;
  visibility: visible;
}

.chat-modal {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
}

.chat-overlay.active .chat-modal {
  transform: translateY(0) scale(1);
}

/* Header do Chat */
.chat-header {
  background: #333333;
  color: #ffffff;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 16px 16px 0 0;
}

.chat-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  background: rgba(0, 188, 212, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.chat-subtitle {
  font-size: 12px;
  color: #00BCD4;
  font-weight: 500;
}

.chat-close {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Área de Mensagens */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #fafafa;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Mensagens */
.message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bot-message .message-avatar {
  background: rgba(0, 188, 212, 0.1);
}

.user-message {
  flex-direction: row-reverse;
}

.user-message .message-content {
  align-items: flex-end;
}

.message-content {
  max-width: calc(100% - 44px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-content p {
  margin: 0;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.bot-message .message-content p {
  background: #ffffff;
  color: #333333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-message .message-content p {
  background: linear-gradient(135deg, #00BCD4, #0097A7);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.message-time {
  font-size: 11px;
  color: #999999;
  padding: 0 16px;
}

/* Indicador de Digitação */
.typing .message-content {
  align-items: flex-start;
}

.typing-dots {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #ffffff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: #00BCD4;
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Área de Input */
.chat-input-area {
  background: #ffffff;
  border-top: 1px solid #e0e0e0;
  padding: 16px 20px;
}

.chat-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

#chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  resize: none;
  min-height: 20px;
  max-height: 80px;
}

#chat-input:focus {
  border-color: #00BCD4;
}

.chat-send {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #00BCD4, #0097A7);
  border: none;
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-send:hover {
  background: linear-gradient(135deg, #00ACC1, #00838F);
  transform: scale(1.05);
}

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

/* Responsividade */
@media (max-width: 480px) {
  .chat-modal {
    bottom: 20px;
    right: 20px;
    left: 20px;
    width: auto;
    height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
  }

  .chat-header {
    padding: 16px;
  }

  .chat-messages {
    padding: 16px;
  }

  .chat-input-area {
    padding: 12px 16px;
  }
}