/**
 * 💬 Agent Chat Widget Styles (Dashboard)
 * 
 * Floating button + expandable chat window
 * Mobile-first responsive design
 */

/* ==================== WIDGET WRAPPER ==================== */
.agent-chat-widget-wrapper {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
}

/* ==================== FLOATING BUTTON ==================== */
.chat-widget-toggle {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-widget-toggle:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

.chat-widget-toggle.hidden {
  opacity: 0;
  transform: scale(0);
  pointer-events: none;
}

/* Badge de notificações */
.widget-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: #f56565;
  border-radius: 12px;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 101, 101, 0.7);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(245, 101, 101, 0);
  }
}

/* ==================== CHAT CONTAINER (EXPANDIDO) ==================== */
.chat-widget-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 480px;
  height: 720px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chat-widget-container.expanded {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ==================== HEADER ==================== */
.chat-widget-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1.25rem;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-title h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* ==================== CONTENT ==================== */
.chat-widget-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Reuso estilos do módulo principal */
.chat-widget-content .agent-chat-module {
  height: 100%;
  border-radius: 0;
  box-shadow: none;
}

.chat-widget-content .chat-header {
  padding: 1rem;
}

.chat-widget-content .chat-messages {
  max-height: none;
  min-height: 0;
}

.chat-widget-content .chat-input-wrapper {
  padding: 1rem;
}

.chat-widget-content .quick-suggestions {
  padding: 0.75rem 1rem;
}

/* ==================== ERROR STATE ==================== */
.widget-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  text-align: center;
  color: #718096;
}

.widget-error p {
  margin: 0.5rem 0;
  color: #2d3748;
}

.widget-error button {
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.widget-error button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ==================== RESPONSIVE ==================== */

/* Tablet */
@media (max-width: 1024px) {
  .chat-widget-container {
    width: 380px;
    height: 550px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .agent-chat-widget-wrapper {
    bottom: 1rem;
    right: 1rem;
  }

  .chat-widget-toggle {
    width: 56px;
    height: 56px;
  }

  .chat-widget-container {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    top: auto;
    width: 100%;
    height: 80vh;
    max-height: 600px;
    border-radius: 16px 16px 0 0;
  }

  .chat-widget-content .chat-messages {
    padding: 1rem;
  }

  .chat-widget-content .message-content {
    max-width: 85%;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .chat-widget-container {
    height: 90vh;
  }

  .header-title h3 {
    font-size: 1rem;
  }

  .icon-btn {
    width: 28px;
    height: 28px;
  }
}
