/* ===================================
   Chat Widget Styles - CEC Corredores
   =================================== */

/* Chat Button (Floating) */
.chat-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #3c8162 0%, #2d6247 100%);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(60, 129, 98, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 9999;
  animation: pulse 2s infinite;
}

.chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(60, 129, 98, 0.6);
}

.chat-button.active {
  transform: scale(0.9);
}

.chat-button svg {
  width: 28px;
  height: 28px;
  fill: white;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(60, 129, 98, 0.4);
  }
  50% {
    box-shadow: 0 4px 20px rgba(60, 129, 98, 0.6);
  }
}

/* Chat Window */
.chat-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 550px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  animation: slideUp 0.3s ease;
}

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

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

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

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

.chat-avatar {
  width: 40px;
  height: 40px;
  background: white;
  color: #3c8162;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.chat-header-text h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.chat-header-text p {
  margin: 0;
  font-size: 12px;
  opacity: 0.9;
}

.chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s ease;
  line-height: 1;
}

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

/* Chat Body */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fa;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Messages */
.message {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

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

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

.message.bot .message-avatar {
  background: #3c8162;
  color: white;
}

.message.user .message-avatar {
  background: #cf9b2a;
  color: white;
}

.message-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 12px;
  animation: fadeIn 0.3s ease;
}

.message.bot .message-bubble {
  background: white;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message.user .message-bubble {
  background: #cf9b2a;
  color: white;
  border-bottom-right-radius: 4px;
}

.message-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

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

/* Quick Replies */
.quick-replies {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.quick-reply-btn {
  background: #f0f0f0;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  color: #333;
}

.quick-reply-btn:hover:not(:disabled) {
  background: #3c8162;
  color: white;
  border-color: #3c8162;
}

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

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-10px); }
}

/* Chat Input */
.chat-input-container {
  border-top: 1px solid #e0e0e0;
  background: white;
  padding: 12px;
}

.chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s ease;
}

.chat-input:focus {
  border-color: #3c8162;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  background: #3c8162;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #2d6247;
  transform: scale(1.05);
}

.chat-send-btn svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* Scrollbar Styling */
.chat-body::-webkit-scrollbar {
  width: 6px;
}

.chat-body::-webkit-scrollbar-track {
  background: transparent;
}

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

.chat-body::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .chat-button {
    width: 56px;
    height: 56px;
    bottom: 16px;
    right: 16px;
  }

  .chat-button svg {
    width: 24px;
    height: 24px;
  }

  .chat-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
    bottom: 80px;
    right: 16px;
  }

  .chat-header {
    padding: 12px;
  }

  .chat-avatar {
    width: 36px;
    height: 36px;
  }

  .chat-body {
    padding: 12px;
  }

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

/* Accessibility */
.chat-button:focus,
.chat-close:focus,
.chat-send-btn:focus,
.chat-input:focus,
.quick-reply-btn:focus {
  outline: 2px solid #cf9b2a;
  outline-offset: 2px;
}
