/* ============================================================
   OpsForge Chatbot Widget
   Floating chat bubble + full chat window — bottom-right.
   Dark theme matches the landing page (bg #080B14, cyan #00E5FF).
   ============================================================ */

:root {
  --cb-bg: #0D1117;
  --cb-border: rgba(0, 229, 255, 0.15);
  --cb-surface: #111827;
  --cb-user-bubble: rgba(0, 229, 255, 0.12);
  --cb-ai-bubble: rgba(255, 255, 255, 0.05);
  --cb-text: #E2E8F0;
  --cb-muted: rgba(255, 255, 255, 0.4);
  --cb-accent: #00E5FF;
  --cb-accent-dim: rgba(0, 229, 255, 0.15);
  --cb-radius: 16px;
  --cb-width: 380px;
  --cb-height: 560px;
}

/* ── FAB button ─────────────────────────────────── */
#chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--cb-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 0 rgba(0, 229, 255, 0);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
  flex-direction: column;
  gap: 2px;
}
#chat-fab:hover {
  transform: scale(1.07);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.5);
}
#chat-fab .fab-line {
  width: 20px;
  height: 2px;
  background: #080B14;
  border-radius: 2px;
  transition: opacity 0.2s;
}
#chat-fab.open .fab-line:nth-child(1) {
  transform: translateY(4px) rotate(45deg);
}
#chat-fab.open .fab-line:nth-child(2) {
  opacity: 0;
}
#chat-fab.open .fab-line:nth-child(3) {
  transform: translateY(-4px) rotate(-45deg);
}
#chat-fab .fab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #080B14;
}

/* Pulse ring on FAB */
#chat-fab::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--cb-accent);
  opacity: 0.4;
  animation: fab-pulse 2.5s ease-out infinite;
}
@keyframes fab-pulse {
  0% { transform: scale(1); opacity: 0.4; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ── Chat window ───────────────────────────────── */
#chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9000;
  width: var(--cb-width);
  height: var(--cb-height);
  background: var(--cb-bg);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.08), 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: chat-slide-up 0.22s ease-out;
}
#chat-window.visible { display: flex; }
@keyframes chat-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.cb-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: rgba(0, 229, 255, 0.05);
  border-bottom: 1px solid var(--cb-border);
  cursor: default;
}
.cb-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--cb-accent-dim);
  border: 1px solid var(--cb-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cb-avatar svg { width: 22px; height: 22px; }
.cb-header-info { flex: 1; }
.cb-header-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
}
.cb-header-status {
  font-family: 'Manrope', sans-serif;
  font-size: 0.7rem;
  color: var(--cb-accent);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.cb-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cb-accent);
  animation: status-pulse 1.8s infinite;
}
@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}
.cb-header-actions { display: flex; gap: 6px; }
.cb-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--cb-muted);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.cb-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.07); }

/* Messages area */
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.cb-messages::-webkit-scrollbar { width: 4px; }
.cb-messages::-webkit-scrollbar-track { background: transparent; }
.cb-messages::-webkit-scrollbar-thumb { background: rgba(0,229,255,0.2); border-radius: 2px; }

.cb-msg { display: flex; gap: 8px; max-width: 88%; }
.cb-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.cb-msg.user .cb-bubble {
  background: var(--cb-user-bubble);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 12px 12px 3px 12px;
}
.cb-msg.ai .cb-bubble {
  background: var(--cb-ai-bubble);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px 12px 12px 3px;
}
.cb-bubble {
  padding: 9px 13px;
  font-family: 'Manrope', sans-serif;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--cb-text);
  word-break: break-word;
}
.cb-msg-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cb-accent-dim);
  border: 1px solid rgba(0,229,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.cb-msg.user .cb-msg-icon { display: none; }
.cb-msg-icon svg { width: 12px; height: 12px; }

/* Typing indicator */
.cb-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 0 0 4px 30px;
}
.cb-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cb-accent);
  opacity: 0.5;
  animation: typing-bounce 1.2s infinite;
}
.cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.cb-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50%       { transform: translateY(-4px); opacity: 1; }
}

/* Quick suggestions */
.cb-suggestions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 0 4px 30px;
}
.cb-suggestion-btn {
  background: rgba(0,229,255,0.08);
  border: 1px solid rgba(0,229,255,0.2);
  color: var(--cb-accent);
  font-family: 'Manrope', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cb-suggestion-btn:hover {
  background: rgba(0,229,255,0.15);
  border-color: rgba(0,229,255,0.35);
}

/* Input area */
.cb-input-area {
  padding: 12px 14px;
  border-top: 1px solid var(--cb-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.cb-input {
  flex: 1;
  background: var(--cb-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 13px;
  font-family: 'Manrope', sans-serif;
  font-size: 0.82rem;
  color: #fff;
  resize: none;
  max-height: 90px;
  line-height: 1.5;
  transition: border-color 0.15s;
}
.cb-input:focus { outline: none; border-color: rgba(0,229,255,0.3); }
.cb-input::placeholder { color: var(--cb-muted); }
.cb-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--cb-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.cb-send-btn:hover { background: #33EBFF; transform: scale(1.05); }
.cb-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Contact form (shown when chatbot can't help) */
#cb-contact-form {
  padding: 14px 16px;
  border-top: 1px solid var(--cb-border);
  background: rgba(0,229,255,0.03);
  display: none;
}
#cb-contact-form.visible { display: block; }
.cb-form-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 10px;
}
.cb-form-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 7px;
}
.cb-form-row input,
.cb-form-row textarea {
  background: var(--cb-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 11px;
  font-family: 'Manrope', sans-serif;
  font-size: 0.78rem;
  color: #fff;
  resize: none;
  transition: border-color 0.15s;
}
.cb-form-row textarea { height: 52px; }
.cb-form-row input:focus,
.cb-form-row textarea:focus {
  outline: none;
  border-color: rgba(0,229,255,0.3);
}
.cb-form-row input::placeholder,
.cb-form-row textarea::placeholder { color: var(--cb-muted); }
.cb-form-row label {
  font-family: 'Manrope', sans-serif;
  font-size: 0.7rem;
  color: var(--cb-muted);
}
.cb-form-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background: var(--cb-accent);
  color: #080B14;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}
.cb-form-btn:hover { background: #33EBFF; }
.cb-form-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cb-form-success {
  text-align: center;
  padding: 14px 0 4px;
  font-family: 'Manrope', sans-serif;
  font-size: 0.82rem;
  color: #34D399;
}

/* ── Responsive ─────────────────────────── */
@media (max-width: 480px) {
  #chat-fab { bottom: 20px; right: 20px; width: 54px; height: 54px; }
  #chat-window {
    bottom: 86px;
    right: 12px;
    left: 12px;
    width: auto;
    height: 480px;
  }
}