/* ==========================================================================
   Seller Fly - Interactive AI Chatbot Widget Styles
   ========================================================================== */

:root {
  --sf-bot-primary: #FF5E00;
  --sf-bot-primary-gradient: linear-gradient(135deg, #FF6800 0%, #FF3D00 100%);
  --sf-bot-secondary: #092241;
  --sf-bot-bg-light: #FAF9F8;
  --sf-bot-card-bg: #FFFFFF;
  --sf-bot-text-dark: #1F2937;
  --sf-bot-text-muted: #6B7280;
  --sf-bot-border: #E5E7EB;
  --sf-bot-bubble-bot-1: #FFF5EF;
  --sf-bot-bubble-bot-1-border: #FFE6D5;
  --sf-bot-bubble-bot-2: #F0F5FF;
  --sf-bot-bubble-bot-2-border: #D8E5FF;
  --sf-bot-bubble-user: linear-gradient(135deg, #FF6600 0%, #FF3B00 100%);
  --sf-bot-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  --sf-bot-radius: 20px;
}

/* Floating Launcher Button (Positioned above WhatsApp button at bottom: 84px) */
.sf-chat-launcher {
  position: fixed;
  bottom: 84px;
  right: 24px;
  z-index: 99999;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--sf-bot-primary-gradient);
  box-shadow: 0 8px 24px rgba(255, 94, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 3px solid #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  padding: 0;
  outline: none;
}

.sf-chat-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 28px rgba(255, 94, 0, 0.5), 0 6px 16px rgba(0, 0, 0, 0.15);
}

.sf-chat-launcher:active {
  transform: scale(0.95);
}

.sf-chat-launcher-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.sf-chat-launcher-icon {
  width: 32px;
  height: 32px;
  color: #ffffff;
  transition: transform 0.3s ease;
}

.sf-chat-launcher.is-active .sf-chat-launcher-avatar {
  display: none;
}

.sf-chat-launcher.is-active .sf-chat-launcher-close-icon {
  display: block;
}

.sf-chat-launcher-close-icon {
  display: none;
  width: 26px;
  height: 26px;
  color: #ffffff;
}

/* Pulsating Notification Badge */
.sf-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background-color: #10B981;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  animation: sf-pulse 2s infinite;
}

@keyframes sf-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Tooltip Hint */
.sf-chat-tooltip {
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  background: #092241;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 12px;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sf-chat-launcher:hover .sf-chat-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(-4px);
}

.sf-chat-tooltip::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 0 6px 6px;
  border-style: solid;
  border-color: transparent transparent transparent #092241;
}

/* Chatbot Window Container (Positioned above launcher) */
.sf-chat-window {
  position: fixed;
  bottom: 154px;
  right: 24px;
  z-index: 99999;
  width: 410px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100vh - 180px);
  background: var(--sf-bot-card-bg);
  border-radius: var(--sf-bot-radius);
  box-shadow: var(--sf-bot-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sf-chat-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Chat Header */
.sf-chat-header {
  background: var(--sf-bot-primary-gradient);
  padding: 16px 18px 30px 18px;
  position: relative;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

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

.sf-chat-header-avatar-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffffff;
  padding: 2px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.sf-chat-header-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.sf-chat-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background-color: #10B981;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.sf-chat-header-text h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.sf-chat-header-text p {
  margin: 2px 0 0 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 400;
}

/* Header Control Buttons */
.sf-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sf-chat-action-btn {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  font-size: 1rem;
}

.sf-chat-action-btn:hover {
  background: rgba(255, 255, 255, 0.32);
}

.sf-chat-action-btn:active {
  transform: scale(0.9);
}

/* Header Bottom Wave Mask Cutout */
.sf-chat-header-wave {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 20px;
  color: var(--sf-bot-bg-light);
  pointer-events: none;
}

/* Header Dropdown Menu */
.sf-chat-menu-dropdown {
  position: absolute;
  top: 60px;
  right: 18px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  border: 1px solid #E5E7EB;
  padding: 6px 0;
  z-index: 100;
  min-width: 160px;
  display: none;
}

.sf-chat-menu-dropdown.is-visible {
  display: block;
}

.sf-chat-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.85rem;
  color: #374151;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sf-chat-menu-item:hover {
  background: #F3F4F6;
  color: var(--sf-bot-primary);
}

/* Chat Body (Scrollable container) */
.sf-chat-body {
  flex: 1;
  padding: 16px 14px;
  background: var(--sf-bot-bg-light);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.sf-chat-body::-webkit-scrollbar {
  width: 5px;
}

.sf-chat-body::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 10px;
}

/* Message Group (Bot or User) */
.sf-msg-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 90%;
  animation: sf-fade-in 0.25s ease-out forwards;
}

@keyframes sf-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sf-msg-group.sf-msg-bot {
  align-self: flex-start;
}

.sf-msg-group.sf-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
  max-width: 82%;
}

.sf-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  margin-top: 2px;
}

/* Message Content Box */
.sf-msg-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Bot Message Bubbles */
.sf-msg-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.48;
  word-break: break-word;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.sf-msg-bot .sf-msg-bubble {
  background: #ffffff;
  color: var(--sf-bot-text-dark);
  border-top-left-radius: 4px;
  border: 1px solid #EAEAEA;
}

.sf-msg-bot .sf-msg-bubble.sf-bubble-warm {
  background: var(--sf-bot-bubble-bot-1);
  border: 1px solid var(--sf-bot-bubble-bot-1-border);
}

