/* ═══════════════════════════════════════════════════════════
   Ask SAGE — Chatbot Widget
   Stratants Theme rc23+
   Design: navy/teal palette, Fraunces + Inter, warm paper
   ═══════════════════════════════════════════════════════════ */

/* ── Widget container ─────────────────────────────────────── */
#ask-sage-widget {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Floating button ──────────────────────────────────────── */
#ask-sage-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: #062a38;
  color: #fbf8f3;
  border: none;
  border-radius: 100px;
  padding: 0.7rem 1.25rem 0.7rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(6,42,56,0.28), 0 1px 4px rgba(6,42,56,0.18);
  transition: background 0.18s ease, transform 0.14s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}

#ask-sage-btn:hover {
  background: #008c82;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,140,130,0.32), 0 1px 4px rgba(6,42,56,0.14);
}

#ask-sage-btn:active {
  transform: translateY(0);
}

#ask-sage-btn-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

#ask-sage-btn-label {
  line-height: 1;
}

/* ── Panel ────────────────────────────────────────────────── */
#ask-sage-panel {
  width: 360px;
  max-width: calc(100vw - 2rem);
  background: #fbf8f3;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(6,42,56,0.22), 0 2px 8px rgba(6,42,56,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.24s ease, transform 0.24s ease;
  pointer-events: none;
  /* max-height keeps the panel from overflowing on short screens */
  max-height: calc(100vh - 7rem);
}

#ask-sage-panel[hidden] {
  display: flex !important; /* override hidden so transition works */
  visibility: hidden;
}

#ask-sage-panel.ask-sage-panel-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

/* ── Panel header ─────────────────────────────────────────── */
#ask-sage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #062a38;
  padding: 0.9rem 1rem 0.9rem 1.1rem;
  flex-shrink: 0;
}

#ask-sage-header-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

#ask-sage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #008c82;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(0,140,130,0.2);
  animation: ask-sage-pulse 2.4s ease-in-out infinite;
}

@keyframes ask-sage-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(0,140,130,0.2); }
  50%       { box-shadow: 0 0 0 5px rgba(0,140,130,0.08); }
}

#ask-sage-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fbf8f3;
  line-height: 1.1;
  letter-spacing: 0.01em;
}

#ask-sage-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(157,184,198,0.65);
  margin-top: 0.1rem;
}

#ask-sage-close {
  background: none;
  border: none;
  color: rgba(157,184,198,0.6);
  cursor: pointer;
  padding: 0.3rem;
  display: flex;
  align-items: center;
  border-radius: 2px;
  transition: color 0.15s;
  flex-shrink: 0;
}

#ask-sage-close:hover { color: #fbf8f3; }

/* ── Messages area ────────────────────────────────────────── */
#ask-sage-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 180px;
  max-height: 320px;
  scroll-behavior: smooth;
}

#ask-sage-messages::-webkit-scrollbar { width: 4px; }
#ask-sage-messages::-webkit-scrollbar-track { background: transparent; }
#ask-sage-messages::-webkit-scrollbar-thumb { background: rgba(6,42,56,0.15); border-radius: 4px; }

/* ── Message bubbles ──────────────────────────────────────── */
.ask-sage-msg {
  max-width: 88%;
  font-size: 0.84rem;
  line-height: 1.65;
  border-radius: 4px;
  padding: 0.65rem 0.85rem;
  word-break: break-word;
  animation: ask-sage-fadein 0.2s ease;
}

@keyframes ask-sage-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ask-sage-msg-sage {
  background: #fff;
  color: #062a38;
  border: 1px solid rgba(6,42,56,0.08);
  align-self: flex-start;
  border-radius: 2px 6px 6px 6px;
}

.ask-sage-msg-sage a {
  color: #008c82;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ask-sage-msg-user {
  background: #062a38;
  color: #fbf8f3;
  align-self: flex-end;
  border-radius: 6px 2px 6px 6px;
}

/* ── Typing indicator ─────────────────────────────────────── */
.ask-sage-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.65rem 0.85rem;
  min-height: 2.4rem;
}

.ask-sage-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9db8c6;
  animation: ask-sage-bounce 1.2s ease-in-out infinite;
}

.ask-sage-typing span:nth-child(2) { animation-delay: 0.18s; }
.ask-sage-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes ask-sage-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Suggestion chips ─────────────────────────────────────── */
#ask-sage-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 1rem 0.4rem;
  flex-shrink: 0;
}

.ask-sage-chip {
  background: rgba(6,42,56,0.05);
  border: 1px solid rgba(6,42,56,0.12);
  color: #062a38;
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  padding: 0.3rem 0.65rem;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
  white-space: nowrap;
  line-height: 1.4;
}

.ask-sage-chip:hover {
  background: #008c82;
  border-color: #008c82;
  color: #fff;
}

/* ── Input form ───────────────────────────────────────────── */
#ask-sage-form {
  display: flex;
  align-items: center;
  gap: 0;
  border-top: 1px solid rgba(6,42,56,0.1);
  padding: 0.65rem 0.75rem;
  background: #fff;
  flex-shrink: 0;
}

#ask-sage-input {
  flex: 1;
  border: 1px solid rgba(6,42,56,0.14);
  border-radius: 2px;
  padding: 0.5rem 0.75rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  color: #062a38;
  background: #fbf8f3;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

#ask-sage-input::placeholder { color: #9db8c6; }
#ask-sage-input:focus { border-color: #008c82; }

#ask-sage-send {
  background: #062a38;
  border: none;
  color: #fbf8f3;
  padding: 0.5rem 0.7rem;
  margin-left: 0.4rem;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

#ask-sage-send:hover { background: #008c82; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
  #ask-sage-widget {
    bottom: 1rem;
    right: 1rem;
  }

  #ask-sage-panel {
    width: calc(100vw - 2rem);
    max-height: calc(100vh - 5.5rem);
  }

  #ask-sage-btn-label {
    display: none;
  }

  #ask-sage-btn {
    padding: 0.75rem;
    border-radius: 50%;
  }
}
