/* ==========================================================================
   NAYAN JYOTI AI MEDICAL ASSISTANT WIDGET STYLES
   ========================================================================== */

/* Header Search / Ask AI button */
.header-ai-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0f7fe;
  border: 1px solid #bae6fd;
  color: #0284c7;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}
.header-ai-search-btn:hover {
  background: #e0f2fe;
  border-color: #0284c7;
  transform: translateY(-1px);
}
@media (max-width: 700px) {
  .header-ai-search-btn {
    padding: 7px 10px;
    font-size: 13px;
  }
  .header-ai-search-btn .ai-search-text {
    display: none;
  }
}

/* 1. Floating Launcher Button */
.nj-ai-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #0755af 0%, #0284c7 100%);
  color: #ffffff;
  padding: 6px 16px 6px 6px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(7, 85, 175, 0.42), 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
  user-select: none;
  border: 2px solid rgba(255, 255, 255, 0.35);
}
.nj-ai-launcher:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 36px rgba(7, 85, 175, 0.55);
}
.nj-ai-launcher:active {
  transform: scale(0.96);
}
.nj-ai-launcher-icon {
  width: 44px;
  height: 44px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
}
.nj-ai-launcher .ai-icon-close {
  display: none;
  font-size: 24px;
  color: #0755af;
  font-weight: 700;
  line-height: 1;
}
.nj-ai-launcher.active .ai-icon-doc {
  display: none;
}
.nj-ai-launcher.active .ai-icon-close {
  display: block;
}
.nj-ai-pill-label {
  display: flex;
  flex-direction: column;
  text-align: left;
}
.nj-ai-pill-label strong {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
  line-height: 1.2;
}
.nj-ai-pill-label small {
  font-size: 10.5px;
  color: #dbeafe;
  font-weight: 600;
}

/* Pulsing Aura Ring */
.nj-ai-pulse {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 999px;
  border: 2px solid rgba(56, 189, 248, 0.6);
  animation: njAiPulseAnim 2.2s infinite;
  pointer-events: none;
}
@keyframes njAiPulseAnim {
  0% { transform: scale(0.97); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 0.2; }
  100% { transform: scale(0.97); opacity: 0.8; }
}

/* 2. Chat Dialog Box */
.nj-ai-chatbox {
  position: fixed;
  bottom: 95px;
  right: 28px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(85vh - 70px);
  background: #ffffff;
  border: 1px solid #dce8f5;
  border-radius: 22px;
  box-shadow: 0 20px 60px -10px rgba(8, 35, 65, 0.28), 0 4px 16px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 99998;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.nj-ai-chatbox.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.nj-ai-header {
  background: linear-gradient(135deg, #0755af 0%, #0369a1 100%);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(7, 85, 175, 0.2);
}
.nj-ai-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nj-ai-avatar-circle {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  position: relative;
}
.nj-ai-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
}
.nj-ai-header-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}
.nj-ai-header-info p {
  margin: 2px 0 0;
  font-size: 11px;
  color: #bae6fd;
  font-weight: 600;
}
.nj-ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nj-ai-hdr-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  padding: 0;
}
.nj-ai-hdr-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Chat Body */
.nj-ai-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Message Bubbles */
.ai-bubble {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: njAiFadeIn 0.25s ease forwards;
}
@keyframes njAiFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-bubble.incoming {
  align-self: flex-start;
}
.ai-bubble.outgoing {
  align-self: flex-end;
}
.ai-bubble-content {
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.ai-bubble.incoming .ai-bubble-content {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 4px;
}
.ai-bubble.outgoing .ai-bubble-content {
  background: linear-gradient(135deg, #0755af 0%, #0284c7 100%);
  color: #ffffff;
  border-top-right-radius: 4px;
}
.ai-bubble-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 3px;
  padding: 0 4px;
}
.ai-bubble.outgoing .ai-bubble-time {
  align-self: flex-end;
}

/* Response In-Message Action Buttons */
.ai-msg-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.ai-msg-actions a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  text-decoration: none;
  line-height: 1.3;
}
.ai-btn-call {
  background: #0755af;
  color: #ffffff !important;
}
.ai-btn-wa {
  background: #10b981;
  color: #ffffff !important;
}
.ai-btn-primary {
  background: #e0f2fe;
  color: #0369a1 !important;
  border: 1px solid #bae6fd;
}

/* Typing Indicator Animation */
.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  width: fit-content;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.ai-typing-indicator span {
  width: 6px;
  height: 6px;
  background: #0284c7;
  border-radius: 50%;
  animation: njAiTyping 1.2s infinite ease-in-out;
}
.ai-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes njAiTyping {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* Quick Suggestion Chips */
.ai-chips-wrapper {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-chip-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
}
.ai-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  line-height: 1.35;
}
.ai-chip:hover {
  background: #f0f9ff;
  border-color: #38bdf8;
  color: #0284c7;
  transform: translateX(3px);
}

/* Chat Input Footer Form */
.nj-ai-footer {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nj-ai-footer input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: #0f172a;
  outline: none;
  background: #f8fafc;
  transition: border-color 0.2s, background 0.2s;
}
.nj-ai-footer input:focus {
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}
.nj-ai-footer button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0755af 0%, #0284c7 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.15s;
}
.nj-ai-footer button:hover {
  transform: scale(1.05);
}
.nj-ai-footer button:active {
  transform: scale(0.95);
}

/* 3. Mobile Phone Responsive Layout (< 768px) */
@media (max-width: 768px) {
  .nj-ai-launcher {
    bottom: 85px !important; /* Floats safely above the sticky bottom call/whatsapp bar */
    right: 14px !important;
    padding: 5px 12px 5px 5px !important;
  }
  .nj-ai-launcher-icon {
    width: 38px !important;
    height: 38px !important;
    font-size: 19px !important;
  }
  .nj-ai-pill-label strong {
    font-size: 12px !important;
  }
  .nj-ai-pill-label small {
    display: none !important; /* Compact pill label on phone */
  }
  .nj-ai-chatbox {
    bottom: 80px !important;
    right: 10px !important;
    left: 10px !important;
    width: auto !important;
    max-width: none !important;
    height: 74vh !important;
    border-radius: 20px !important;
  }
  .nj-ai-footer input {
    font-size: 16px !important; /* Avoids iOS zoom on input focus */
  }
}
