/* =============================================================================
 * landing-multishop-digital.css — wizard produit digital (overlay landing).
 * Portage 1:1 de zic_admin_python/.../admin-multishop-digital-modal.css.
 * Namespacé .msd-* . Tokens locaux (le modal est monté sur <body>).
 * Diffs vs admin : z-index 400 → 4000 (au-dessus de .zh-mshop-overlay 1500,
 * sous l'auth-modal 9999), + .msd-modal--gated (masquage pendant le gate Stripe
 * de l'hôte, dont la modale vit DANS l'overlay z-1500).
 * Responsive : mobile < 700px (plein écran), tablette/desktop (carte centrée).
 * ============================================================================= */

.msd-modal {
  --msd-primary: #8d22ff;
  --msd-primary-dk: #6d28d9;
  --msd-primary-soft: #f3e8ff;
  --msd-bg: #f6f5fb;
  --msd-card: #ffffff;
  --msd-text: #111827;
  --msd-text-soft: #475569;
  --msd-text-muted: #94a3b8;
  --msd-border: #e5e7eb;
  --msd-border-strong: #cbd5e1;
  --msd-green: #10b981;
  --msd-amber: #f59e0b;
  --msd-red: #ef4444;
  --msd-radius: 16px;
  --msd-radius-sm: 10px;

  position: fixed;
  inset: 0;
  z-index: 4000; /* au-dessus de .zh-mshop-overlay (1500), sous l'auth-modal (9999) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: inherit;
}
.msd-modal[hidden] { display: none; }
/* Wizard masqué pendant le gate Stripe de l'hôte (sa modale est sous nous
 * dans l'empilement — on s'efface le temps de l'onboarding). */
.msd-modal--gated { visibility: hidden; pointer-events: none; }

.msd-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 4, 18, 0.55);
  backdrop-filter: blur(3px);
  cursor: pointer;
}

.msd-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  background: var(--msd-card);
  border-radius: 22px;
  box-shadow: 0 32px 64px rgba(15, 23, 42, 0.28);
  overflow: hidden;
  animation: msd-in 0.18s ease-out;
}
@keyframes msd-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- header ---------- */
.msd-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--msd-border);
}
.msd-head-title {
  font-weight: 800;
  font-size: 16px;
  color: var(--msd-text);
  margin: 0;
}
.msd-head-step {
  color: var(--msd-text-muted);
  font-weight: 600;
  font-size: 13px;
  margin-left: 2px;
}
.msd-head-spacer { flex: 1 1 auto; }
.msd-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--msd-border);
  background: var(--msd-bg);
  color: var(--msd-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.msd-close svg { width: 16px; height: 16px; }
.msd-close:hover { background: #eef0f5; }

/* ---------- body ---------- */
.msd-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.msd-step-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--msd-text-muted);
  margin: 0;
}
.msd-field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--msd-text-muted);
  margin-bottom: 6px;
}
.msd-input,
.msd-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 13px;
  border: 1px solid var(--msd-border);
  border-radius: var(--msd-radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--msd-text);
  outline: none;
  background: #fff;
}
.msd-textarea { resize: vertical; min-height: 74px; }
.msd-input:focus,
.msd-textarea:focus { border-color: var(--msd-primary); box-shadow: 0 0 0 3px rgba(141, 34, 255, 0.14); }
.msd-input.is-invalid,
.msd-textarea.is-invalid { border-color: var(--msd-red); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14); }
.msd-error-msg { color: var(--msd-red); font-size: 12px; margin: 6px 0 0; }

