/* BotForge Widget Styles
 * This file is inlined into botforge.js as a Shadow DOM stylesheet.
 * No [data-botforge] prefix needed — the shadow root provides full isolation.
 * Edit here and sync the STYLES string in botforge.js when making changes.
 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.bf-fab {
  position: fixed;
  z-index: 2147483647;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bf-primary, #6366f1);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s;
}
.bf-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.bf-fab svg { width: 26px; height: 26px; }

.bf-window {
  position: fixed;
  z-index: 2147483646;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity .25s, transform .25s;
}
.bf-window.bf-hidden { opacity: 0; pointer-events: none; transform: translateY(12px) scale(.97); }

.bf-header {
  background: var(--bf-primary, #6366f1);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.bf-header-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.bf-header-name { font-weight: 600; font-size: 15px; }
.bf-header-status { font-size: 11px; opacity: .8; }
.bf-close {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: #fff; opacity: .7; font-size: 20px; line-height: 1; padding: 2px 4px;
}
.bf-close:hover { opacity: 1; }

.bf-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bf-bg, #f8f9fb);
}

.bf-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}
.bf-msg.bf-bot {
  background: #fff;
  color: var(--bf-text, #1e293b);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.bf-msg.bf-user {
  background: var(--bf-primary, #6366f1);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.bf-typing {
  display: flex; gap: 4px; align-items: center; padding: 12px 14px;
  background: #fff; border-radius: 14px; border-bottom-left-radius: 4px;
  align-self: flex-start; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.bf-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--bf-primary, #6366f1); opacity: .4;
  animation: bf-bounce .9s ease-in-out infinite;
}
.bf-typing span:nth-child(2) { animation-delay: .15s; }
.bf-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bf-bounce {
  0%,80%,100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

.bf-input-row {
  display: flex; gap: 8px; padding: 12px 14px;
  background: #fff; border-top: 1px solid #e8eaf0;
}
.bf-input {
  flex: 1; border: 1px solid #d1d5db; border-radius: 10px;
  padding: 9px 13px; font-size: 14px; outline: none;
  resize: none; max-height: 120px; line-height: 1.4;
  color: #1e293b;
  background: #fff;
  -webkit-text-fill-color: #1e293b;
}
.bf-input:focus { border-color: var(--bf-primary, #6366f1); }
.bf-send {
  background: var(--bf-primary, #6366f1); border: none; border-radius: 10px;
  color: #fff; cursor: pointer; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; align-self: flex-end;
  transition: opacity .15s;
}
.bf-send:hover { opacity: .85; }
.bf-send:disabled { opacity: .45; cursor: default; }
.bf-send svg { width: 18px; height: 18px; fill: #fff; }

.bf-branding {
  text-align: center; font-size: 11px; color: #9ca3af;
  padding: 6px; background: #fff; border-top: 1px solid #f0f0f0;
}
.bf-branding a { color: inherit; text-decoration: none; }
.bf-branding a:hover { text-decoration: underline; }
