/**
 * 💬 Agent Chat Module Styles
 * 
 * Design System compliant
 * Premium UI with animations
 * Responsive (768px, 1024px, 1440px)
 */

/* ==================== CONTAINER ==================== */
.agent-chat-module {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.1);
  overflow: hidden;
}

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

.agent-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 300px;
}

.agent-selector-wrapper label {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.agent-select {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.95);
  color: #2d3748;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.agent-select:hover {
  border-color: rgba(255, 255, 255, 0.6);
  background: white;
}

.agent-select:focus {
  outline: none;
  border-color: white;
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.agent-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.agent-role {
  font-size: 0.9rem;
  font-weight: 600;
}

.agent-status {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* ==================== MESSAGES AREA ==================== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  background: #f7fafc;
  min-height: 400px;
  max-height: 600px;
}

/* Custom scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #5568d3 0%, #6a4190 100%);
}

/* ==================== EMPTY STATE ==================== */
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #718096;
  padding: 3rem;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.chat-empty h3 {
  font-size: 1.5rem;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.chat-empty p {
  font-size: 1rem;
  color: #718096;
}

/* ==================== MESSAGES ==================== */
.chat-message {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: messageSlideIn 0.3s ease-out;
}

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

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

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.chat-message.user .message-avatar {
  background: #e2e8f0;
}

.message-content {
  flex: 1;
  max-width: 70%;
}

.chat-message.user .message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

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

.message-author {
  font-size: 0.85rem;
  font-weight: 600;
  color: #4a5568;
}

.message-time {
  font-size: 0.75rem;
  color: #a0aec0;
}

.message-text {
  background: white;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  color: #2d3748;
  line-height: 1.6;
  word-wrap: break-word;
}

.chat-message.user .message-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3);
}

.message-text strong {
  font-weight: 700;
}

.message-text em {
  font-style: italic;
}

.message-text code {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.chat-message.user .message-text code {
  background: rgba(255, 255, 255, 0.2);
}

/* ==================== MESSAGE ACTIONS ==================== */
.message-actions {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #f7fafc;
  border-radius: 8px;
  border-left: 3px solid #667eea;
}

.actions-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 0.5rem;
}

.action-btn {
  display: inline-block;
  margin: 0.25rem;
  padding: 0.5rem 1rem;
  background: white;
  border: 2px solid #667eea;
  border-radius: 6px;
  color: #667eea;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ==================== TYPING INDICATOR ==================== */
.chat-message.typing .message-text {
  background: white;
  padding: 1rem;
  display: inline-block;
}

.typing-dots {
  display: flex;
  gap: 0.3rem;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e0;
  animation: typingBounce 1.4s infinite;
}

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

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

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

/* ==================== INPUT AREA ==================== */
.chat-input-wrapper {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  background: white;
  border-top: 1px solid #e2e8f0;
}

.chat-input {
  flex: 1;
  padding: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  transition: all 0.3s ease;
}

.chat-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input:disabled {
  background: #f7fafc;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-send {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-send:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-send:active:not(:disabled) {
  transform: translateY(0);
}

.btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-send svg {
  flex-shrink: 0;
}

/* ==================== QUICK SUGGESTIONS ==================== */
.quick-suggestions {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: #f7fafc;
  border-top: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.suggestion-btn {
  padding: 0.5rem 1rem;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  color: #4a5568;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.suggestion-btn:hover {
  border-color: #667eea;
  color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

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

/* Tablet (1024px) */
@media (max-width: 1024px) {
  .chat-header {
    flex-direction: column;
    align-items: stretch;
  }

  .agent-selector-wrapper {
    min-width: 100%;
  }

  .message-content {
    max-width: 80%;
  }
}

/* Mobile (768px) */
@media (max-width: 768px) {
  .chat-messages {
    padding: 1rem;
    min-height: 300px;
  }

  .chat-header {
    padding: 1rem;
  }

  .agent-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

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

  .message-avatar {
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
  }

  .chat-input-wrapper {
    padding: 1rem;
    flex-direction: column;
  }

  .btn-send {
    width: 100%;
    justify-content: center;
  }

  .quick-suggestions {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .suggestion-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .action-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .chat-size-controls {
    display: none; /* Ocultar em mobile */
  }
}

/* ==================== SIZE CONTROLS ==================== */
.chat-size-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
}

.size-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.size-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-2px);
}

.size-btn:active {
  transform: translateY(0);
}

.size-btn.active {
  background: white;
  border-color: white;
  color: #667eea;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.size-btn svg {
  pointer-events: none; /* Evitar click no SVG */
}

/* ==================== SIZE TRANSITIONS ==================== */
.agent-chat-module {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.agent-chat-module.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999;
  border-radius: 0;
  animation: expandFullscreen 0.4s ease-out;
}

@keyframes expandFullscreen {
  from {
    transform: scale(0.9);
    opacity: 0.8;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

