/* Nestro Chat Widget - Floating Popup Style */

/* ===== Floating Toggle Button ===== */
#nestro-chat-floating-button {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  width: 60px;
  height: 60px;
  background: #16a34a;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2147483646 !important;
  transition: transform 0.2s, background 0.2s;
  border: none;
  padding: 0;
}

#nestro-chat-floating-button:hover {
  transform: scale(1.08);
}

#nestro-chat-floating-button img {
  width: 35px;
  height: auto;
  background: none;
  padding: 0;
  border-radius: 0;
}

#nestro-chat-floating-button .nestro-close-icon {
  display: none;
  width: 24px;
  height: 24px;
  color: white;
}

#nestro-chat-floating-button.nestro-chat-open {
  background: #ef4444;
}

#nestro-chat-floating-button.nestro-chat-open img {
  display: none;
}

#nestro-chat-floating-button.nestro-chat-open .nestro-close-icon {
  display: block;
}

/* ===== Chat Popup Container ===== */
#nestro-chat-popup {
  position: fixed !important;
  bottom: 90px !important;
  right: 20px !important;
  width: 380px;
  height: 560px;
  z-index: 2147483647 !important;
  display: none;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid #e5e7eb;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

#nestro-chat-popup.nestro-chat-visible {
  display: flex;
  animation: nestro-slide-up 0.3s ease-out;
}

@keyframes nestro-slide-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Header ===== */
.nestro-chat-header {
  background: #16a34a;
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.nestro-chat-logo img {
  width: 80px;
  height: auto;
  background: white;
  padding: 4px;
  border-radius: 6px;
}

.nestro-chat-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.nestro-chat-title p {
  margin: 2px 0 0 0;
  font-size: 12px;
  opacity: 0.85;
}

.nestro-chat-header-close {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.nestro-chat-header-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.15);
}

.nestro-chat-header-close svg {
  width: 20px;
  height: 20px;
}

/* ===== Messages ===== */
.nestro-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f9fafb;
  scroll-behavior: smooth;
}

.nestro-chat-message {
  margin-bottom: 12px;
  display: flex;
}

.nestro-chat-message-user {
  justify-content: flex-end;
}

.nestro-chat-message-bot {
  justify-content: flex-start;
}

.nestro-chat-message-content {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  position: relative;
}

.nestro-chat-message-user .nestro-chat-message-content {
  background: #16a34a;
  color: white;
  border-bottom-right-radius: 4px;
}

.nestro-chat-message-bot .nestro-chat-message-content {
  background: white;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

#nestro-chat-popup .nestro-chat-message-content p,
.nestro-chat-embedded .nestro-chat-message-content p {
  margin: 0 !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
  word-wrap: break-word !important;
  white-space: pre-wrap !important;
  padding: 0 !important;
  border: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.nestro-chat-message-time {
  font-size: 10px;
  opacity: 0.6;
  display: block;
  margin-top: 4px;
}

/* Typing Indicator */
.nestro-chat-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

.nestro-chat-typing-dots span {
  width: 6px;
  height: 6px;
  background: #9ca3af;
  border-radius: 50%;
  animation: nestro-typing 1.4s infinite ease-in-out;
}

.nestro-chat-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.nestro-chat-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

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

/* ===== Quick Replies Wrapper ===== */
#nestro-chat-popup .nestro-chat-quick-replies-wrapper,
.nestro-chat-embedded .nestro-chat-quick-replies-wrapper,
.nestro-chat-quick-replies-wrapper {
  flex-shrink: 0 !important;
  overflow: hidden !important;
  border-top: 1px solid #f3f4f6 !important;
  background: #fff !important;
  position: relative !important;
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
  align-items: center !important;
}

/* ===== Arrow Navigation Buttons ===== */
.nestro-qr-arrow {
  display: none;
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 26px !important;
  height: 26px !important;
  border-radius: 50% !important;
  background: white !important;
  border: 1px solid #d1d5db !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12) !important;
  color: #16a34a !important;
  font-size: 20px !important;
  font-weight: bold !important;
  line-height: 1 !important;
  cursor: pointer !important;
  z-index: 5 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  min-height: auto !important;
  min-width: auto !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  text-decoration: none !important;
  flex-shrink: 0 !important;
  transition: background 0.15s, box-shadow 0.15s !important;
}

.nestro-qr-arrow:hover {
  background: #f0fdf4 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18) !important;
}

.nestro-qr-arrow-left {
  left: 2px !important;
}

.nestro-qr-arrow-right {
  right: 2px !important;
}

/* ===== Quick Replies Scrollable 2-Row Grid ===== */
#nestro-chat-popup .nestro-chat-quick-replies,
.nestro-chat-embedded .nestro-chat-quick-replies,
.nestro-chat-quick-replies {
  padding: 8px 30px !important;
  display: grid !important;
  grid-auto-flow: column !important;
  grid-template-rows: repeat(2, auto) !important;
  gap: 6px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  background: #fff !important;
  flex-shrink: 0 !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  -webkit-overflow-scrolling: touch !important;
  box-sizing: border-box !important;
  align-items: start !important;
  border: none !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  scroll-behavior: smooth !important;
}

#nestro-chat-popup .nestro-chat-quick-replies::-webkit-scrollbar,
.nestro-chat-embedded .nestro-chat-quick-replies::-webkit-scrollbar,
.nestro-chat-quick-replies::-webkit-scrollbar {
  display: none !important;
  height: 0 !important;
  width: 0 !important;
}

#nestro-chat-popup .nestro-chat-quick-replies button,
.nestro-chat-embedded .nestro-chat-quick-replies button {
  background: white !important;
  border: 1px solid #bbf7d0 !important;
  color: #15803d !important;
  padding: 6px 14px !important;
  border-radius: 20px !important;
  font-size: 12px !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  flex: 0 0 auto !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  margin: 0 !important;
  box-shadow: none !important;
  text-decoration: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  min-height: auto !important;
  height: auto !important;
  min-width: max-content !important;
  display: inline-block !important;
  float: none !important;
  width: auto !important;
  max-width: none !important;
}

#nestro-chat-popup .nestro-chat-quick-replies button:hover,
.nestro-chat-embedded .nestro-chat-quick-replies button:hover {
  background: #f0fdf4 !important;
  border-color: #86efac !important;
  color: #166534 !important;
}

/* ===== Input Area ===== */
.nestro-chat-input-area {
  padding: 12px !important;
  border-top: 1px solid #e5e7eb !important;
  display: flex !important;
  gap: 8px !important;
  background: white !important;
  flex-shrink: 0 !important;
  align-items: center !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

#nestro-chat-popup .nestro-chat-input-area input[type="text"],
.nestro-chat-embedded .nestro-chat-input-area input[type="text"],
.nestro-chat-input-area input#nestro-chat-input {
  flex: 1 !important;
  padding: 10px 16px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 24px !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  outline: none !important;
  background: #fff !important;
  color: #374151 !important;
  margin: 0 !important;
  height: auto !important;
  min-height: 40px !important;
  max-width: none !important;
  width: auto !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  font-family: inherit !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s !important;
}

#nestro-chat-popup .nestro-chat-input-area input[type="text"]:focus,
.nestro-chat-embedded .nestro-chat-input-area input[type="text"]:focus,
.nestro-chat-input-area input#nestro-chat-input:focus {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15) !important;
  outline: none !important;
}

#nestro-chat-popup .nestro-chat-input-area input[type="text"]::placeholder,
.nestro-chat-input-area input#nestro-chat-input::placeholder {
  color: #9ca3af !important;
  opacity: 1 !important;
}

