/* ==========================================================================
   BHARAT X-RAY CLINIC — PRODUCTION AI CHATBOT WIDGET STYLESHEET
   Healthcare-Grade | Mobile-First | Bottom-Right Floating Widget
   ========================================================================== */

:root {
  --bx-navy: #0a1628;
  --bx-deep-blue: #0f2c59;
  --bx-teal: #0d9488;
  --bx-light-teal: #14b8a6;
  --bx-blue: #2563eb;
  --bx-green: #25d366;
  --bx-gold: #f59e0b;
  --bx-bg-light: #f8fafc;
  --bx-border: #e2e8f0;
  --bx-text-dark: #1e293b;
  --bx-text-muted: #64748b;
  --bx-shadow-lg: 0 20px 40px rgba(15, 44, 89, 0.22);
}

/* Isolated Box Sizing */
#mira-launcher, #mira-launcher *,
#mira-modal, #mira-modal * {
  box-sizing: border-box;
}

/* ==========================================================================
   1. FLOATING LAUNCHER BUTTON (BOTTOM-RIGHT)
   ========================================================================== */
#mira-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999 !important;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #0a1628 0%, #0f2c59 50%, #0d9488 100%);
  color: #ffffff;
  padding: 10px 20px 10px 12px;
  border-radius: 50px;
  cursor: pointer !important;
  pointer-events: auto !important;
  box-shadow: 0 10px 28px rgba(13, 148, 136, 0.35), 0 4px 12px rgba(10, 22, 40, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease, visibility 0.3s ease, box-shadow 0.3s ease;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  user-select: none;
}

#mira-launcher * {
  pointer-events: none;
}

#mira-launcher:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 14px 35px rgba(13, 148, 136, 0.45), 0 6px 18px rgba(10, 22, 40, 0.4);
}

/* Hidden state for launcher when modal opens */
#mira-launcher.mira-launcher-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: scale(0.8) translateY(12px) !important;
  pointer-events: none !important;
}

.mira-avatar-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #14b8a6, #2563eb);
  padding: 2px;
  flex-shrink: 0;
}

.mira-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #0a1628;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #ffffff;
}

.mira-online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  background-color: #22c55e;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
}

.mira-launcher-text {
  display: flex;
  flex-direction: column;
}

.mira-launcher-name {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.mira-launcher-sub {
  font-size: 11px;
  opacity: 0.9;
  font-weight: 500;
}

/* ==========================================================================
   2. CHAT MODAL WINDOW (BOTTOM-RIGHT)
   ========================================================================== */
#mira-modal {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 40px);
  background: #ffffff;
  border-radius: 24px;
  box-shadow: var(--bx-shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.06);
  z-index: 999999 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.3s ease;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#mira-modal.active {
  visibility: visible !important;
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  pointer-events: auto !important;
}

/* Modal Header */
.mira-header {
  background: linear-gradient(135deg, #0a1628 0%, #0f2c59 60%, #0d9488 100%);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.mira-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mira-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #14b8a6, #3b82f6);
  padding: 2px;
  flex-shrink: 0;
}

.mira-header-avatar div {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #0a1628;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}

.mira-header-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.mira-header-status {
  font-size: 11.5px;
  color: #6ee7b7;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.mira-close-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  transition: background 0.2s;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
}

.mira-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Language Selection Bar */
.mira-lang-bar {
  background: #f1f5f9;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.mira-lang-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
}

.mira-lang-options {
  display: flex;
  gap: 5px;
}

.mira-lang-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mira-lang-btn.active, .mira-lang-btn:hover {
  background: #0d9488;
  color: #ffffff;
  border-color: #0d9488;
}

/* ==========================================================================
   3. CHAT BODY & MESSAGES
   ========================================================================== */
.mira-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.mira-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  align-items: flex-end;
}

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

.mira-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.mira-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0f2c59;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.mira-msg-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--bx-text-dark);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  word-break: break-word;
}

.mira-msg.bot .mira-msg-bubble {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.mira-msg.user .mira-msg-bubble {
  background: linear-gradient(135deg, #0f2c59, #0d9488);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* Quick Query Pills */
.mira-quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.mira-pill {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.mira-pill:hover {
  background: #0d9488;
  color: #ffffff;
  border-color: #0d9488;
  transform: translateY(-1px);
}

/* Typing Indicator */
.mira-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.mira-typing span {
  width: 7px;
  height: 7px;
  background: #0d9488;
  border-radius: 50%;
  animation: miraBounce 1.4s infinite ease-in-out both;
}

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

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

/* Lead Booking Card & WhatsApp CTA */
.mira-booking-card {
  background: #ffffff;
  border: 1.5px solid #0d9488;
  border-radius: 14px;
  padding: 14px;
  margin-top: 8px;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.12);
}

.mira-booking-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f2c59;
  margin-bottom: 6px;
}

.mira-booking-details {
  font-size: 12.5px;
  color: #475569;
  line-height: 1.4;
  margin-bottom: 10px;
}

.mira-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #25d366;
  color: #ffffff !important;
  text-decoration: none !important;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.mira-wa-btn:hover {
  background: #1eb854;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}

/* ==========================================================================
   4. CHAT INPUT BAR
   ========================================================================== */
.mira-input-bar {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mira-input-bar input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  color: #1e293b;
  background: #f8fafc;
}

.mira-input-bar input:focus {
  border-color: #0d9488;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.mira-send-btn, .mira-upload-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.mira-upload-btn {
  background: #f1f5f9;
  color: #475569;
}

.mira-upload-btn:hover {
  background: #e2e8f0;
  color: #0d9488;
}

.mira-send-btn {
  background: linear-gradient(135deg, #0f2c59, #0d9488);
  color: #ffffff;
}

.mira-send-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  #mira-launcher {
    bottom: 16px;
    right: 16px;
    padding: 8px 16px 8px 10px;
  }
  
  #mira-modal {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}
