
/* ================ CHAT SUPPORT STYLES ================ */
.chat-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-xl);
  z-index: 9998;
  transition: var(--transition);
  border: none;
  font-size: 24px;
}

.chat-toggle-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 30px rgba(67, 97, 238, 0.3);
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--card-bg);
  display: none;
}

.chat-container {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 400px;
  height: 550px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  z-index: 9997;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
  border: 1px solid var(--border);
}

.chat-container.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-container.minimized {
  height: 60px;
  width: 350px;
  overflow: hidden;
}

.chat-container.expanded {
  width: calc(50vw - 48px);
  height: calc(100vh - 148px);
  bottom: 24px;
  right: 24px;
  border-radius: var(--radius-lg);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--gradient);
  color: white;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-container {
  position: relative;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.status-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid white;
}

.chat-header-text h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.chat-status {
  margin: 0;
  font-size: 12px;
  opacity: 0.9;
}

.chat-header-actions {
  display: flex;
  gap: 8px;
}

.chat-action-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 16px;
}

.chat-action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.chat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: var(--transition);
}

.chat-messages.collapsed {
  opacity: 0.3;
  pointer-events: none;
}

.chat-welcome-message {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--glass-border);
}

.chat-welcome-message p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.user-name {
  font-weight: 600;
  color: var(--primary);
}

.message {
  display: flex;
  max-width: 80%;
}

.message-user {
  align-self: flex-end;
}

.message-bot {
  align-self: flex-start;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  position: relative;
  box-shadow: var(--shadow-sm);
  line-height: 1.4;
}

.message-user .message-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 6px;
}

.message-bot .message-bubble {
  background: var(--gray-light);
  color: var(--text);
  border-bottom-left-radius: 6px;
}

.message-error .message-bubble {
  background: var(--danger);
  color: white;
}

.message-bubble p {
  margin: 0 0 8px 0;
  font-size: 14px;
  word-wrap: break-word;
}

.message-time {
  font-size: 11px;
  opacity: 0.7;
  display: block;
  text-align: right;
}

.message-bot .message-time {
  text-align: left;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--gray-light);
  border-radius: 18px;
  align-self: flex-start;
  margin-bottom: 8px;
  border-bottom-left-radius: 6px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray);
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

.quick-questions-container {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 70%;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.05);
}

.quick-questions-container.active {
  transform: translateX(0);
}

.quick-questions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.quick-questions-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.close-questions-btn {
  background: none;
  border: none;
  color: var(--gray);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.close-questions-btn:hover {
  color: var(--primary);
  transform: rotate(90deg);
}

.quick-questions {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.quick-question {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  backdrop-filter: blur(10px);
}

.quick-question:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quick-question i {
  font-size: 16px;
  flex-shrink: 0;
}

.quick-question span {
  font-size: 13px;
  line-height: 1.4;
}

.chat-quick-actions {
  display: flex;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  gap: 10px;
}

.toggle-questions-btn, .end-chat-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 500;
}

.toggle-questions-btn:hover {
  background: var(--primary-light);
  color: white;
  border-color: var(--primary-light);
}

.end-chat-btn:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}

.input-container {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

#chatInput {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 12px 48px 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  resize: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  background: var(--bg);
  color: var(--text);
  transition: var(--transition);
}

#chatInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.chat-input-actions {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 5px;
}

.input-action-btn, .chat-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
  color: var(--gray);
  font-size: 18px;
}

.input-action-btn:hover {
  color: var(--primary);
  background: rgba(67, 97, 238, 0.1);
}

.chat-send-btn {
  background: var(--primary);
  color: white;
}

.chat-send-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}

/* Ajuste para o botão de enviar não ficar sobreposto */
.chat-container.active ~ .chat-toggle-btn {
  z-index: 9996; /* Fica atrás do chat quando aberto */
}

/* Ícones corrigidos */
.ri-expand-diagonal-2-line:before { content: "\f1a6"; }
.ri-collapse-diagonal-2-line:before { content: "\f1a5"; }

/* Responsive Design */
@media (max-width: 768px) {
  .chat-toggle-btn {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
  
  .chat-container {
    width: calc(100vw - 32px);
    height: 65vh;
    bottom: 84px;
    right: 16px;
    left: 16px;
  }
  
  .chat-container.expanded {
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
    bottom: 16px;
    right: 16px;
    left: 16px;
  }
  
  .chat-container.minimized {
    width: calc(100vw - 32px);
    height: 60px;
  }
  
  .quick-questions-container {
    width: 85%;
  }
  
  .message {
    max-width: 90%;
  }
  
  /* Ajuste adicional para mobile */
  .chat-container.active ~ .chat-toggle-btn {
    display: none; /* Esconde o botão flutuante quando o chat está aberto no mobile */
  }
}

/* Animation for new messages */
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message {
  animation: messageSlideIn 0.3s ease;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar,
.quick-questions::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.quick-questions::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.quick-questions::-webkit-scrollbar-thumb {
  background: var(--gray-light);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.quick-questions::-webkit-scrollbar-thumb:hover {
  background: var(--gray);
}

/* Dark mode adjustments */
[data-theme="dark"] .message-bot .message-bubble {
  background: var(--darker);
  border: 1px solid var(--border);
}

[data-theme="dark"] .quick-question {
  background: rgba(30, 30, 30, 0.6);
}

[data-theme="dark"] #chatInput {
  background: var(--darker);
}

[data-theme="dark"] .typing-indicator {
  background: var(--darker);
}

/* Estilo para o emoji picker */
.emoji-picker {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