#nestro-chat-popup .nestro-chat-input-area button,
.nestro-chat-embedded .nestro-chat-input-area button,
.nestro-chat-input-area button#nestro-chat-send {
  background: #16a34a !important;
  color: white !important;
  border: none !important;
  padding: 10px 20px !important;
  border-radius: 24px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  cursor: pointer !important;
  transition: background 0.2s !important;
  white-space: nowrap !important;
  min-height: 40px !important;
  height: auto !important;
  margin: 0 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  font-family: inherit !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  text-decoration: none !important;
}

#nestro-chat-popup .nestro-chat-input-area button:hover,
.nestro-chat-embedded .nestro-chat-input-area button:hover,
.nestro-chat-input-area button#nestro-chat-send:hover {
  background: #15803d !important;
  color: white !important;
}

/* Icon-only send button */
#nestro-chat-popup .nestro-chat-input-area button.nestro-chat-send-icon-btn,
.nestro-chat-embedded .nestro-chat-input-area button.nestro-chat-send-icon-btn,
.nestro-chat-input-area button.nestro-chat-send-icon-btn {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  border-radius: 50% !important;
}

button.nestro-chat-send-icon-btn img {
  width: 20px !important;
  height: 20px !important;
  display: block !important;
  pointer-events: none !important;
}

/* ===== Link Buttons ===== */
.nestro-chat-link-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  background: #16a34a;
  color: #fff !important;
  border-radius: 14px;
  font-size: 12px;
  text-decoration: none;
  transition: background 0.2s;
  margin-right: 4px;
}

.nestro-chat-link-btn:hover {
  background: #15803d;
  color: #fff !important;
}

/* Fallback */
.nestro-chat-message-fallback .nestro-chat-message-content {
  border-color: #fbbf24;
  background: #fffbeb;
}

/* ===== Footer Text ===== */
.nestro-chat-footer-text {
  text-align: center;
  font-size: 10px;
  color: #9ca3af;
  padding: 4px 0 8px;
  background: white;
  flex-shrink: 0;
}

/* ===== RESPONSIVE - Mobile ===== */
@media (max-width: 480px) {
  #nestro-chat-popup {
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - 70px) !important;
    border-radius: 16px 16px 0 0;
    max-height: calc(100dvh - 70px) !important;
  }

  #nestro-chat-floating-button {
    bottom: 12px !important;
    right: 12px !important;
    width: 54px;
    height: 54px;
  }

  #nestro-chat-floating-button.nestro-chat-open {
    bottom: 12px !important;
    right: 12px !important;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  #nestro-chat-popup {
    bottom: 80px !important;
    right: 16px !important;
    width: 350px;
    height: 500px;
  }
}

/* ===== Shortcode embed (non-floating) ===== */
.nestro-chat-embedded .nestro-chat-widget-inner {
  width: 100%;
  max-width: 400px;
  height: 500px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
