/* ============================================================
   SENDEROS GROUP — FAQ AGENT STYLES
   Premium chatbot widget with glassmorphism & brand colors
   ============================================================ */

/* ─── Toggle Button ─────────────────────────────────────── */
#sg-faq-toggle {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #2D3C2D 0%, #1B6B4A 100%);
  color: #fff;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 24px rgba(45, 60, 45, 0.35), 0 2px 8px rgba(0,0,0,0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#sg-faq-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(45, 60, 45, 0.45), 0 4px 12px rgba(0,0,0,0.2);
}
#sg-faq-toggle.sg-active {
  transform: scale(0.9);
  opacity: 0.7;
}

/* ─── Panel ─────────────────────────────────────────────── */
#sg-faq-panel {
  position: fixed;
  bottom: 90px;
  left: 28px;
  z-index: 9999;
  width: 380px;
  max-height: 520px;
  display: flex;
  flex-direction: column;
  background: rgba(250, 250, 245, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(45, 60, 45, 0.1);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: bottom left;
}
#sg-faq-panel.sg-hidden {
  opacity: 0;
  transform: scale(0.9) translateY(16px);
  pointer-events: none;
}

/* ─── Header ────────────────────────────────────────────── */
#sg-faq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #2D3C2D 0%, #1A2E1A 100%);
  color: #fff;
}
#sg-faq-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#sg-faq-header-info strong {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
#sg-faq-header-info span {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.68rem;
  opacity: 0.6;
  letter-spacing: 0.02em;
}
#sg-faq-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s;
  line-height: 1;
}
#sg-faq-close:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ─── Messages Body ─────────────────────────────────────── */
#sg-faq-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  min-height: 160px;
  max-height: calc(100% - 160px);
  scroll-behavior: smooth;
}
#sg-faq-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── Message Bubbles ───────────────────────────────────── */
.sg-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  line-height: 1.55;
  animation: sgFadeIn 0.3s ease-out;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.sg-msg--bot {
  align-self: flex-start;
  background: rgba(45, 60, 45, 0.06);
  color: #2D3C2D;
  border-bottom-left-radius: 4px;
}
.sg-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, #1B6B4A, #2D3C2D);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ─── WhatsApp Link ─────────────────────────────────────── */
.sg-wa-link {
  display: inline-block;
  padding: 8px 16px;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff !important;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.8rem;
  transition: all 0.2s;
}
.sg-wa-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

/* ─── Suggestion Chips ──────────────────────────────────── */
#sg-faq-suggestions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 8px 16px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}
#sg-faq-suggestions::-webkit-scrollbar { display: none; }
.sg-chip {
  padding: 6px 12px;
  background: rgba(27, 107, 74, 0.08);
  border: 1px solid rgba(27, 107, 74, 0.15);
  border-radius: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  color: #1B6B4A;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.sg-chip:hover {
  background: rgba(27, 107, 74, 0.15);
  border-color: rgba(27, 107, 74, 0.3);
  transform: translateY(-1px);
}

/* ─── Input Row ─────────────────────────────────────────── */
#sg-faq-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(45, 60, 45, 0.08);
  background: rgba(250, 250, 245, 0.95);
  flex-shrink: 0;
}
#sg-faq-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  background: rgba(45, 60, 45, 0.04);
  border: 1px solid rgba(45, 60, 45, 0.1);
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  color: #2D3C2D;
  outline: none;
  transition: border-color 0.2s;
}
#sg-faq-input::placeholder {
  color: rgba(45, 60, 45, 0.35);
}
#sg-faq-input:focus {
  border-color: rgba(27, 107, 74, 0.4);
}
#sg-faq-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #1B6B4A, #2D3C2D);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}
#sg-faq-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(27, 107, 74, 0.3);
}

/* ─── Typing Indicator (3 bouncing dots) ────────────────── */
.sg-typing {
  display: flex;
  gap: 5px;
  padding: 12px 18px !important;
  min-width: 60px;
}
.sg-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(27, 107, 74, 0.4);
  animation: sgBounce 1.4s ease-in-out infinite;
}
.sg-dot:nth-child(2) { animation-delay: 0.2s; }
.sg-dot:nth-child(3) { animation-delay: 0.4s; }

/* ─── Typewriter Cursor ─────────────────────────────────── */
.sg-cursor {
  display: inline;
  color: rgba(27, 107, 74, 0.6);
  animation: sgBlink 0.8s step-end infinite;
  font-size: 0.9em;
  margin-left: 1px;
}

/* ─── Smart Link Buttons ────────────────────────────────── */
.sg-smart-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px !important;
  background: transparent !important;
}
.sg-smart-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(27, 107, 74, 0.08), rgba(27, 107, 74, 0.14));
  border: 1px solid rgba(27, 107, 74, 0.2);
  border-radius: 10px;
  color: #1B6B4A;
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}
.sg-smart-link:hover {
  background: linear-gradient(135deg, #1B6B4A, #2D3C2D);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(27, 107, 74, 0.2);
}

/* ─── Status Indicator ──────────────────────────────────── */
#sg-faq-status {
  transition: all 0.3s;
}

/* ─── Animations ────────────────────────────────────────── */
@keyframes sgFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes sgBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
@keyframes sgBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ─── Scrollbar ─────────────────────────────────────────── */
#sg-faq-body::-webkit-scrollbar { width: 4px; }
#sg-faq-body::-webkit-scrollbar-track { background: transparent; }
#sg-faq-body::-webkit-scrollbar-thumb {
  background: rgba(45, 60, 45, 0.15);
  border-radius: 4px;
}

/* ─── Tablet ────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sg-faq-panel {
    width: 340px;
    max-height: 480px;
  }
}

/* ─── Mobile ────────────────────────────────────────────── */
@media (max-width: 480px) {
  #sg-faq-panel {
    left: 8px;
    right: 8px;
    bottom: 76px;
    width: auto;
    max-height: calc(100dvh - 100px);
    border-radius: 16px;
  }
  #sg-faq-body {
    min-height: 120px;
    max-height: none;
    padding: 12px;
  }
  #sg-faq-toggle {
    left: 12px;
    bottom: 18px;
    padding: 10px 16px;
    font-size: 0.76rem;
  }
  .sg-msg {
    max-width: 92%;
    font-size: 0.78rem;
    padding: 8px 12px;
  }
  .sg-chip {
    font-size: 0.65rem;
    padding: 5px 10px;
  }
  #sg-faq-input {
    padding: 8px 12px;
    font-size: 0.78rem;
  }
  #sg-faq-send {
    width: 34px;
    height: 34px;
  }
  #sg-faq-header {
    padding: 12px 16px;
  }
  #sg-faq-input-row {
    padding: 10px 12px;
  }
}

