/* ==========================================================================
   Agent IA MedCare - Chatbot Flottant & Modal CSS
   ========================================================================== */

/* FAB Agent IA MedCare */
.mc-fab-ai {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 450;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #16a34a 0%, #064e3b 100%);
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}
.mc-fab-ai:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 32px rgba(22, 163, 74, 0.55);
}
.mc-fab-ai-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #4ade80;
  color: #052e16;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  letter-spacing: 0.04em;
}
.mc-fab-ai-tooltip {
  position: absolute;
  left: 68px;
  white-space: nowrap;
  background: #0f172a;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  transform: translateX(-6px);
}
.mc-fab-ai:hover .mc-fab-ai-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* Modal / Drawer Chatbot IA */
.mc-ai-modal {
  position: fixed;
  left: 24px;
  bottom: 92px;
  z-index: 460;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: mc-ai-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes mc-ai-pop {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.mc-ai-modal[hidden] {
  display: none !important;
}

.mc-ai-modal-head {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.mc-ai-agent-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mc-ai-agent-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  position: relative;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}
.mc-ai-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #0f172a;
}
.mc-ai-agent-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
}
.mc-ai-agent-sub {
  font-size: 10.5px;
  color: #94a3b8;
}
.mc-ai-close-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  font-size: 20px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.mc-ai-close-btn:hover { background: rgba(255, 255, 255, 0.25); }

.mc-ai-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.mc-ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: mc-wmsg-in 0.2s ease;
}
.mc-ai-msg--bot {
  align-self: flex-start;
}
.mc-ai-msg--user {
  align-self: flex-end;
}
.mc-ai-msg--bot .mc-ai-msg-content {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.mc-ai-msg--user .mc-ai-msg-content {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.2);
}

/* Suggestions chips */
.mc-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.mc-ai-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0369a1;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.mc-ai-chip:hover {
  background: #f0f9ff;
  border-color: #0284c7;
  transform: translateY(-1px);
}

/* Cartes de résultats */
.mc-ai-results-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}
.mc-ai-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.mc-ai-card-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 10px;
  background: #e0f2fe;
  color: #0369a1;
  display: inline-block;
  margin-bottom: 4px;
}
.mc-ai-card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
}
.mc-ai-card-cat {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 1px;
}
.mc-ai-card-detail {
  font-size: 11px;
  color: #334155;
  margin-top: 4px;
  line-height: 1.35;
}
.mc-ai-card-act {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #0284c7;
  text-decoration: none;
  transition: color 0.15s;
}
.mc-ai-card-act:hover {
  color: #0369a1;
  text-decoration: underline;
}

/* Typing */
.mc-ai-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  align-self: flex-start;
}
.mc-ai-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0284c7;
  animation: mc-ai-blink 1.4s infinite ease-in-out both;
}
.mc-ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.mc-ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes mc-ai-blink { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1.2); } }
.mc-ai-typing-lbl { font-size: 10.5px; color: #64748b; margin-left: 4px; }

/* Input footer */
.mc-ai-modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}
.mc-ai-input {
  flex: 1;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 12.5px;
  outline: none;
  color: #0f172a;
}
.mc-ai-input:focus {
  border-color: #0284c7;
  background: #ffffff;
}
.mc-ai-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0284c7;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.mc-ai-send-btn:hover { background: #0369a1; }

@media (max-width: 768px) {
  .mc-fab-ai {
    /* Mobile : côté droit, au-dessus de la tab bar, couleur verte */
    left: auto;
    right: 16px;
    bottom: 82px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #16a34a 0%, #064e3b 100%);
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.45);
  }
  .mc-fab-ai:hover {
    box-shadow: 0 10px 28px rgba(22, 163, 74, 0.6);
  }
  .mc-fab-ai-badge {
    background: #4ade80;
    color: #052e16;
  }
  .mc-fab-ai-tooltip {
    /* Sur mobile : tooltip au-dessus à gauche */
    left: auto;
    right: 58px;
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    white-space: nowrap;
  }
  .mc-fab-ai:hover .mc-fab-ai-tooltip {
    transform: translateY(-50%) translateX(0);
  }
  .mc-ai-modal {
    left: 12px;
    right: 12px;
    bottom: 134px;
    width: auto;
    max-width: none;
    height: 460px;
  }
}
