/* ── Digital Jesus Chatbot Widget ── Mid-Hudson Web Brand Colors ── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --dj-primary:    #0a74da;
  --dj-primary-dk: #0558a8;
  --dj-dark:       #f8fafc;
  --dj-dark2:      #ffffff;
  --dj-white:      #ffffff;
  --dj-light:      #f1f5f9;
  --dj-grey:       #64748b;
  --dj-text:       #334155;
  --dj-radius:     20px;
  --dj-shadow:     0 20px 40px -10px rgba(0,0,0,0.15), 0 8px 16px -4px rgba(0,0,0,0.1);
}

/* ── Launcher Bubble ── */
#dj-launcher {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dj-primary), var(--dj-primary-dk));
  box-shadow: 0 8px 24px rgba(10,116,218,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99998;
  border: none;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
#dj-launcher:hover {
  transform: scale(1.05) translateY(-4px);
  box-shadow: 0 12px 28px rgba(10,116,218,0.5);
}
#dj-launcher svg {
  width: 32px;
  height: 32px;
  fill: #fff;
  pointer-events: none;
}
#dj-launcher .dj-badge {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 18px;
  height: 18px;
  background: #ef4444;
  border-radius: 50%;
  border: 3px solid #fff;
  display: none;
  pointer-events: none;
}
#dj-launcher .dj-badge.show { display: block; }

/* ── Chat Window ── */
#dj-window {
  position: fixed;
  bottom: 110px;
  right: 30px;
  width: 380px;
  max-height: 650px;
  height: 80vh;
  background: #ffffff;
  border-radius: var(--dj-radius);
  box-shadow: var(--dj-shadow);
  display: flex;
  flex-direction: column;
  z-index: 99999;
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  border: 1px solid rgba(0,0,0,0.05);
}
#dj-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ── */
#dj-header {
  background: linear-gradient(135deg, var(--dj-primary) 0%, var(--dj-primary-dk) 100%);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 2;
}
.dj-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.dj-header-info { flex: 1; }
.dj-header-info strong {
  display: block;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 2px;
}
.dj-header-info span {
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  font-weight: 400;
  display: flex;
  align-items: center;
}
.dj-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  margin-right: 6px;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}
#dj-close, #dj-restart {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
#dj-close:hover, #dj-restart:hover { 
  color: #ffffff; 
  background: rgba(255,255,255,0.1);
}
#dj-restart:hover {
  transform: rotate(45deg);
}

/* ── Messages Area ── */
#dj-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  background: #f8fafc;
}
#dj-messages::-webkit-scrollbar { width: 6px; }
#dj-messages::-webkit-scrollbar-track { background: transparent; }
#dj-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }
#dj-messages::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Welcome Card ── */
.dj-welcome-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 8px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
  animation: djFadeInUp 0.3s ease forwards;
}
.dj-welcome-logo {
  font-size: 36px;
  margin-bottom: 12px;
}
.dj-welcome-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}
.dj-welcome-card p {
  margin: 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

/* ── Bubbles ── */
.dj-msg, .raj-msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  animation: djFadeInUp 0.3s ease forwards;
}
@keyframes djFadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dj-msg.dj-bot, .raj-msg.raj-bot { justify-content: flex-start; }
.dj-msg.dj-user, .raj-msg.raj-user { justify-content: flex-end; }

.dj-bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}
.dj-bubble-wrapper-user {
  align-items: flex-end;
}
.dj-msg-time {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
  margin-left: 4px;
  margin-right: 4px;
}

