/* Front 2 Back IT Chatbot Widget - Site Matching Theme */
:root {
  --f2b-primary: #2c5282;
  --f2b-secondary: #1a365d;
  --f2b-accent: #3182ce;
  --f2b-success: #38a169;
  --f2b-warning: #d69e2e;
  --f2b-danger: #e53e3e;
  --f2b-light: #f7fafc;
  --f2b-dark: #1a202c;
  --f2b-text: #2d3748;
  --f2b-muted: #718096;
  --f2b-border: #e2e8f0;
}

.f2b-chatbot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Chat Bubble Button */
.f2b-chatbot-toggle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--f2b-primary) 0%, var(--f2b-secondary) 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(44, 82, 130, 0.4), 0 0 0 4px rgba(44, 82, 130, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.f2b-chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 25px rgba(44, 82, 130, 0.5), 0 0 0 6px rgba(44, 82, 130, 0.15);
}

.f2b-chatbot-toggle:active {
  transform: scale(0.95);
}

/* Attention pulse animation */
.f2b-chatbot-toggle.attention {
  animation: attention-pulse 2s ease-in-out infinite;
}

@keyframes attention-pulse {
  0%, 100% { 
    box-shadow: 0 4px 15px rgba(44, 82, 130, 0.4), 0 0 0 4px rgba(44, 82, 130, 0.1);
  }
  50% { 
    box-shadow: 0 6px 25px rgba(44, 82, 130, 0.6), 0 0 0 8px rgba(44, 82, 130, 0.2);
  }
}

/* Notification badge */
.f2b-chatbot-toggle .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: var(--f2b-danger);
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  animation: badge-bounce 0.5s ease;
}

@keyframes badge-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.f2b-chatbot-toggle svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.f2b-chatbot-toggle .close-icon {
  display: none;
}

.f2b-chatbot-widget.open .f2b-chatbot-toggle .chat-icon {
  display: none;
}

.f2b-chatbot-widget.open .f2b-chatbot-toggle .close-icon {
  display: block;
}

/* Proactive Message (Greeter) */
.f2b-chatbot-greeter {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 280px;
  background: white;
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.f2b-chatbot-greeter.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.f2b-chatbot-greeter::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 24px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid white;
}

.f2b-chatbot-greeter .close-greeter {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  font-size: 18px;
  line-height: 1;
  color: var(--f2b-muted);
}

.f2b-chatbot-greeter .close-greeter:hover {
  opacity: 1;
}

.f2b-chatbot-greeter .greeter-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--f2b-text);
  padding-right: 20px;
}

.f2b-chatbot-greeter .greeter-text strong {
  color: var(--f2b-primary);
  display: block;
  margin-bottom: 4px;
}

/* Chat Window */
.f2b-chatbot-window {
  position: absolute;
  bottom: 88px;
  right: 0;
  width: 400px;
  height: 550px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--f2b-border);
}

.f2b-chatbot-widget.open .f2b-chatbot-window {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Hide greeter when chat is open */
.f2b-chatbot-widget.open .f2b-chatbot-greeter {
  opacity: 0;
  visibility: hidden;
}

/* Header */
.f2b-chatbot-header {
  background: linear-gradient(135deg, var(--f2b-primary) 0%, var(--f2b-secondary) 100%);
  color: white;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.f2b-chatbot-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.f2b-chatbot-title {
  flex: 1;
}

.f2b-chatbot-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.f2b-chatbot-title p {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.85;
}

.f2b-chatbot-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 12px;
}

.f2b-chatbot-status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #48bb78;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

/* Messages */
.f2b-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--f2b-light);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.f2b-message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 4px;
  max-width: 85%;
}

.f2b-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.f2b-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--f2b-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.f2b-message.user .f2b-message-avatar {
  background: var(--f2b-accent);
}

