/* ═══════════════════════════════════════════════════════════════════════════
   GF Chatbot Widget — Styles
   BUILD-028 | guerrillafranchising.com
   Design system v3: Playfair Display + Inter, emerald #1B6B4A, charcoal #1C1C1C
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600&family=Inter:wght@400;500;600&display=swap');

/* ─── Reset scope ─────────────────────────────────────────────────────────── */
#gf-chatbot-root *,
#gf-chatbot-root *::before,
#gf-chatbot-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ─── Launch Button ───────────────────────────────────────────────────────── */
#gf-chatbot-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #1B6B4A;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(27, 107, 74, 0.40);
  z-index: 999998;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#gf-chatbot-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(27, 107, 74, 0.55);
}

#gf-chatbot-btn svg {
  width: 26px;
  height: 26px;
  fill: #ffffff;
}

#gf-chatbot-btn .gf-unread-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e53e3e;
  border: 2px solid #fff;
  display: none;
}

#gf-chatbot-btn.gf-has-unread .gf-unread-badge {
  display: block;
}

/* ─── Chat Panel ──────────────────────────────────────────────────────────── */
#gf-chatbot-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 400px;
  height: 600px;
  background: #F7F7F5;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(28, 28, 28, 0.18), 0 2px 8px rgba(28, 28, 28, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 999999;
  overflow: hidden;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), opacity 0.18s ease;
}

#gf-chatbot-panel.gf-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */
#gf-chatbot-header {
  background: #1B6B4A;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#gf-chatbot-header-text {
  display: flex;
  flex-direction: column;
}

#gf-chatbot-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

#gf-chatbot-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: rgba(255,255,255,0.75);
  margin-top: 2px;
}

#gf-chatbot-close {
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.15s;
}

#gf-chatbot-close:hover {
  background: rgba(255,255,255,0.28);
}

#gf-chatbot-close svg {
  width: 14px;
  height: 14px;
  stroke: #fff;
  stroke-width: 2.5;
  fill: none;
}

/* ─── Status Bar ──────────────────────────────────────────────────────────── */
#gf-chatbot-status-bar {
  background: #f0f7f4;
  border-bottom: 1px solid #e0ede7;
  padding: 6px 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.gf-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1B6B4A;
  flex-shrink: 0;
}

#gf-chatbot-status-bar span {
  font-size: 11px;
  font-weight: 500;
  color: #1B6B4A;
}

/* ─── Messages Area ───────────────────────────────────────────────────────── */
#gf-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#gf-chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

#gf-chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

#gf-chatbot-messages::-webkit-scrollbar-thumb {
  background: #d0d9d5;
  border-radius: 4px;
}

/* ─── Message Bubbles ─────────────────────────────────────────────────────── */
.gf-msg {
  display: flex;
  flex-direction: column;
  max-width: 84%;
  animation: gfMsgIn 0.18s ease;
}

@keyframes gfMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gf-msg.gf-user {
  align-self: flex-end;
  align-items: flex-end;
}

.gf-msg.gf-assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.gf-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}

.gf-msg.gf-user .gf-bubble {
  background: #1B6B4A;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.gf-msg.gf-assistant .gf-bubble {
  background: #ffffff;
  color: #1C1C1C;
  border: 1px solid #e8edeb;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(28,28,28,0.06);
}

.gf-bubble a {
  color: #1B6B4A;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gf-msg.gf-user .gf-bubble a {
  color: rgba(255,255,255,0.88);
}

.gf-msg-time {
  font-size: 10px;
  color: #a0a8a5;
  margin-top: 3px;
  padding: 0 4px;
}

/* ─── Typing Indicator ────────────────────────────────────────────────────── */
.gf-typing {
  display: flex;
  align-self: flex-start;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #e8edeb;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(28,28,28,0.06);
}

.gf-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1B6B4A;
  opacity: 0.4;
  animation: gfDot 1.2s infinite ease-in-out;
}

.gf-typing span:nth-child(2) { animation-delay: 0.2s; }
.gf-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes gfDot {
  0%, 80%, 100% { opacity: 0.4; transform: scale(0.9); }
  40%           { opacity: 1;   transform: scale(1.15); }
}

