/* ==========================================================================
   AI Clinical Intake & Case Triage Assistant (Stem Cell Center India)
   Zero-framework, high-converting medical concierge widget
   ========================================================================== */

:root {
  --ymyl-ai-primary: #0a2240;
  --ymyl-ai-accent: #0284c7;
  --ymyl-ai-accent-hover: #0369a1;
  --ymyl-ai-green: #10b981;
  --ymyl-ai-wa: #25d366;
  --ymyl-ai-bg: #f8fafc;
  --ymyl-ai-card: #ffffff;
  --ymyl-ai-border: #e2e8f0;
  --ymyl-ai-text: #0f172a;
  --ymyl-ai-muted: #64748b;
  --ymyl-ai-shadow: 0 20px 40px -15px rgba(10, 34, 64, 0.25), 0 0 1px 1px rgba(10, 34, 64, 0.05);
}

/* 1. Floating Launcher Pill / Trigger */
.ymyl-ai-launcher {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1040;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #0a2240 0%, #0f3c6c 100%);
  color: #ffffff !important;
  padding: 10px 18px;
  border-radius: 9999px;
  box-shadow: 0 10px 25px -5px rgba(10, 34, 64, 0.4), 0 0 0 1px rgba(56, 189, 248, 0.3);
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.ymyl-ai-launcher:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 16px 32px -6px rgba(10, 34, 64, 0.5), 0 0 0 2px rgba(56, 189, 248, 0.5);
  color: #ffffff;
}

.ymyl-ai-launcher-icon {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  flex-shrink: 0;
}

.ymyl-ai-pulse-dot {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ymyl-ai-green);
  border: 2px solid #0a2240;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: ymylPulse 2s infinite;
}

@keyframes ymylPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ymyl-ai-launcher-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.15;
}

.ymyl-ai-launcher-title {
  font-weight: 700;
  color: #ffffff;
  font-size: 0.86rem;
}

.ymyl-ai-launcher-sub {
  font-size: 0.72rem;
  color: #93c5fd;
  font-weight: 500;
}

/* Proactive Nudge Bubble */
.ymyl-ai-nudge {
  position: fixed;
  bottom: 80px;
  left: 24px;
  z-index: 1039;
  background: #ffffff;
  color: var(--ymyl-ai-text);
  padding: 12px 16px;
  border-radius: 16px;
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
  max-width: 290px;
  font-size: 0.82rem;
  line-height: 1.35;
  display: none;
  animation: ymylFadeSlideUp 0.35s ease-out;
  cursor: pointer;
  border-left: 3.5px solid var(--ymyl-ai-accent);
}

.ymyl-ai-nudge.active {
  display: block;
}

.ymyl-ai-nudge-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 1rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px;
}

.ymyl-ai-nudge-close:hover {
  color: #475569;
}

@keyframes ymylFadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Backdrop Overlay */
.ymyl-ai-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 34, 64, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.ymyl-ai-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* 2. Main Chat / Triage Modal Window */
.ymyl-ai-modal {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 48px);
  background: var(--ymyl-ai-card);
  border-radius: 20px;
  box-shadow: var(--ymyl-ai-shadow);
  border: 1px solid var(--ymyl-ai-border);
  z-index: 1055;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ymyl-ai-modal.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.ymyl-ai-header {
  background: linear-gradient(135deg, #0a2240 0%, #0f3c6c 100%);
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ymyl-ai-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ymyl-ai-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.2);
  border: 2px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  position: relative;
}

.ymyl-ai-header-text h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: #ffffff;
}

.ymyl-ai-header-text span {
  font-size: 0.72rem;
  color: #93c5fd;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ymyl-ai-status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
}

.ymyl-ai-close-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.ymyl-ai-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Body / Messages Scroll Area */
.ymyl-ai-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

/* Chat Bubbles */
.ymyl-ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: ymylFadeSlideUp 0.25s ease-out;
}

.ymyl-ai-msg.bot {
  align-self: flex-start;
}

.ymyl-ai-msg.user {
  align-self: flex-end;
}

.ymyl-ai-bubble {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.ymyl-ai-msg.bot .ymyl-ai-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.ymyl-ai-msg.user .ymyl-ai-bubble {
  background: #0284c7;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* Quick Response Pills & Options */
.ymyl-ai-options-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.ymyl-ai-option-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  padding: 6px 11px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ymyl-ai-option-btn:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  transform: translateY(-1px);
}

/* AI Clinical Summary Report Card */
.ymyl-ai-report-card {
  background: #ffffff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 4px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.08);
}

.ymyl-ai-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.ymyl-ai-report-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0369a1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ymyl-ai-report-badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  background: #ecfdf5;
  color: #059669;
  border-radius: 9999px;
  font-weight: 600;
  border: 1px solid #a7f3d0;
}

.ymyl-ai-stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.8rem;
}

.ymyl-ai-stat-row .stat-label {
  color: #64748b;
}

.ymyl-ai-stat-row .stat-val {
  font-weight: 700;
  color: #0f172a;
}

.ymyl-ai-cost-highlight {
  color: #0284c7;
  font-size: 0.95rem;
}

/* Lead Capture Form Inside Chat */
.ymyl-ai-form {
  background: #ffffff;
  border: 1.5px solid #0284c7;
  border-radius: 14px;
  padding: 14px;
  margin-top: 8px;
  box-shadow: 0 8px 20px -4px rgba(2, 132, 199, 0.15);
}

.ymyl-ai-form-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0a2240;
  margin-bottom: 4px;
}

.ymyl-ai-form-desc {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 10px;
  line-height: 1.35;
}

.ymyl-ai-input-group {
  margin-bottom: 8px;
}

.ymyl-ai-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.82rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.ymyl-ai-input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.ymyl-ai-submit-btn {
  width: 100%;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.2s, transform 0.2s;
}

.ymyl-ai-submit-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.ymyl-ai-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Instant WhatsApp CTA button after submission */
.ymyl-ai-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: #25d366;
  color: #ffffff !important;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
  margin-top: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.ymyl-ai-wa-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.45);
  color: #ffffff;
}

/* Typing animation */
.ymyl-ai-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.ymyl-ai-typing span {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: ymylTyping 1.4s infinite ease-in-out both;
}

.ymyl-ai-typing span:nth-child(1) { animation-delay: -0.32s; }
.ymyl-ai-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes ymylTyping {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* RTL Support for Arabic Language */
html[lang="ar"] .ymyl-ai-launcher {
  left: auto;
  right: 24px;
}

html[lang="ar"] .ymyl-ai-modal {
  left: auto;
  right: 24px;
}

html[lang="ar"] .ymyl-ai-nudge {
  left: auto;
  right: 24px;
  border-left: none;
  border-right: 3.5px solid var(--ymyl-ai-accent);
}

/* Mobile Responsiveness (< 768px): Eliminate viewport clutter */
@media (max-width: 767.98px) {
  .ymyl-ai-launcher {
    display: none !important; /* Hide floating badge on mobile so it never covers buttons or dropdowns */
  }

  .ymyl-ai-nudge {
    display: none !important;
  }

  .ymyl-ai-modal {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 88vh;
    max-height: 88vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    z-index: 1060; /* Higher than mobile sticky bar (1045) */
  }
}