.f2b-message-bubble {
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.f2b-message.bot .f2b-message-bubble {
  background: white;
  color: var(--f2b-text);
  border-bottom-left-radius: 6px;
}

.f2b-message.user .f2b-message-bubble {
  background: var(--f2b-accent);
  color: white;
  border-bottom-right-radius: 6px;
}

/* Quick Replies */
.f2b-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-left: 42px;
}

.f2b-quick-reply {
  background: white;
  border: 1px solid var(--f2b-accent);
  color: var(--f2b-accent);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.f2b-quick-reply:hover {
  background: var(--f2b-accent);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(49, 130, 206, 0.3);
}

/* Input Area */
.f2b-chatbot-input {
  padding: 20px 24px;
  background: white;
  border-top: 1px solid var(--f2b-border);
  display: flex;
  gap: 12px;
  align-items: center;
}

.f2b-chatbot-input input {
  flex: 1;
  border: 1px solid var(--f2b-border);
  border-radius: 24px;
  padding: 12px 20px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
}

.f2b-chatbot-input input:focus {
  border-color: var(--f2b-accent);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.f2b-chatbot-input input:disabled {
  background: var(--f2b-light);
  cursor: not-allowed;
}

.f2b-chatbot-input button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--f2b-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.f2b-chatbot-input button:hover:not(:disabled) {
  background: var(--f2b-primary);
  transform: scale(1.05);
}

.f2b-chatbot-input button:disabled {
  background: var(--f2b-muted);
  cursor: not-allowed;
}

.f2b-chatbot-input button svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* Typing Indicator */
.f2b-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
}

.f2b-typing-indicator span {
  width: 8px;
  height: 8px;
  background: #cbd5e0;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.f2b-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.f2b-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Contact Form */
.f2b-contact-form {
  background: white;
  padding: 20px;
  border-radius: 16px;
  margin-top: 8px;
  border: 1px solid var(--f2b-border);
}

.f2b-contact-form input,
.f2b-contact-form textarea {
  width: 100%;
  border: 1px solid var(--f2b-border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.f2b-contact-form input:focus,
.f2b-contact-form textarea:focus {
  border-color: var(--f2b-accent);
  outline: none;
}

.f2b-contact-form textarea {
  min-height: 100px;
  resize: vertical;
}

.f2b-contact-form button {
  width: 100%;
  background: var(--f2b-success);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.f2b-contact-form button:hover:not(:disabled) {
  background: #2f855a;
  transform: translateY(-1px);
}

.f2b-contact-form button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Success Message */
.f2b-success-message {
  text-align: center;
  padding: 32px 20px;
}

.f2b-success-message svg {
  width: 56px;
  height: 56px;
  fill: var(--f2b-success);
  margin-bottom: 16px;
}

.f2b-success-message h4 {
  margin: 0 0 8px;
  color: var(--f2b-dark);
  font-size: 18px;
}

.f2b-success-message p {
  margin: 0;
  color: var(--f2b-muted);
  font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .f2b-chatbot-widget {
    bottom: 16px;
    right: 16px;
  }
  
  .f2b-chatbot-window {
    width: calc(100vw - 32px);
    height: 70vh;
    bottom: 80px;
  }
  
  .f2b-chatbot-greeter {
    width: calc(100vw - 80px);
    right: 0;
  }
  
  .f2b-chatbot-toggle {
    width: 56px;
    height: 56px;
  }
  
  .f2b-message {
    max-width: 90%;
  }
}

/* Scrollbar styling */
.f2b-chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.f2b-chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.f2b-chatbot-messages::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}

.f2b-chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Welcome message styling */
.f2b-welcome-banner {
  background: linear-gradient(135deg, var(--f2b-primary) 0%, var(--f2b-secondary) 100%);
  color: white;
  padding: 16px 20px;
  margin: -24px -24px 16px;
  text-align: center;
}

.f2b-welcome-banner h4 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.f2b-welcome-banner p {
  margin: 0;
  font-size: 13px;
  opacity: 0.9;
}
