/* =============================================================
   Forge — floating help-bot widget for Breachforge
   Uses the site's CSS variables (style.css) so it matches the theme.
   ============================================================= */

#forge-launch {
  position: fixed; right: 24px; bottom: 24px; z-index: 9000;
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent, #E8590C), var(--accent-2, #ff7b33));
  box-shadow: 0 8px 28px rgba(232,89,12,0.45);
  display: flex; align-items: center; justify-content: center;
  transition: transform .25s var(--ease, ease), box-shadow .25s ease;
}
#forge-launch:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 12px 38px rgba(232,89,12,0.6); }
#forge-launch svg { width: 28px; height: 28px; }
#forge-launch .forge-dot {
  position: absolute; top: 6px; right: 6px; width: 11px; height: 11px;
  background: #22c55e; border-radius: 50%; border: 2px solid #08080e;
}

#forge-panel {
  position: fixed; right: 24px; bottom: 96px; z-index: 9001;
  width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 130px);
  background: var(--bg-card-solid, #0f0f18);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 20px; overflow: hidden;
  display: none; flex-direction: column;
  box-shadow: 0 24px 70px rgba(0,0,0,0.6);
  font-family: var(--font-body, 'DM Sans', sans-serif);
  opacity: 0; transform: translateY(16px) scale(0.98);
  transition: opacity .22s ease, transform .22s var(--ease, ease);
}
#forge-panel.open { display: flex; opacity: 1; transform: translateY(0) scale(1); }

.forge-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  background: linear-gradient(135deg, rgba(232,89,12,0.14), rgba(232,89,12,0.02));
}
.forge-head .forge-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent, #E8590C), var(--accent-2, #ff7b33));
  display: flex; align-items: center; justify-content: center;
}
.forge-head .forge-avatar svg { width: 20px; height: 20px; }
.forge-head .forge-title { font-family: var(--font-display, sans-serif); font-weight: 700; color: #fff; font-size: 1rem; line-height: 1.1; }
.forge-head .forge-status { font-size: .72rem; color: var(--text-secondary, rgba(255,255,255,.55)); }
.forge-head .forge-close {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--text-secondary, rgba(255,255,255,.55)); font-size: 22px; line-height: 1; padding: 4px 8px;
}
.forge-head .forge-close:hover { color: #fff; }

.forge-body {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent;
}
.forge-body::-webkit-scrollbar { width: 7px; }
.forge-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.forge-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: .9rem; line-height: 1.5; word-wrap: break-word; }
.forge-msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--accent, #E8590C), var(--accent-2, #ff7b33)); color: #fff; border-bottom-right-radius: 4px; }
.forge-msg.bot { align-self: flex-start; background: var(--bg-elevated, rgba(255,255,255,0.06)); color: var(--text, #fff); border-bottom-left-radius: 4px; }
.forge-msg.bot code { background: rgba(232,89,12,0.14); color: var(--accent-2, #ff7b33); padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono, monospace); font-size: .82em; }
.forge-msg.bot pre { background: #08080e; border: 1px solid var(--border, rgba(255,255,255,.08)); padding: 10px; border-radius: 8px; overflow-x: auto; margin: 6px 0; }
.forge-msg.bot pre code { background: none; color: #e8e8ee; padding: 0; }
.forge-msg.bot a { color: var(--accent-2, #ff7b33); text-decoration: underline; }

.forge-sources { align-self: flex-start; max-width: 88%; font-size: .74rem; }
.forge-sources summary { cursor: pointer; color: var(--text-secondary, rgba(255,255,255,.55)); list-style: none; }
.forge-sources summary::-webkit-details-marker { display: none; }
.forge-sources ul { margin: 6px 0 0; padding-left: 16px; color: var(--text-muted, rgba(255,255,255,.4)); }

.forge-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.forge-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted, rgba(255,255,255,.4)); animation: forge-bounce 1.2s infinite; }
.forge-typing span:nth-child(2) { animation-delay: .15s; }
.forge-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes forge-bounce { 0%,60%,100% { transform: translateY(0); opacity:.5 } 30% { transform: translateY(-5px); opacity:1 } }

.forge-foot { padding: 12px; border-top: 1px solid var(--border, rgba(255,255,255,0.08)); }
.forge-input-row { display: flex; gap: 8px; align-items: flex-end; }
.forge-input-row textarea {
  flex: 1; resize: none; max-height: 110px; min-height: 42px;
  background: var(--bg-elevated, rgba(255,255,255,0.06)); color: #fff;
  border: 1px solid var(--border, rgba(255,255,255,0.08)); border-radius: 12px;
  padding: 11px 12px; font-family: var(--font-body, sans-serif); font-size: .9rem; outline: none;
}
.forge-input-row textarea:focus { border-color: var(--border-glow, rgba(232,89,12,0.4)); }
.forge-send {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent, #E8590C), var(--accent-2, #ff7b33));
  display: flex; align-items: center; justify-content: center;
}
.forge-send:disabled { opacity: .5; cursor: not-allowed; }
.forge-send svg { width: 18px; height: 18px; }
.forge-hint { text-align: center; font-size: .68rem; color: var(--text-muted, rgba(255,255,255,.3)); margin-top: 8px; }

.forge-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.forge-chip {
  font-size: .76rem; padding: 6px 11px; border-radius: 100px; cursor: pointer;
  background: var(--bg-card, rgba(255,255,255,0.03)); color: var(--text-secondary, rgba(255,255,255,.55));
  border: 1px solid var(--border, rgba(255,255,255,0.08)); transition: all .2s ease;
}
.forge-chip:hover { color: #fff; border-color: var(--border-glow, rgba(232,89,12,0.4)); }
