/* MedCare — toasts & confirmations (remplace alert/confirm natifs) */

@keyframes medcareToastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes medcareToastOut {
  to { opacity: 0; transform: translateY(6px) scale(0.96); }
}
@media (prefers-reduced-motion: reduce) {
  .medcare-toast-stack .medcare-toast,
  .medcare-confirm-dialog { animation: none; }
}

#medcare-toast-stack.medcare-toast-stack {
  position: fixed;
  z-index: 10050;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.5rem;
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: min(80vh, 28rem);
  overflow-y: auto;
  padding: 0;
  pointer-events: none;
  box-sizing: border-box;
}

.medcare-toast-stack .medcare-toast {
  animation: medcareToastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  pointer-events: auto;
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 0.75rem;
  border-radius: 1rem;
  border: 1px solid #f3f4f6;
  border-left-width: 3px;
  background: rgba(255, 255, 255, 0.96);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.375;
  color: #1f2937;
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.12), 0 4px 12px -4px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px);
  box-sizing: border-box;
}

.medcare-toast--success { border-left-color: var(--mc-accent); }
.medcare-toast--error { border-left-color: #ef4444; }
.medcare-toast--warning { border-left-color: #f59e0b; }
.medcare-toast--info { border-left-color: var(--mc-navy, #123a63); }
.medcare-toast__icon { margin-top: 0.125rem; flex-shrink: 0; }
.medcare-toast__text { min-width: 0; flex: 1; margin: 0; }
.medcare-toast__close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  border-radius: 0.5rem;
  padding: 0.25rem;
  color: #9ca3af;
  cursor: pointer;
  line-height: 0;
}
.medcare-toast__close:hover { background: #f3f4f6; color: #4b5563; }
.medcare-toast--success .medcare-toast__icon { color: var(--mc-accent, #4fa3c7); }
.medcare-toast--error .medcare-toast__icon { color: #dc2626; }
.medcare-toast--warning .medcare-toast__icon { color: #d97706; }
.medcare-toast--info .medcare-toast__icon { color: var(--mc-navy, #123a63); }
.medcare-toast__icon svg { display: block; }

/* ─── Confirmation ─────────────────────────────────────────── */
.medcare-confirm-root {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}

.medcare-confirm-root.is-open {
  opacity: 1;
  visibility: visible;
}

.medcare-confirm-dialog {
  width: 100%;
  max-width: 24rem;
  margin: 0;
  background: #fff;
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.28);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.medcare-confirm-root.is-open .medcare-confirm-dialog {
  transform: translateY(0) scale(1);
}

.medcare-confirm-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fef3c7;
  color: #d97706;
  margin-bottom: 0.875rem;
}

.medcare-confirm-title {
  font-family: Syne, ui-sans-serif, system-ui, sans-serif;
  font-size: 1.0625rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.375rem;
}

.medcare-confirm-message {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #4b5563;
  margin: 0 0 1.25rem;
}

.medcare-confirm-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .medcare-confirm-actions {
    flex-direction: row;
    justify-content: flex-end;
  }
}

.medcare-confirm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.125rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s;
}

.medcare-confirm-btn:active { transform: scale(0.98); }

.medcare-confirm-btn--cancel {
  background: #f3f4f6;
  color: #374151;
}
.medcare-confirm-btn--cancel:hover { background: #e5e7eb; }

.medcare-confirm-btn--ok {
  background: var(--mc-accent, #4fa3c7);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 163, 199, 0.35);
}
.medcare-confirm-btn--ok:hover { background: var(--mc-accent-dark, #3d8fb3); }

.medcare-confirm-btn--danger {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}
.medcare-confirm-btn--danger:hover { background: #b91c1c; }
