/* =============================================================================
 * ux_feedback.css — F-264 (2026-05-15) — Système commun feedback UX pour
 * tous les boutons LLM-bloquants (matérialiser, décomposer, créer brief, etc.)
 *
 * Composants visuels :
 *   - Toast notifications (bottom-right, slide-in, dismiss auto)
 *   - Loader spinner sur les boutons
 *   - Progress bar par étape (multi-step long actions)
 *   - Modal HTML riche (replace confirm() native)
 *
 * API JS dans : /seo-cockpit/static/js/ux_feedback.js (window.UX)
 * ============================================================================= */

/* ==== Toast notifications ==================================================== */

.ux-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 420px;
}

.ux-toast {
  pointer-events: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.15);
  padding: 14px 18px;
  font-size: 13.5px;
  color: #2c3e50;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 280px;
  border-left: 4px solid #95a5a6;
  animation: ux-toast-in 0.25s ease-out;
  opacity: 1;
  transition: opacity 0.3s, transform 0.3s;
}
.ux-toast.ux-toast-leaving {
  opacity: 0;
  transform: translateX(40px);
}

.ux-toast.info    { border-left-color: #3498db; }
.ux-toast.success { border-left-color: #27ae60; }
.ux-toast.warning { border-left-color: #f39c12; }
.ux-toast.error   { border-left-color: #e74c3c; }
.ux-toast.loading { border-left-color: #9b59b6; }

.ux-toast-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: -2px;
  width: 22px;
  text-align: center;
}
.ux-toast-icon.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid #d5dbe0;
  border-top-color: #9b59b6;
  border-radius: 50%;
  animation: ux-spin 0.7s linear infinite;
}

.ux-toast-body { flex: 1; line-height: 1.45; }
.ux-toast-title { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.ux-toast-msg { color: #566573; font-size: 12.5px; }
.ux-toast-meta { color: #95a5a6; font-size: 11px; margin-top: 4px; font-style: italic; }

.ux-toast-close {
  cursor: pointer;
  color: #bdc3c7;
  font-size: 16px;
  line-height: 1;
  background: none;
  border: none;
  padding: 0 0 0 6px;
  flex-shrink: 0;
}
.ux-toast-close:hover { color: #7f8c8d; }

@keyframes ux-toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes ux-spin {
  to { transform: rotate(360deg); }
}

/* ==== Loader spinner sur bouton ============================================= */

.ux-btn-busy {
  pointer-events: none;
  opacity: 0.85;
  position: relative;
}
.ux-btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: ux-spin 0.7s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

/* ==== Progress bar par étape (multi-step) =================================== */

.ux-progress-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100000;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  padding: 14px 18px;
  min-width: 320px;
  max-width: 460px;
  font-size: 13px;
  color: #2c3e50;
  border-left: 4px solid #9b59b6;
  animation: ux-toast-in 0.25s ease-out;
}
.ux-progress-title {
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ux-progress-title .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #d5dbe0;
  border-top-color: #9b59b6;
  border-radius: 50%;
  animation: ux-spin 0.7s linear infinite;
}

.ux-progress-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ux-progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #95a5a6;
  transition: color 0.3s;
}
.ux-progress-step.active {
  color: #2c3e50;
  font-weight: 500;
}
.ux-progress-step.done {
  color: #27ae60;
}
.ux-progress-step.failed {
  color: #c0392b;
  font-weight: 500;
}
.ux-progress-step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ecf0f1;
  color: #bdc3c7;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.ux-progress-step.active .ux-progress-step-icon {
  background: #ebdef0;
  color: #9b59b6;
  animation: ux-pulse 1.4s infinite;
}
.ux-progress-step.done .ux-progress-step-icon {
  background: #d5f5e3;
  color: #27ae60;
}
.ux-progress-step.failed .ux-progress-step-icon {
  background: #fadbd8;
  color: #c0392b;
}

.ux-progress-step-label { flex: 1; }
.ux-progress-step-meta { font-size: 11px; color: #95a5a6; font-style: italic; }

@keyframes ux-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* ==== Modal HTML riche ====================================================== */

.ux-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ux-modal-fade 0.2s ease-out;
}

@keyframes ux-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.ux-modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.3);
  max-width: 580px;
  width: 92%;
  max-height: 84vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: ux-modal-pop 0.2s ease-out;
}

@keyframes ux-modal-pop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.ux-modal-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid #ecf0f1;
}
.ux-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ux-modal-subtitle {
  margin-top: 6px;
  font-size: 12.5px;
  color: #7f8c8d;
}

.ux-modal-body {
  padding: 16px 22px;
  overflow-y: auto;
  font-size: 13px;
  color: #2c3e50;
  line-height: 1.55;
}
.ux-modal-body .ux-section {
  margin-bottom: 14px;
}
.ux-modal-body .ux-section-label {
  font-size: 11px;
  font-weight: 600;
  color: #7f8c8d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.ux-modal-body .ux-section-value {
  font-size: 13px;
  color: #2c3e50;
}
.ux-modal-body code {
  background: #f4f6f9;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
  color: #2c3e50;
}
.ux-modal-body .ux-rationale {
  background: #f8f9fb;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  color: #34495e;
  font-style: italic;
  border-left: 3px solid #bdc3c7;
}
.ux-modal-body .ux-confidence-bar {
  height: 8px;
  background: #ecf0f1;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}
.ux-modal-body .ux-confidence-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.ux-modal-body .ux-confidence-bar-fill.high { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.ux-modal-body .ux-confidence-bar-fill.medium { background: linear-gradient(90deg, #f39c12, #f1c40f); }
.ux-modal-body .ux-confidence-bar-fill.low { background: linear-gradient(90deg, #e74c3c, #c0392b); }

.ux-modal-footer {
  padding: 14px 22px;
  border-top: 1px solid #ecf0f1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.ux-modal-footer .ux-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, transform 0.1s;
}
.ux-modal-footer .ux-btn:active { transform: translateY(1px); }

.ux-btn.primary  { background: #3498db; color: #fff; }
.ux-btn.primary:hover  { background: #2980b9; }
.ux-btn.success  { background: #27ae60; color: #fff; }
.ux-btn.success:hover  { background: #229954; }
.ux-btn.warning  { background: #f39c12; color: #fff; }
.ux-btn.warning:hover  { background: #d68910; }
.ux-btn.danger   { background: #e74c3c; color: #fff; }
.ux-btn.danger:hover   { background: #c0392b; }
.ux-btn.secondary { background: #fff; color: #7f8c8d; border-color: #bdc3c7; }
.ux-btn.secondary:hover { background: #f4f6f9; color: #2c3e50; }