.sf-msg-bot .sf-msg-bubble.sf-bubble-blue {
  background: var(--sf-bot-bubble-bot-2);
  border: 1px solid var(--sf-bot-bubble-bot-2-border);
}

/* User Message Bubble */
.sf-msg-user .sf-msg-bubble {
  background: var(--sf-bot-bubble-user);
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(255, 94, 0, 0.25);
  border: none;
}

.sf-msg-time {
  font-size: 0.7rem;
  color: var(--sf-bot-text-muted);
  align-self: flex-end;
  margin-top: 2px;
  padding: 0 2px;
}

.sf-msg-user .sf-msg-time {
  color: rgba(255,255,255,0.85);
}

/* Typing Indicator */
.sf-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #EAEAEA;
  border-radius: 18px;
  border-top-left-radius: 4px;
  width: fit-content;
}

.sf-typing-dot {
  width: 7px;
  height: 7px;
  background-color: var(--sf-bot-primary);
  border-radius: 50%;
  animation: sf-typing-bounce 1.4s infinite ease-in-out both;
}

.sf-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.sf-typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Quick Option Buttons Container (Grid Layout) */
.sf-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
  width: 100%;
}

.sf-option-btn {
  background: #FFFFFF;
  border: 1.5px solid #EBECEF;
  border-radius: 14px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
  text-align: left;
  outline: none;
  user-select: none;
}

.sf-option-btn:hover {
  border-color: var(--sf-bot-primary);
  background: #FFF9F5;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 94, 0, 0.12);
}

.sf-option-btn:active {
  transform: translateY(0);
}

.sf-option-btn.sf-option-full {
  grid-column: 1 / -1;
  justify-content: center;
  background: #F8FAFC;
  border-color: #E2E8F0;
}

.sf-option-btn.sf-option-full:hover {
  background: #FFF9F5;
  border-color: var(--sf-bot-primary);
}

.sf-option-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sf-option-icon img,
.sf-option-icon svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sf-option-text {
  font-size: 0.86rem;
  font-weight: 600;
  color: #1F2937;
  line-height: 1.25;
}

/* Action Buttons inside Bot Message */
.sf-msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sf-action-chip {
  background: #ffffff;
  border: 1.5px solid var(--sf-bot-primary);
  color: var(--sf-bot-primary);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.sf-action-chip:hover {
  background: var(--sf-bot-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(255, 94, 0, 0.2);
}

.sf-action-chip.sf-action-secondary {
  border-color: #D1D5DB;
  color: #4B5563;
}

.sf-action-chip.sf-action-secondary:hover {
  background: #4B5563;
  color: #ffffff;
  border-color: #4B5563;
}

/* Embedded Form Container */
.sf-chat-form {
  background: #ffffff;
  border: 1.5px solid #E5E7EB;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.sf-chat-form input,
.sf-chat-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.sf-chat-form input:focus,
.sf-chat-form select:focus {
  border-color: var(--sf-bot-primary);
  box-shadow: 0 0 0 3px rgba(255, 94, 0, 0.15);
}

.sf-chat-form button {
  background: var(--sf-bot-primary-gradient);
  color: #ffffff;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.sf-chat-form button:hover {
  opacity: 0.92;
}

/* Chat Input Bar (Footer Area) */
.sf-chat-footer {
  padding: 12px 14px 10px 14px;
  background: #ffffff;
  border-top: 1px solid #F0F0F0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

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

.sf-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: #F9FAFB;
  border: 1.5px solid #E5E7EB;
  border-radius: 28px;
  padding: 4px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sf-input-wrapper:focus-within {
  border-color: var(--sf-bot-primary);
  box-shadow: 0 0 0 3px rgba(255, 94, 0, 0.12);
  background: #ffffff;
}

.sf-icon-btn {
  background: none;
  border: none;
  color: #6B7280;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.sf-icon-btn:hover {
  color: var(--sf-bot-primary);
  background: #F3F4F6;
}

.sf-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 6px;
  font-size: 0.9rem;
  color: #1F2937;
  outline: none;
}

.sf-chat-input::placeholder {
  color: #9CA3AF;
}

/* Send Button */
.sf-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--sf-bot-primary-gradient);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 94, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.sf-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(255, 94, 0, 0.4);
}

.sf-send-btn:active {
  transform: scale(0.95);
}

.sf-send-btn svg {
  width: 20px;
  height: 20px;
  transform: translateX(1px);
}

/* Emoji Picker Popup */
.sf-emoji-picker {
  position: absolute;
  bottom: 60px;
  right: 60px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border: 1px solid #E5E7EB;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  z-index: 100;

  display: none;
}

.sf-emoji-picker.is-visible {
  display: grid;
}

.sf-emoji-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.sf-emoji-btn:hover {
  background: #F3F4F6;
}

/* File Attachment Preview Bar */
.sf-attachment-preview {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #1E40AF;
}

.sf-attachment-preview.is-visible {
  display: flex;
}

/* Footer Powered-by Tag */
.sf-chat-powered {
  text-align: center;
  font-size: 0.74rem;
  color: var(--sf-bot-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 2px;
}

.sf-chat-powered strong {
  color: var(--sf-bot-primary);
  font-weight: 700;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .sf-chat-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  .sf-chat-header {
    border-radius: 0;
  }
  .sf-chat-launcher {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
}
