/* ── FeigenBot Widget ─────────────────────────────────── */

:root {
  --fhb-green:   #3d5a2e;
  --fhb-amber:   #c8882a;
  --fhb-charcoal:#1A202C;
  --fhb-bg:      #f8f2e8;
  --fhb-white:   #ffffff;
  --fhb-grey:    #718096;
  --fhb-lite:    #e8deca;
  --fhb-shadow:  0 8px 40px rgba(42,30,15,.18), 0 2px 8px rgba(42,30,15,.12);
}

/* Toggle Button */
#fhb-toggle {
  position: fixed;
  bottom: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--fhb-green);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(61,90,46,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99998;
  transition: transform .25s cubic-bezier(.4,0,.2,1),
              background .22s,
              box-shadow .22s;
  outline: none;
}
#fhb-toggle.pos-right { right: 28px; }
#fhb-toggle.pos-left  { left:  28px; }
#fhb-toggle:hover {
  background: #2d4520;
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(61,90,46,.55);
}
#fhb-toggle.open {
  background: var(--fhb-amber);
  box-shadow: 0 4px 20px rgba(200,136,42,.4);
}
#fhb-toggle svg { transition: opacity .2s, transform .2s; }
#fhb-toggle .icon-chat  { position:absolute; }
#fhb-toggle .icon-close { position:absolute; opacity:0; transform:rotate(-90deg); }
#fhb-toggle.open .icon-chat  { opacity:0; transform:rotate(90deg); }
#fhb-toggle.open .icon-close { opacity:1; transform:rotate(0); }

/* Notification dot */
#fhb-toggle .fhb-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 12px; height: 12px;
  background: var(--fhb-amber);
  border-radius: 50%;
  border: 2px solid var(--fhb-white);
  animation: fhb-pulse 2s infinite;
}
@keyframes fhb-pulse {
  0%,100% { transform: scale(1); opacity:1; }
  50%      { transform: scale(1.3); opacity:.7; }
}

/* Chat Window */
#fhb-window {
  position: fixed;
  bottom: 100px;
  width: 370px;
  max-height: 580px;
  background: var(--fhb-white);
  border: 1px solid var(--fhb-lite);
  box-shadow: var(--fhb-shadow);
  display: flex;
  flex-direction: column;
  z-index: 99997;
  transform: translateY(20px) scale(.97);
  opacity: 0;
  pointer-events: none;
  transition: transform .28s cubic-bezier(.4,0,.2,1),
              opacity .28s cubic-bezier(.4,0,.2,1);
  font-family: 'Georgia', serif;
  border-radius: 2px;
}
#fhb-window.pos-right { right: 28px; }
#fhb-window.pos-left  { left:  28px; }
#fhb-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Header */
#fhb-header {
  background: linear-gradient(135deg, var(--fhb-green) 0%, #4a6e38 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.fhb-avatar {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.fhb-header-text { flex: 1; }
.fhb-header-name {
  font-family: 'Georgia', serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.fhb-header-sub {
  font-size: 11px;
  color: rgba(255,255,255,.65);
  font-style: italic;
  margin-top: 2px;
}
.fhb-status-dot {
  width: 8px; height: 8px;
  background: #7dde6a;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Messages area */
#fhb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 380px;
  scroll-behavior: smooth;
}
#fhb-messages::-webkit-scrollbar { width: 4px; }
#fhb-messages::-webkit-scrollbar-track { background: transparent; }
#fhb-messages::-webkit-scrollbar-thumb { background: var(--fhb-lite); border-radius: 2px; }

/* Bubbles */
.fhb-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: fhb-fadein .3s ease both;
}
@keyframes fhb-fadein {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; transform:none; }
}
.fhb-msg.user { flex-direction: row-reverse; }

.fhb-bubble {
  max-width: 82%;
  padding: 10px 14px;
  font-size: 14.5px;
  line-height: 1.6;
  border-radius: 2px;
}
.fhb-msg.bot .fhb-bubble {
  background: var(--fhb-bg);
  color: var(--fhb-charcoal);
  border-left: 3px solid var(--fhb-green);
}
.fhb-msg.user .fhb-bubble {
  background: var(--fhb-green);
  color: #fff;
  font-style: italic;
}

.fhb-bubble a {
  color: var(--fhb-amber);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.fhb-bubble a:hover { color: #a06018; }

.fhb-msg-avatar {
  width: 26px; height: 26px;
  background: var(--fhb-green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-bottom: 2px;
}
.fhb-msg.user .fhb-msg-avatar { background: var(--fhb-amber); }

/* Typing indicator */
.fhb-typing .fhb-bubble {
  background: var(--fhb-bg);
  border-left: 3px solid var(--fhb-green);
  padding: 12px 16px;
}
.fhb-dots { display: flex; gap: 4px; align-items: center; }
.fhb-dots span {
  width: 6px; height: 6px;
  background: var(--fhb-green);
  border-radius: 50%;
  animation: fhb-bounce .9s ease-in-out infinite;
  opacity: .5;
}
.fhb-dots span:nth-child(2) { animation-delay: .15s; }
.fhb-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes fhb-bounce {
  0%,80%,100% { transform:translateY(0); opacity:.5; }
  40%          { transform:translateY(-5px); opacity:1; }
}

/* Suggested questions */
#fhb-suggestions {
  padding: 0 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.fhb-suggestion {
  font-family: 'Georgia', serif;
  font-size: 13px;
  font-style: italic;
  padding: 5px 12px;
  background: var(--fhb-bg);
  border: 1px solid var(--fhb-lite);
  color: var(--fhb-green);
  cursor: pointer;
  transition: background .18s, border-color .18s;
  white-space: nowrap;
  border-radius: 2px;
}
.fhb-suggestion:hover {
  background: #eef5e8;
  border-color: var(--fhb-green);
}

/* Input area */
#fhb-input-area {
  border-top: 1px solid var(--fhb-lite);
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: var(--fhb-white);
}
#fhb-input {
  flex: 1;
  border: 1px solid var(--fhb-lite);
  padding: 9px 12px;
  font-family: 'Georgia', serif;
  font-size: 15px;
  color: var(--fhb-charcoal);
  outline: none;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  transition: border-color .2s;
  background: var(--fhb-bg);
  line-height: 1.4;
  border-radius: 2px;
}
#fhb-input::placeholder { color: #a0aec0; font-style: italic; }
#fhb-input:focus { border-color: var(--fhb-green); background: #fff; }

#fhb-send {
  width: 40px; height: 40px;
  background: var(--fhb-green);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s, transform .18s;
  border-radius: 2px;
}
#fhb-send:hover { background: #2d4520; transform: scale(1.05); }
#fhb-send:disabled { background: var(--fhb-lite); cursor: not-allowed; transform: none; }
#fhb-send svg { color: #fff; }

/* Footer branding */
#fhb-footer {
  padding: 6px 16px 8px;
  border-top: 1px solid var(--fhb-lite);
  text-align: center;
  font-size: 11px;
  color: #a0aec0;
  font-family: monospace;
  letter-spacing: .06em;
  flex-shrink: 0;
}
#fhb-footer a { color: var(--fhb-green); text-decoration: none; }

/* Mobile */
@media (max-width: 480px) {
  #fhb-window {
    width: calc(100vw - 24px);
    bottom: 90px;
    max-height: 70vh;
  }
  #fhb-window.pos-right,
  #fhb-window.pos-left { right: 12px; left: 12px; }
  #fhb-toggle.pos-right { right: 16px; }
  #fhb-toggle.pos-left  { left:  16px; }
}