/* ---------- kind grid (étape 1) ---------- */
.msd-kind-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.msd-kind-card {
  text-align: left;
  padding: 14px;
  border-radius: 12px;
  background: #fafafb;
  border: 1px solid var(--msd-border);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.msd-kind-card:hover { border-color: var(--msd-border-strong); }
.msd-kind-card.is-selected {
  background: rgba(141, 34, 255, 0.05);
  border: 2px solid var(--msd-primary);
  padding: 13px; /* compense le +1px de bordure */
}
.msd-kind-emoji { font-size: 24px; margin-bottom: 6px; }
.msd-kind-name { font-weight: 800; font-size: 14px; color: var(--msd-text); }
.msd-kind-desc { font-size: 11.5px; color: var(--msd-text-muted); margin-top: 3px; line-height: 1.4; }

/* ---------- dropzone + fichiers ---------- */
.msd-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 18px;
  background: rgba(141, 34, 255, 0.04);
  border: 2px dashed rgba(141, 34, 255, 0.4);
  border-radius: 14px;
  cursor: pointer;
  text-align: center;
}
.msd-drop.is-dragover { background: var(--msd-primary-soft); border-color: var(--msd-primary); }
.msd-drop-icon {
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(135deg, var(--msd-primary), var(--msd-primary-dk));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.msd-drop-title { font-weight: 800; font-size: 14px; color: var(--msd-text); }
.msd-drop-hint { font-size: 11.5px; color: var(--msd-text-muted); margin-top: 2px; }

.msd-files { display: flex; flex-direction: column; gap: 8px; }
.msd-file {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--msd-bg);
  border: 1px solid var(--msd-border);
  border-radius: var(--msd-radius-sm);
}
.msd-file-ic { font-size: 18px; flex: 0 0 auto; }
.msd-file-main { flex: 1 1 auto; min-width: 0; }
.msd-file-name { font-weight: 700; font-size: 13px; color: var(--msd-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msd-file-sub { font-size: 11px; color: var(--msd-text-muted); margin-top: 2px; }
.msd-file-remove {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px;
  background: transparent; border: 1px solid var(--msd-border); color: var(--msd-red);
  cursor: pointer; font-size: 13px; line-height: 1;
}

/* progress */
.msd-progress { height: 6px; border-radius: 999px; background: #e9e5f5; overflow: hidden; margin-top: 6px; }
.msd-progress-bar { height: 100%; width: 0%; background: var(--msd-primary); transition: width 0.2s ease; }

/* badges statut média */
.msd-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
}
.msd-badge--processing { background: #fef3c7; color: #92660a; }
.msd-badge--ready { background: #dcfce7; color: #166534; }
.msd-badge--error { background: #fee2e2; color: #b91c1c; }
.msd-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.msd-badge--processing .msd-dot { animation: msd-pulse 1s ease-in-out infinite; }
@keyframes msd-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---------- leçons (masterclass) ---------- */
.msd-lessons { display: flex; flex-direction: column; gap: 8px; }
.msd-lesson {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--msd-bg);
  border: 1px solid var(--msd-border);
  border-radius: var(--msd-radius-sm);
}
.msd-lesson-idx {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 7px;
  background: var(--msd-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 11px;
}
.msd-lesson-title { flex: 1 1 auto; min-width: 0; border: none; outline: none; background: transparent; font-family: inherit; font-size: 13px; color: var(--msd-text); }
.msd-lesson-up {
  flex: 0 0 auto; padding: 5px 11px; border-radius: 7px;
  background: #fff; border: 1px solid var(--msd-border); color: var(--msd-primary);
  font-weight: 700; font-size: 11px; cursor: pointer;
}
.msd-lesson-up.is-ready { border-color: var(--msd-green); color: var(--msd-green); }
.msd-lesson-remove {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px;
  background: transparent; border: 1px solid var(--msd-border); color: var(--msd-red); cursor: pointer; font-size: 13px;
}
.msd-add-lesson {
  align-self: flex-start;
  padding: 9px 14px; border-radius: 9px;
  background: rgba(141, 34, 255, 0.05);
  border: 1px dashed rgba(141, 34, 255, 0.4);
  color: var(--msd-primary); font-weight: 700; font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}

/* ---------- prix + publication (étape 3) ---------- */
.msd-price-wrap {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px; border: 1px solid var(--msd-border); border-radius: var(--msd-radius-sm);
}
.msd-price-wrap.is-invalid { border-color: var(--msd-red); }
.msd-price-input { width: 90px; border: none; outline: none; padding: 12px 0; font-weight: 800; font-size: 16px; color: var(--msd-text); font-family: inherit; }
.msd-price-cur { color: var(--msd-text-muted); font-weight: 700; }

.msd-delivery-note {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: 11px;
  background: rgba(16, 185, 129, 0.06); border: 1px solid rgba(16, 185, 129, 0.2);
  font-size: 12.5px; color: var(--msd-text); line-height: 1.5;
}

.msd-pub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.msd-pub-card {
  text-align: left; padding: 12px 14px; border-radius: 11px;
  background: #fafafb; border: 1px solid var(--msd-border); cursor: pointer;
}
.msd-pub-card.is-selected { background: rgba(141, 34, 255, 0.05); border: 2px solid var(--msd-primary); padding: 11px 13px; }
.msd-pub-name { font-weight: 800; font-size: 13.5px; color: var(--msd-text); }
.msd-pub-desc { font-size: 11px; color: var(--msd-text-muted); margin-top: 2px; }
.msd-sched-row { display: flex; gap: 8px; margin-top: 10px; }
.msd-sched-row .msd-input { flex: 1 1 auto; }

/* ---------- footer ---------- */
.msd-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--msd-border);
}
.msd-foot-right { display: flex; gap: 8px; }
.msd-btn {
  padding: 11px 18px; border-radius: var(--msd-radius-sm);
  font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
  border: 1px solid transparent; display: inline-flex; align-items: center; gap: 8px;
}
.msd-btn--primary { background: var(--msd-primary); color: #fff; box-shadow: 0 6px 18px rgba(141, 34, 255, 0.26); }
.msd-btn--primary:hover:not(:disabled) { background: var(--msd-primary-dk); }
.msd-btn--ghost { background: var(--msd-bg); color: var(--msd-text-soft); border-color: var(--msd-border); }
.msd-btn--ghost:hover:not(:disabled) { background: #eef0f5; }
.msd-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.msd-spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff;
  animation: msd-spin 0.7s linear infinite;
}
.msd-btn--ghost .msd-spinner { border-color: rgba(17,24,39,0.25); border-top-color: var(--msd-text); }
@keyframes msd-spin { to { transform: rotate(360deg); } }

/* ---------- écran de confirmation ---------- */
.msd-done {
  padding: 44px 30px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.msd-done-check {
  width: 74px; height: 74px; border-radius: 50%;
  background: var(--msd-green); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 800;
}
.msd-done-title { font-weight: 800; font-size: 21px; color: var(--msd-text); margin: 0; }
.msd-done-text { font-size: 13px; color: var(--msd-text-muted); line-height: 1.5; max-width: 360px; margin: 0; }
.msd-done-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 13px; background: var(--msd-bg); border: 1px solid var(--msd-border);
  border-radius: 9px; font-family: monospace; font-size: 12px; color: var(--msd-text);
  text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msd-done-link:hover { border-color: var(--msd-primary); color: var(--msd-primary); }

/* ---------- responsive ---------- */
@media (max-width: 700px) {
  .msd-modal { padding: 0; align-items: stretch; }
  .msd-card { max-width: none; max-height: 100vh; height: 100vh; border-radius: 0; }
  .msd-kind-grid { grid-template-columns: 1fr; }
  .msd-pub-grid { grid-template-columns: 1fr; }
  .msd-sched-row { flex-direction: column; }
  .msd-foot { position: sticky; bottom: 0; background: var(--msd-card); }
}
@media (min-width: 701px) and (max-width: 1099px) {
  .msd-card { max-width: 600px; }
}