/* ─── Tool Used Badge ─────────────────────────────────────────────────────── */
.gf-tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #1B6B4A;
  background: #eaf4ef;
  border: 1px solid #c3ddd0;
  border-radius: 20px;
  padding: 2px 8px;
  margin-top: 5px;
  letter-spacing: 0.02em;
}

.gf-tool-badge::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #1B6B4A;
}

/* ─── Email Capture Card ──────────────────────────────────────────────────── */
.gf-email-card {
  background: #f0f7f4;
  border: 1px solid #c3ddd0;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 4px 0;
  animation: gfMsgIn 0.2s ease;
}

.gf-email-card p {
  font-size: 13px;
  color: #1C1C1C;
  line-height: 1.45;
  margin-bottom: 10px;
}

.gf-email-card p strong {
  color: #1B6B4A;
}

.gf-email-row {
  display: flex;
  gap: 8px;
}

.gf-email-input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid #c3ddd0;
  border-radius: 8px;
  font-size: 13px;
  color: #1C1C1C;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.gf-email-input:focus {
  border-color: #1B6B4A;
}

.gf-email-submit {
  padding: 9px 14px;
  background: #1B6B4A;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.gf-email-submit:hover {
  background: #155a3d;
}

.gf-email-skip {
  font-size: 11px;
  color: #a0a8a5;
  background: none;
  border: none;
  cursor: pointer;
  margin-top: 7px;
  display: block;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── CTA Banner ──────────────────────────────────────────────────────────── */
.gf-cta-banner {
  background: #1B6B4A;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 4px 0;
  animation: gfMsgIn 0.2s ease;
}

.gf-cta-banner p {
  font-size: 13px;
  color: rgba(255,255,255,0.90);
  margin-bottom: 10px;
  line-height: 1.4;
}

.gf-cta-btn {
  display: block;
  width: 100%;
  padding: 9px 0;
  background: #fff;
  color: #1B6B4A;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  margin-bottom: 6px;
  transition: background 0.15s;
}

.gf-cta-btn:hover {
  background: #f0f7f4;
}

.gf-cta-btn.gf-cta-secondary {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.90);
  border: 1.5px solid rgba(255,255,255,0.25);
}

.gf-cta-btn.gf-cta-secondary:hover {
  background: rgba(255,255,255,0.22);
}

/* ─── Input Area ──────────────────────────────────────────────────────────── */
#gf-chatbot-input-area {
  border-top: 1px solid #e0ede7;
  padding: 12px 12px;
  background: #F7F7F5;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

#gf-chatbot-input {
  flex: 1;
  resize: none;
  border: 1.5px solid #d0ddd8;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  line-height: 1.45;
  color: #1C1C1C;
  background: #fff;
  outline: none;
  min-height: 40px;
  max-height: 120px;
  transition: border-color 0.15s;
  font-family: 'Inter', sans-serif;
}

#gf-chatbot-input::placeholder {
  color: #a0aaa5;
}

#gf-chatbot-input:focus {
  border-color: #1B6B4A;
}

#gf-chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #1B6B4A;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

#gf-chatbot-send:hover:not(:disabled) {
  background: #155a3d;
}

#gf-chatbot-send:active:not(:disabled) {
  transform: scale(0.94);
}

#gf-chatbot-send:disabled {
  background: #b0c8be;
  cursor: not-allowed;
}

#gf-chatbot-send svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

/* ─── Footer Disclaimer ───────────────────────────────────────────────────── */
#gf-chatbot-footer {
  padding: 6px 12px 10px;
  text-align: center;
  font-size: 10px;
  color: #b0b8b4;
  background: #F7F7F5;
  flex-shrink: 0;
}

/* ─── Mobile responsive ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #gf-chatbot-panel {
    width: calc(100vw - 20px);
    height: calc(100dvh - 100px);
    right: 10px;
    bottom: 80px;
  }

  #gf-chatbot-btn {
    right: 16px;
    bottom: 16px;
  }
}
