/* CDO Ebenezer Ministries Chatbot */
:root {
  --chat-primary: #1E4A8A;
  --chat-secondary: #C9A84C;
  --chat-bg: #0D1B2A;
  --chat-surface: #162435;
  --chat-text: #F0EDE8;
  --chat-text-muted: #8A9BB0;
  --chat-user-bg: linear-gradient(135deg, #1E4A8A, #2A5FA0);
  --chat-bot-bg: #1E2D3D;
  --chat-radius: 20px;
  --chat-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

/* === FLOATING BUTTON === */
#ebenezer-chat-toggle {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary), #2A6ABF);
  border: none;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(30,74,138,0.5), 0 0 0 0 rgba(201,168,76,0.4);
  animation: ebenezerPulse 3s infinite;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#ebenezer-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(30,74,138,0.7), 0 0 0 8px rgba(201,168,76,0.15);
}
@keyframes ebenezerPulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(30,74,138,0.5), 0 0 0 0 rgba(201,168,76,0.4); }
  50% { box-shadow: 0 8px 32px rgba(30,74,138,0.5), 0 0 0 10px rgba(201,168,76,0); }
}

/* Badge */
#ebenezer-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #E74C3C;
  border-radius: 50%;
  border: 2px solid white;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  font-family: sans-serif;
}
#ebenezer-chat-badge.show { display: flex; }

/* === CHAT WINDOW === */
#ebenezer-chat-window {
  position: fixed;
  bottom: 104px;
  left: 28px;
  width: 380px;
  height: 520px;
  background: var(--chat-bg);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  border: 1px solid rgba(201,168,76,0.2);
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
}
#ebenezer-chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.ebenezer-chat-header {
  background: linear-gradient(135deg, var(--chat-primary) 0%, #163A6E 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(201,168,76,0.2);
  flex-shrink: 0;
}
.ebenezer-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid var(--chat-secondary);
  flex-shrink: 0;
}
.ebenezer-chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ebenezer-chat-info { flex: 1; }
.ebenezer-chat-name { color: white; font-weight: 700; font-size: 15px; font-family: sans-serif; }
.ebenezer-chat-status {
  color: var(--chat-secondary);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: sans-serif;
}
.ebenezer-status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #2ECC71;
  animation: statusPulse 2s infinite;
}
@keyframes statusPulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
.ebenezer-chat-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.ebenezer-chat-close:hover { background: rgba(255,255,255,0.25); }

/* Messages */
.ebenezer-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,168,76,0.3) transparent;
}
.ebenezer-chat-messages::-webkit-scrollbar { width: 4px; }
.ebenezer-chat-messages::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.3); border-radius: 2px; }

.ebenezer-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: msgIn 0.3s ease;
}
@keyframes msgIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.ebenezer-msg.user { align-self: flex-end; align-items: flex-end; }
.ebenezer-msg.bot { align-self: flex-start; align-items: flex-start; }

.ebenezer-msg-bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  font-family: sans-serif;
}
.ebenezer-msg.user .ebenezer-msg-bubble {
  background: var(--chat-user-bg);
  color: white;
  border-bottom-right-radius: 4px;
}
.ebenezer-msg.bot .ebenezer-msg-bubble {
  background: var(--chat-bot-bg);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(201,168,76,0.1);
}
.ebenezer-msg-bubble a { color: var(--chat-secondary); text-decoration: underline; }
.ebenezer-msg-bubble ul { margin: 6px 0; padding-left: 18px; }
.ebenezer-msg-bubble li { margin: 3px 0; }
.ebenezer-msg-bubble strong { color: var(--chat-secondary); }

/* Typing */
.ebenezer-typing {
  display: flex; align-items: center; gap: 5px;
  padding: 12px 16px;
  background: var(--chat-bot-bg);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(201,168,76,0.1);
  width: fit-content;
}
.ebenezer-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--chat-secondary);
  animation: typingDot 1.2s infinite;
}
.ebenezer-typing span:nth-child(2) { animation-delay: 0.2s; }
.ebenezer-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot { 0%,80%,100%{transform:scale(0.6);opacity:0.4} 40%{transform:scale(1);opacity:1} }

/* Quick buttons */
.ebenezer-quick-btns {
  display: flex; flex-wrap: wrap; gap: 7px;
  padding: 10px 16px 6px;
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}
.ebenezer-quick-btn {
  background: transparent;
  border: 1px solid rgba(201,168,76,0.4);
  color: var(--chat-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: sans-serif;
  white-space: nowrap;
}
.ebenezer-quick-btn:hover {
  background: rgba(201,168,76,0.15);
  border-color: var(--chat-secondary);
}

/* Input area */
.ebenezer-chat-input-area {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex; gap: 10px; align-items: flex-end;
  flex-shrink: 0;
}
#ebenezer-chat-input {
  flex: 1;
  background: var(--chat-surface);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--chat-text);
  font-size: 14px;
  resize: none;
  max-height: 100px;
  min-height: 42px;
  font-family: sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
#ebenezer-chat-input:focus { border-color: rgba(201,168,76,0.6); }
#ebenezer-chat-input::placeholder { color: var(--chat-text-muted); }
#ebenezer-chat-send {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--chat-primary), #2A6ABF);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
}
#ebenezer-chat-send:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(30,74,138,0.5); }
#ebenezer-chat-send svg { width: 18px; height: 18px; fill: white; }

/* Mobile */
@media (max-width: 480px) {
  #ebenezer-chat-window {
    bottom: 0; right: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 0;
    border: none;
  }
  #ebenezer-chat-toggle { bottom: 20px; left: 20px; }
}
