/* ============================================
   Benaiah Chat Widget — JC3 Technology
   ============================================ */

.benaiah-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C73A3A 0%, #1E5AA8 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(30, 90, 168, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.benaiah-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(30, 90, 168, 0.45);
}

.benaiah-toggle svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  transition: transform 0.3s ease;
}

.benaiah-toggle.open svg.icon-chat { display: none; }
.benaiah-toggle:not(.open) svg.icon-close { display: none; }
.benaiah-toggle.open svg.icon-close { display: block; }

/* ---- Notification Badge ---- */
.benaiah-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #C73A3A;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  font-family: 'Inter', sans-serif;
}

.benaiah-toggle.open .benaiah-badge { display: none; }

/* ---- Chat Panel ---- */
.benaiah-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9998;
  width: 400px;
  max-height: 560px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.benaiah-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ---- Header ---- */
.benaiah-header {
  background: #0B1F3A;
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.benaiah-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C73A3A 0%, #1E5AA8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.benaiah-avatar svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.benaiah-header-info h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: #fff;
  line-height: 1.3;
}

.benaiah-header-info span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

/* ---- Messages ---- */
.benaiah-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 360px;
  scroll-behavior: smooth;
}

.benaiah-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  word-wrap: break-word;
}

.benaiah-msg.assistant {
  align-self: flex-start;
  background: #F3F4F6;
  color: #1F2937;
  border-bottom-left-radius: 4px;
}

.benaiah-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #1E5AA8 0%, #1a4e94 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Markdown rendering inside messages */
.benaiah-msg.assistant p { margin: 0 0 8px; color: #1F2937; font-size: 14px; line-height: 1.55; }
.benaiah-msg.assistant p:last-child { margin-bottom: 0; }
.benaiah-msg.assistant strong { font-weight: 600; color: #0B1F3A; }
.benaiah-msg.assistant ul, .benaiah-msg.assistant ol { margin: 4px 0 8px 16px; padding: 0; }
.benaiah-msg.assistant li { margin-bottom: 4px; font-size: 14px; color: #1F2937; }
.benaiah-msg.assistant code {
  background: #E5E7EB;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* ---- Typing Indicator ---- */
.benaiah-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
  background: #F3F4F6;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.benaiah-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9CA3AF;
  animation: benaiahBounce 1.2s infinite ease-in-out;
}

.benaiah-typing span:nth-child(2) { animation-delay: 0.15s; }
.benaiah-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes benaiahBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ---- Starter Prompts ---- */
.benaiah-starters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 12px;
}

.benaiah-starter-btn {
  width: 100%;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  text-align: left;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.benaiah-starter-btn:hover {
  border-color: #1E5AA8;
  color: #1E5AA8;
  background: rgba(30, 90, 168, 0.04);
}

.benaiah-starter-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.5;
}

/* ---- Input Area ---- */
.benaiah-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #E5E7EB;
  background: #fff;
  flex-shrink: 0;
}

.benaiah-input {
  flex: 1;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: #1F2937;
  outline: none;
  transition: border-color 0.2s ease;
  resize: none;
  min-height: 40px;
  max-height: 80px;
  line-height: 1.4;
}

.benaiah-input:focus {
  border-color: #1E5AA8;
  box-shadow: 0 0 0 2px rgba(30, 90, 168, 0.1);
}

.benaiah-input::placeholder {
  color: #9CA3AF;
}

.benaiah-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #C73A3A 0%, #1E5AA8 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.benaiah-send:hover {
  transform: scale(1.05);
}

.benaiah-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.benaiah-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ---- Powered By ---- */
.benaiah-footer {
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: #9CA3AF;
  background: #FAFAFA;
  border-top: 1px solid #F3F4F6;
}

.benaiah-footer a {
  color: #1E5AA8;
  text-decoration: none;
  font-weight: 500;
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
  .benaiah-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 16px 16px 0 0;
  }

  .benaiah-messages {
    max-height: calc(100dvh - 220px);
  }

  .benaiah-toggle {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }
}