.dj-bubble, .raj-bubble {
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.dj-bot .dj-bubble, .raj-bot .raj-bubble {
  background: #ffffff;
  color: var(--dj-text);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(0,0,0,0.03);
}
.dj-user .dj-bubble, .raj-user .raj-bubble {
  background: linear-gradient(135deg, var(--dj-primary), var(--dj-primary-dk));
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* ── Markdown Styles ── */
.dj-bubble strong { font-weight: 600; }
.dj-bubble em { font-style: italic; }
.dj-bubble a { color: inherit; text-decoration: underline; }
.dj-bubble ul { margin: 6px 0; padding-left: 20px; }
.dj-bubble li { margin-bottom: 4px; }
.dj-bubble p { margin: 0 0 8px 0; }
.dj-bubble p:last-child { margin: 0; }

/* ── Quick Buttons ── */
.dj-quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 16px;
  background: #f8fafc;
}
.dj-quick-btn {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: var(--dj-primary);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.dj-quick-btn:hover {
  background: var(--dj-primary);
  color: #fff;
  border-color: var(--dj-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(10,116,218,0.15);
}

/* ── Typing Indicator ── */
.dj-typing {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  background: #ffffff;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  align-items: center;
  border: 1px solid rgba(0,0,0,0.03);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.dj-typing span {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: djTypingPulse 1.4s infinite ease-in-out;
}
.dj-typing span:nth-child(1) { animation-delay: 0s; }
.dj-typing span:nth-child(2) { animation-delay: 0.2s; }
.dj-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes djTypingPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Lead Form ── */
#dj-lead-form {
  padding: 20px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
  display: none;
}
#dj-lead-form.show { display: block; animation: djFadeInUp 0.3s ease forwards; }
#dj-lead-form p {
  color: var(--dj-grey);
  font-size: 13px;
  margin: 0 0 16px;
  line-height: 1.4;
}
.dj-field {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: var(--dj-text);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 12px;
  box-sizing: border-box;
  transition: all 0.2s ease;
  font-family: inherit;
}
.dj-field:focus {
  outline: none;
  border-color: var(--dj-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(10,116,218,0.1);
}
.dj-field::placeholder { color: #94a3b8; }
.dj-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--dj-primary), var(--dj-primary-dk));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
}
.dj-submit:hover { 
  opacity: 0.95;
  box-shadow: 0 4px 12px rgba(10,116,218,0.2);
  transform: translateY(-1px);
}

/* ── Input Bar ── */
#dj-input-bar {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  z-index: 2;
}
#dj-input {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  color: var(--dj-text);
  padding: 10px 14px;
  font-size: 14px;
  transition: all 0.2s ease;
  resize: none;
  outline: none;
  font-family: inherit;
  line-height: 1.4;
  max-height: 120px;
}
#dj-input:focus { 
  border-color: var(--dj-primary); 
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(10,116,218,0.1);
}
#dj-input::placeholder { color: #94a3b8; }
#dj-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--dj-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(10,116,218,0.2);
}
#dj-send:hover { 
  background: var(--dj-primary-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(10,116,218,0.3);
}
#dj-send svg { width: 18px; height: 18px; fill: #fff; margin-left: 2px; }

/* ── Thank You ── */
#dj-thankyou {
  padding: 40px 30px;
  text-align: center;
  display: none;
  background: #ffffff;
  flex: 1;
}
#dj-thankyou.show { display: flex; flex-direction: column; justify-content: center; animation: djFadeInUp 0.3s ease forwards; }
#dj-thankyou .dj-ty-icon { font-size: 48px; margin-bottom: 16px; }
#dj-thankyou h3 { color: #0f172a; margin: 0 0 12px; font-size: 20px; font-weight: 600; }
#dj-thankyou p { color: var(--dj-grey); font-size: 15px; margin: 0; line-height: 1.6; }

/* ── Mobile ── */
@media (max-width: 480px) {
  #dj-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 120px);
    right: 16px;
    bottom: 96px;
  }
  #dj-launcher {
    right: 16px;
    bottom: 16px;
  }
}

/* ── 3D Animated Bot ── */
.dj-animated-bot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(45deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
  background-size: 300% 300%;
  animation: dj-gradient-move 4s ease infinite;
  box-shadow: inset -5px -5px 15px rgba(0,0,0,0.2), inset 5px 5px 15px rgba(255,255,255,0.4);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#dj-launcher .dj-animated-bot {
  width: 64px;
  height: 64px;
}

.dj-avatar .dj-animated-bot {
  width: 40px;
  height: 40px;
  box-shadow: inset -3px -3px 8px rgba(0,0,0,0.2), inset 3px 3px 8px rgba(255,255,255,0.4);
}

@keyframes dj-gradient-move {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.dj-bot-face {
  position: relative;
  width: 60%;
  height: 60%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

/* Eyes */
.dj-bot-eyes {
  display: flex;
  gap: 8px;
  animation: dj-eye-move 6s infinite;
}

.dj-avatar .dj-bot-eyes {
  gap: 5px;
}

.dj-bot-eye {
  width: 8px;
  height: 12px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(255,255,255,0.8);
  animation: dj-blink 4s infinite;
}

.dj-avatar .dj-bot-eye {
  width: 5px;
  height: 8px;
}

/* Eye movement (looking around) */
@keyframes dj-eye-move {
  0%, 10% { transform: translate(0, 0); }
  15%, 25% { transform: translate(-4px, 0); } /* look left */
  30%, 40% { transform: translate(4px, -2px); } /* look up right */
  45%, 55% { transform: translate(0, 4px); } /* look down */
  60%, 100% { transform: translate(0, 0); }
}

/* Blinking */
@keyframes dj-blink {
  0%, 96% { transform: scaleY(1); }
  98% { transform: scaleY(0.1); }
  100% { transform: scaleY(1); }
}

/* Happy Smile */
.dj-bot-smile {
  margin-top: 6px;
  width: 14px;
  height: 6px;
  border-bottom: 3px solid white;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 2px 4px rgba(255,255,255,0.4);
  animation: dj-eye-move 6s infinite; /* move with eyes */
}

.dj-avatar .dj-bot-smile {
  margin-top: 4px;
  width: 10px;
  height: 4px;
  border-bottom: 2px solid white;
}
