/* ============================================================
   Aayu — AI Health Companion Chat Widget
   Premium glassmorphic design with MediConnect branding
   ============================================================ */

/* ===== FLOATING BUBBLE ===== */
.aayu-bubble {
  position: fixed;
  bottom: 100px;
  left: 28px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0057b8 0%, #00a86b 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 87, 184, 0.4);
  z-index: 9998;
  transition: all 0.3s cubic-bezier(.4,0,.2,1);
  border: 3px solid rgba(255,255,255,0.3);
  animation: aayu-pulse 3s ease-in-out infinite;
}
.aayu-bubble:hover {
  transform: scale(1.12);
  box-shadow: 0 12px 40px rgba(0, 87, 184, 0.55);
}
.aayu-bubble-icon {
  font-size: 1.7rem;
  line-height: 1;
}
.aayu-bubble-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: aayu-badge-ping 2s ease-in-out infinite;
}
.aayu-bubble-label {
  position: absolute;
  left: 72px;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  color: #1e293b;
  padding: 6px 14px 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  opacity: 1;
  transition: opacity 0.3s;
  pointer-events: none;
}
.aayu-bubble-label::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #fff;
}

@keyframes aayu-pulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(0, 87, 184, 0.4); }
  50% { box-shadow: 0 8px 48px rgba(0, 87, 184, 0.65), 0 0 0 8px rgba(0, 87, 184, 0.1); }
}
@keyframes aayu-badge-ping {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* ===== CHAT PANEL ===== */
.aayu-panel {
  position: fixed;
  bottom: 100px;
  left: 28px;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,87,184,0.08);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(.4,0,.2,1);
}
.aayu-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ===== CHAT HEADER ===== */
.aayu-header {
  background: linear-gradient(135deg, #0057b8 0%, #003d82 50%, #00a86b 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.aayu-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border: 2px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
  animation: aayu-avatar-glow 4s ease-in-out infinite;
}
@keyframes aayu-avatar-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.2); }
  50% { box-shadow: 0 0 16px 4px rgba(255,255,255,0.15); }
}
.aayu-header-info {
  flex: 1;
  min-width: 0;
}
.aayu-header-name {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.2;
}
.aayu-header-status {
  color: rgba(255,255,255,0.75);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}
.aayu-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}
.aayu-close-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
  flex-shrink: 0;
}
.aayu-close-btn:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

