/* Chatbot Styles for Reparacions Flaçà */

/* Chat Toggle Button - Matching React/Tailwind exactly */
.chat-toggle-btn {
  position: fixed;
  bottom: 1.5rem; /* 24px = bottom-6 */
  right: 1.5rem; /* 24px = right-6 */
  background-color: #D97706; /* bg-mr-orange */
  color: white;
  border: none;
  border-radius: 9999px; /* rounded-full */
  padding: 1rem; /* p-4 = 16px */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); /* shadow-2xl */
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms; /* duration-300 */
  z-index: 50;
}

.chat-toggle-btn:hover {
  background-color: rgba(217, 119, 6, 0.9); /* hover:bg-mr-orange/90 */
  transform: scale(1.1); /* hover:scale-110 */
}

.chat-toggle-btn svg {
  width: 28px;
  height: 28px;
}

.chat-toggle-btn:hover svg {
  animation: pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.chat-badge {
  position: absolute;
  top: -0.25rem; /* -top-1 = -4px */
  right: -0.25rem; /* -right-1 = -4px */
  background-color: #EF4444; /* bg-red-500 */
  color: white; /* text-white */
  font-size: 0.75rem; /* text-xs */
  font-weight: 700; /* font-bold */
  border-radius: 9999px; /* rounded-full */
  width: 1.5rem; /* w-6 = 24px */
  height: 1.5rem; /* h-6 = 24px */
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgePulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite; /* animate-pulse */
}

@keyframes badgePulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Chat Window */
.chat-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 100px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #0C4A6E 0%, #D97706 100%);
  color: white;
  padding: 16px;
  border-radius: 16px 16px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-icon {
  background: rgba(255, 255, 255, 0.2);
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-title {
  font-weight: bold;
  font-size: 18px;
  letter-spacing: 0.5px;
  margin: 0;
}

.chat-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

.chat-close-btn {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #F9FAFB;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  display: flex;
}

.chat-message.user-message {
  justify-content: flex-end;
}

.chat-message.bot-message {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 75%;
  padding: 12px;
  border-radius: 16px;
  position: relative;
}

.user-message .message-bubble {
  background: #D97706;
  color: white;
  border-bottom-right-radius: 4px;
}

.bot-message .message-bubble {
  background: white;
  color: #1F2937;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-time {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  opacity: 0.7;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #9CA3AF;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Chat Form */
.chat-form {
  padding: 16px;
  background: white;
  border-top: 1px solid #E5E7EB;
  border-radius: 0 0 16px 16px;
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  color: #1F2937;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.chat-input:focus {
  border-color: #D97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

.chat-input::placeholder {
  color: #9CA3AF;
}

.chat-send-btn {
  background: #D97706;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-send-btn:hover:not(:disabled) {
  background: #B45309;
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Chatbot message links */
.chatbot-message a {
  color: #D97706;
  text-decoration: underline;
  font-weight: 500;
}

.chatbot-message a:hover {
  color: #B45309;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .chat-window {
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
    height: calc(100vh - 120px);
  }

  .chat-toggle-btn {
    bottom: 16px;
    right: 16px;
  }
}
