/* ============================================================
   Système de modal de confirmation réutilisable
   Remplace les confirm() et alert() natifs du navigateur.
   Design sombre, moderne, responsive, coins arrondis.
   ============================================================ */

/* Overlay (fond sombre semi-transparent) */
.cfm-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.cfm-overlay.cfm-show { opacity: 1; pointer-events: auto; }

/* Boîte du modal */
.cfm-box {
  background: linear-gradient(180deg, #1a1f2e 0%, #151926 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  max-width: 440px; width: 100%;
  padding: 0; overflow: hidden;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cfm-overlay.cfm-show .cfm-box { transform: scale(1) translateY(0); }

/* Bandeau coloré (dépend du variant) */
.cfm-bar { height: 4px; width: 100%; }
.cfm-bar.cfm-primary  { background: linear-gradient(90deg, #7c5cfc, #a78bfa); }
.cfm-bar.cfm-success   { background: linear-gradient(90deg, #22c55e, #4ade80); }
.cfm-bar.cfm-danger    { background: linear-gradient(90deg, #ef4444, #f87171); }
.cfm-bar.cfm-warning   { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.cfm-bar.cfm-info      { background: linear-gradient(90deg, #3b82f6, #60a5fa); }

/* Corps du modal */
.cfm-body { padding: 24px; }

.cfm-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%;
  margin-bottom: 16px; font-size: 22px;
}
.cfm-icon.cfm-primary  { background: rgba(124, 92, 252, 0.15); color: #a78bfa; }
.cfm-icon.cfm-success   { background: rgba(34, 197, 94, 0.15);  color: #4ade80; }
.cfm-icon.cfm-danger    { background: rgba(239, 68, 68, 0.15);  color: #f87171; }
.cfm-icon.cfm-warning   { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.cfm-icon.cfm-info      { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }

.cfm-title {
  font-size: 18px; font-weight: 700; color: #f1f5f9;
  margin: 0 0 8px 0; line-height: 1.35;
}
.cfm-message {
  font-size: 14px; color: #94a3b8; line-height: 1.5;
  margin: 0;
}
.cfm-message strong { color: #e2e8f0; }

/* Boutons */
.cfm-actions {
  display: flex; gap: 10px; margin-top: 24px;
  flex-direction: row;
}
.cfm-btn {
  flex: 1; padding: 10px 16px;
  border: none; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.cfm-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.cfm-btn-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.cfm-btn-cancel:hover { background: rgba(255, 255, 255, 0.12); }

.cfm-btn-confirm.cfm-primary  { background: #7c5cfc; color: #fff; }
.cfm-btn-confirm.cfm-primary:hover  { background: #6d4efb; }
.cfm-btn-confirm.cfm-success   { background: #22c55e; color: #fff; }
.cfm-btn-confirm.cfm-success:hover   { background: #16a34a; }
.cfm-btn-confirm.cfm-danger    { background: #ef4444; color: #fff; }
.cfm-btn-confirm.cfm-danger:hover    { background: #dc2626; }
.cfm-btn-confirm.cfm-warning   { background: #f59e0b; color: #1a1f2e; }
.cfm-btn-confirm.cfm-warning:hover   { background: #d97706; }
.cfm-btn-confirm.cfm-info      { background: #3b82f6; color: #fff; }
.cfm-btn-confirm.cfm-info:hover      { background: #2563eb; }

/* Spinner pendant le traitement */
.cfm-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cfm-spin 0.6s linear infinite;
}
@keyframes cfm-spin { to { transform: rotate(360deg); } }

/* Responsive mobile */
@media (max-width: 480px) {
  .cfm-box { max-width: calc(100vw - 32px); }
  .cfm-body { padding: 20px 16px; }
  .cfm-actions { flex-direction: column; }
  .cfm-btn { width: 100%; }
}