/* ===== CHAT MESSAGES AREA ===== */
.aayu-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8faff;
  scroll-behavior: smooth;
}
.aayu-messages::-webkit-scrollbar { width: 4px; }
.aayu-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* Message Bubbles */
.aayu-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: aayu-msg-in 0.3s ease forwards;
}
.aayu-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.aayu-msg.bot {
  align-self: flex-start;
}
.aayu-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.aayu-msg.bot .aayu-msg-avatar {
  background: linear-gradient(135deg, #0057b8, #00a86b);
  color: #fff;
}
.aayu-msg.user .aayu-msg-avatar {
  background: #e2e8f0;
  color: #475569;
  font-weight: 800;
  font-size: 0.7rem;
}
.aayu-msg-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.88rem;
  line-height: 1.55;
  font-weight: 600;
  position: relative;
}
.aayu-msg.bot .aayu-msg-bubble {
  background: #fff;
  color: #1e293b;
  border: 1px solid #e8edf5;
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.aayu-msg.user .aayu-msg-bubble {
  background: linear-gradient(135deg, #0057b8, #004a9e);
  color: #fff;
  border-bottom-right-radius: 6px;
}

/* Markdown inside bot messages */
.aayu-msg-bubble strong { font-weight: 900; }
.aayu-msg-bubble ul, .aayu-msg-bubble ol {
  margin: 6px 0;
  padding-left: 18px;
}
.aayu-msg-bubble li { margin-bottom: 3px; }
.aayu-msg-bubble p { margin: 0 0 6px 0; }
.aayu-msg-bubble p:last-child { margin-bottom: 0; }

/* Feedback buttons */
.aayu-feedback {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.aayu-feedback button {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #64748b;
}
.aayu-feedback button:hover {
  background: #e8f1fb;
  border-color: #0057b8;
  color: #0057b8;
}
.aayu-feedback button.selected {
  background: #0057b8;
  color: #fff;
  border-color: #0057b8;
}

@keyframes aayu-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== TYPING INDICATOR ===== */
.aayu-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}
.aayu-typing-dots {
  display: flex;
  gap: 4px;
  background: #fff;
  padding: 10px 16px;
  border-radius: 18px;
  border: 1px solid #e8edf5;
  border-bottom-left-radius: 6px;
}
.aayu-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: aayu-dot-bounce 1.4s ease-in-out infinite;
}
.aayu-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.aayu-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes aayu-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ===== QUICK PILLS ===== */
.aayu-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.aayu-pill {
  background: #f0f5ff;
  border: 1.5px solid #c7d7f5;
  color: #0057b8;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.aayu-pill:hover {
  background: #0057b8;
  color: #fff;
  border-color: #0057b8;
  transform: translateY(-1px);
}

/* ===== RECOMMENDATION CARDS (inside chat) ===== */
.aayu-rec-card {
  background: #fff;
  border: 1.5px solid #e8edf5;
  border-radius: 14px;
  padding: 12px;
  margin: 8px 0 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}
.aayu-rec-card:hover {
  border-color: #0057b8;
  box-shadow: 0 4px 16px rgba(0,87,184,0.1);
}
.aayu-rec-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.aayu-rec-icon.doctor { background: #e8f1fb; }
.aayu-rec-icon.medicine { background: #e6f7f1; }
.aayu-rec-icon.test { background: #fff3ed; }
.aayu-rec-info {
  flex: 1;
  min-width: 0;
}
.aayu-rec-name {
  font-weight: 800;
  font-size: 0.85rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aayu-rec-sub {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
}
.aayu-rec-btn {
  background: #0057b8;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.aayu-rec-btn:hover {
  background: #003d82;
  transform: scale(1.05);
}
.aayu-rec-btn.medicine { background: #00a86b; }
.aayu-rec-btn.medicine:hover { background: #007a4d; }
.aayu-rec-btn.test { background: #f97316; }
.aayu-rec-btn.test:hover { background: #ea580c; }

/* ===== PRESCRIPTION PREVIEW ===== */
.aayu-prescription-preview {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 14px;
  padding: 14px;
  margin: 8px 0;
}
.aayu-prescription-preview h4 {
  font-size: 0.85rem;
  font-weight: 900;
  color: #92400e;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.aayu-prescription-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.aayu-prescription-table th {
  background: #fef3c7;
  padding: 6px 8px;
  text-align: left;
  font-weight: 800;
  color: #78350f;
  border-bottom: 1px solid #fde68a;
}
.aayu-prescription-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #fef3c7;
  color: #1e293b;
  font-weight: 600;
}

/* ===== EMERGENCY ALERT ===== */
.aayu-emergency {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  border-radius: 14px;
  padding: 14px;
  margin: 8px 0;
  animation: aayu-emergency-flash 1.5s ease-in-out infinite;
}
.aayu-emergency h4 {
  font-size: 0.95rem;
  font-weight: 900;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.aayu-emergency p {
  font-size: 0.85rem;
  margin: 0;
  font-weight: 600;
  opacity: 0.95;
}
.aayu-emergency a {
  color: #fff;
  text-decoration: underline;
  font-weight: 900;
}
@keyframes aayu-emergency-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
  50% { box-shadow: 0 0 20px 4px rgba(220,38,38,0.3); }
}

/* ===== INPUT AREA ===== */
.aayu-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e8edf5;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.aayu-input {
  flex: 1;
  border: 2px solid #e2e8f0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  color: #1e293b;
  background: #f8fafc;
}
.aayu-input:focus {
  border-color: #0057b8;
  background: #fff;
}
.aayu-input::placeholder {
  color: #94a3b8;
  font-weight: 600;
}
.aayu-upload-btn {
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  font-size: 1rem;
  transition: all 0.2s;
  flex-shrink: 0;
}
.aayu-upload-btn:hover {
  background: #e8f1fb;
  color: #0057b8;
  border-color: #0057b8;
}
.aayu-send-btn {
  background: linear-gradient(135deg, #0057b8, #00a86b);
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 1rem;
  transition: all 0.2s;
  flex-shrink: 0;
}
.aayu-send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,87,184,0.3);
}
.aayu-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ===== IMAGE PREVIEW ===== */
.aayu-img-preview {
  padding: 8px 16px 0;
  background: #fff;
}
.aayu-img-preview-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 12px;
}
.aayu-img-preview img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
}
.aayu-img-preview-text {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
}
.aayu-img-remove {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
}

/* ===== DISCLAIMER ===== */
.aayu-disclaimer {
  text-align: center;
  padding: 6px 16px 10px;
  background: #fff;
  flex-shrink: 0;
}
.aayu-disclaimer p {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 480px) {
  .aayu-panel {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  .aayu-panel.open {
    transform: translateY(0) scale(1);
  }
  .aayu-bubble-label { display: none; }
  .aayu-bubble {
    bottom: 90px;
    left: 18px;
    width: 54px;
    height: 54px;
  }
  .aayu-bubble-icon { font-size: 1.5rem; }
}

/* ===== HIDE BUBBLE WHEN PANEL IS OPEN ===== */
.aayu-bubble.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.5);
}
