/* Chatbot - Isha Agro - tawk.to style launcher */

.chatbot-wrapper {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Jost', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Launcher - chat button only */
.chatbot-launcher {
  position: relative;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
}

.chatbot-launcher.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat button - black/dark style */
.chatbot-toggle {
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2A3042 0%, #1a1f2e 100%);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  flex-shrink: 0;
}

.chatbot-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

/* Red notification badge */
.chatbot-toggle-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 22px;
  height: 22px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 6px rgba(231, 76, 60, 0.5);
}

.chatbot-box {
  position: absolute;
  bottom: 76px;
  right: 0;
  z-index: 1;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.chatbot-box.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chatbot-header {
  background: linear-gradient(135deg, #2A3042 0%, #1a1f2e 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatbot-header h4 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.chatbot-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.chatbot-close:hover {
  opacity: 1;
}

.chatbot-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Pre-chat form */
.chatbot-form-container {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}

.chatbot-form-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: #2A3042;
  margin: 0 0 8px 0;
}

.chatbot-form-desc {
  font-size: 1.05rem;
  color: #6c757d;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

.chatbot-lead-form .form-group {
  margin-bottom: 14px;
}

.chatbot-lead-form label {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 6px;
}

.chatbot-lead-form .required {
  color: #dc3545;
}

.chatbot-lead-form input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  font-size: 1.05rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chatbot-lead-form input:focus {
  outline: none;
  border-color: #2A3042;
  box-shadow: 0 0 0 3px rgba(42, 48, 66, 0.1);
}

.chatbot-lead-form input::placeholder {
  color: #adb5bd;
}

.chatbot-btn {
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.chatbot-btn:active {
  transform: scale(0.98);
}

.chatbot-btn-primary {
  background: linear-gradient(135deg, #2A3042 0%, #1a1f2e 100%);
  color: #fff;
  margin-top: 16px;
  width: 100%;
  flex-shrink: 0;
}

.chatbot-btn-primary:hover {
  background: linear-gradient(135deg, #3a4155 0%, #2a3042 100%);
}

/* Chat UI */
.chatbot-chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chatbot-actions {
  padding: 8px 16px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.chatbot-btn-sm {
  font-size: 0.9rem;
  padding: 8px 14px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  color: #495057;
  cursor: pointer;
  transition: background 0.2s;
}

.chatbot-btn-sm:hover {
  background: #e9ecef;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chatbot-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 1.05rem;
  line-height: 1.5;
  animation: chatbotFadeIn 0.3s ease;
}

@keyframes chatbotFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chatbot-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2A3042 0%, #1a1f2e 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chatbot-message.bot {
  align-self: flex-start;
  background: #f1f3f5;
  color: #333;
  border-bottom-left-radius: 4px;
}

.chatbot-message-time {
  font-size: 0.8rem;
  opacity: 0.75;
  margin-top: 6px;
}

.chatbot-typing {
  padding: 8px 16px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.chatbot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #adb5bd;
  animation: chatbotTyping 1.4s infinite ease-in-out both;
}

.chatbot-typing span:nth-child(1) { animation-delay: -0.32s; }
.chatbot-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes chatbotTyping {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.chatbot-send-form {
  display: flex;
  padding: 12px 16px;
  gap: 10px;
  border-top: 1px solid #eee;
  background: #fff;
  flex-shrink: 0;
}

.chatbot-send-form input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #dee2e6;
  border-radius: 24px;
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.2s;
}

.chatbot-send-form input:focus {
  border-color: #2A3042;
}

.chatbot-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #2A3042 0%, #1a1f2e 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.chatbot-send-btn:hover {
  transform: scale(1.05);
}

.chatbot-send-btn:active {
  transform: scale(0.96);
}

/* Suggested questions */
.chatbot-questions-wrap {
  padding: 12px 16px 8px;
  border-top: 1px solid #eee;
  background: #fafbfc;
  flex-shrink: 0;
  display: none;
}

.chatbot-questions-wrap.has-content {
  display: block;
}

.chatbot-questions-label {
  font-size: 0.95rem;
  color: #6c757d;
  margin: 0 0 10px 0;
  font-weight: 500;
}

.chatbot-questions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 140px;
  overflow-y: auto;
}

.chatbot-question-btn {
  display: block;
  width: 100%;
  padding: 14px 18px;
  text-align: left;
  font-size: 1rem;
  line-height: 1.45;
  color: #2A3042;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.chatbot-question-btn:hover {
  background: #f1f3f5;
  border-color: #2A3042;
  box-shadow: 0 2px 8px rgba(42, 48, 66, 0.1);
}

.chatbot-question-btn:active {
  transform: scale(0.98);
}

.chatbot-questions-hint {
  font-size: 1rem;
  color: #6c757d;
  margin: 0;
  line-height: 1.5;
}

/* Responsive - Mobile first */
@media (max-width: 767px) {
  .chatbot-wrapper {
    bottom: 16px;
    right: 16px;
  }

  .chatbot-toggle {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
  }

  .chatbot-box {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    bottom: auto;
  }

  .chatbot-header {
    padding: 14px 16px;
  }

  .chatbot-header h4 {
    font-size: 1.15rem;
  }

  .chatbot-body {
    min-height: 0;
  }

  .chatbot-form-container {
    padding: 20px 16px;
  }

  .chatbot-form-title {
    font-size: 1.2rem;
  }

  .chatbot-form-desc {
    font-size: 1rem;
  }

  .chatbot-lead-form label {
    font-size: 0.95rem;
  }

  .chatbot-lead-form input {
    font-size: 16px;
  }

  .chatbot-btn-primary {
    font-size: 1.05rem;
  }

  .chatbot-lead-form input {
    padding: 14px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .chatbot-btn-primary {
    padding: 14px;
  }

  .chatbot-chat-container {
    display: flex;
    flex-direction: column;
  }

  .chatbot-actions {
    padding: 10px 16px;
  }

  .chatbot-btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
    min-height: 36px;
  }

  .chatbot-messages {
    padding: 12px 16px;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
  }

  .chatbot-message {
    max-width: 90%;
    padding: 12px 14px;
    font-size: 0.9rem;
  }

  .chatbot-questions-wrap {
    padding: 12px 16px;
  }

  .chatbot-questions-list {
    max-height: 120px;
  }

  .chatbot-question-btn {
    padding: 14px 16px;
    font-size: 0.9rem;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
  }

  .chatbot-send-form {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .chatbot-send-form input {
    padding: 12px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .chatbot-send-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }
}

@media (max-width: 480px) {
  .chatbot-wrapper {
    bottom: 12px;
    right: 12px;
  }

  .chatbot-toggle {
    width: 52px;
    height: 52px;
  }
}
