/* ===========================================================================
   magic-forms.css — Systeme visuel unifie pour les panneaux form-heavy de Magic.
   Pattern etabli dans AutoComposer (2026-04-22) et extrait pour reutilisation
   dans Phoenix, Cluster, AutoPilot, Settings, etc.

   Convention : prefixe .mg-* pour eviter tout conflit avec Tailwind, automation.css
   ou les classes existantes. Non-scope : ces classes fonctionnent dans n'importe
   quel conteneur.

   Inclure via <link> :
     <link rel="stylesheet" href="assets/css/magic-forms.css?v=<filemtime>">

   =========================================================================== */

/* ─── Sections en carte (fond gris clair, bordure sobre) ─── */
.mg-section {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: #fafbfc;
  border: 1px solid var(--w-line);
  border-radius: var(--w-r-sm);
}
.mg-section-title {
  font-weight: 700;
  font-size: 11px;
  color: #475569;
  margin: 0 0 10px 0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mg-section-title .mg-hint {
  font-weight: 400;
  font-size: 10px;
  color: #94a3b8;
  letter-spacing: 0;
  text-transform: none;
  font-style: italic;
  margin-left: auto;
}

/* ─── Labels de champ (remplace les inline font-weight:700;font-size:12px;color:#374151) ─── */
.mg-label {
  font-weight: 600;
  font-size: 12px;
  color: #475569;
  display: block;
  margin-bottom: 4px;
}
.mg-label-row {
  font-weight: 600;
  font-size: 12px;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.mg-label-hint {
  font-weight: 400;
  color: #94a3b8;
  font-style: italic;
  margin-left: 4px;
  font-size: 11px;
}

/* ─── Rangees de checkboxes (flex wrap, espacement homogene) ─── */
.mg-cb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 16px;
}
.mg-cb-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}

/* ─── Cards accentuees (EEAT jaune, SEO indigo, Sources violet, Success vert, Warning ambre) ─── */
.mg-accent-card {
  margin-top: 0;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: var(--w-r-sm);
}
.mg-accent-eeat {
  background: #fffbeb;
  border-color: #fcd34d;
}
.mg-accent-eeat .mg-section-title { color: #92400e; }
.mg-accent-eeat .mg-label { color: #92400e; font-weight: 700; font-size: 11px; }
.mg-accent-eeat textarea { border-color: #fcd34d; font-size: 12px; }

.mg-accent-seo {
  background: #eef2ff;
  border-color: #c7d2fe;
}
.mg-accent-seo .mg-section-title { color: #3730a3; }
.mg-accent-seo .mg-label { color: #3730a3; font-weight: 700; font-size: 11px; }
.mg-accent-seo textarea { border-color: #a5b4fc; font-size: 12px; }

.mg-accent-violet {
  background: linear-gradient(135deg, #faf5ff 0%, #fafbfc 60%);
  border-color: #e9d5ff;
}
.mg-accent-violet .mg-section-title { color: #7c3aed; }

.mg-accent-success {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.mg-accent-success .mg-section-title { color: #065f46; }
.mg-accent-success .mg-label { color: #065f46; font-weight: 700; font-size: 11px; }

.mg-accent-warning {
  background: #fef3c7;
  border-color: #fde68a;
}
.mg-accent-warning .mg-section-title { color: #78350f; }

/* ─── Cards de modes (exclusion mutuelle, radio-like sur checkboxes) ─── */
.mg-mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mg-mode-card {
  padding: 10px 12px;
  background: white;
  border: 2px solid var(--w-line);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: border-color 0.15s, background 0.15s;
  margin: 0;
}
.mg-mode-card:hover { border-color: #c4b5fd; }
.mg-mode-card.is-checked {
  border-color: #a855f7;
  background: #faf5ff;
}
.mg-mode-card input[type="checkbox"],
.mg-mode-card input[type="radio"] {
  margin-top: 3px;
  flex-shrink: 0;
}
.mg-mode-card .mg-mode-title {
  font-weight: 600;
  font-size: 13px;
  color: #1f2937;
  display: block;
}
.mg-mode-card .mg-mode-desc {
  font-size: 11px;
  color: #6b7280;
  margin-top: 3px;
  display: block;
  line-height: 1.4;
}

/* ─── Sub-sections (cards internes a une section principale) ─── */
.mg-subsection {
  margin-top: 10px;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--w-line);
  border-radius: 6px;
}

/* ─── Grid helpers ─── */
.mg-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mg-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.mg-grid-auto { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.mg-stack { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 768px) {
  .mg-grid-2, .mg-grid-3 { grid-template-columns: 1fr; }
  .mg-mode-cards { grid-template-columns: 1fr; }
}

/* ─── Entetes de card ─── */
.mg-card-title {
  font-weight: 800;
  font-size: 1rem;
  color: #1e293b;
  margin: 0;
}
.mg-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
  flex-wrap: wrap;
}
.mg-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ─── Segmented control (Un / Plusieurs articles, etc.) ─── */
.mg-mode-switch {
  display: inline-flex;
  border: 2px solid var(--w-line);
  border-radius: 6px;
  overflow: hidden;
}
.mg-mode-switch-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  background: #fff;
  color: #64748b;
}
.mg-mode-switch-btn.is-active {
  background: #7c3aed;
  color: #fff;
}

/* ─── Bouton neobrutalist (accent jaune, ombre portee) ─── */
.mg-btn-neo {
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 800;
  border: 2px solid #000;
  border-radius: var(--w-r-xs);
  cursor: pointer;
  background: #fbbf24;
  color: #000;
  box-shadow: 3px 3px 0 #000;
  transition: transform 0.1s, box-shadow 0.1s;
}
.mg-btn-neo:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #000;
}
.mg-btn-neo:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
}
.mg-btn-neo:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
}

/* ─── Toggles inline (checkbox + label compacts) ─── */
.mg-inline-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #64748b;
  cursor: pointer;
}

/* ─── Sub-tabs nav (onglets internes a un panneau) ─── */
.mg-sub-tabs-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--w-line);
  padding-bottom: 8px;
}
.mg-sub-tab {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: #64748b;
  transition: color 0.15s;
}
.mg-sub-tab:hover { color: #334155; }
.mg-sub-tab.active {
  color: #7c3aed;
  border-bottom-color: #7c3aed;
}

/* ─── Callouts (info violet, warning ambre, tip vert) ─── */
.mg-callout {
  padding: 10px 12px;
  border-left: 3px solid #a855f7;
  background: #faf5ff;
  border-radius: 0 4px 4px 0;
  margin: 10px 0;
  font-size: 12.5px;
}
.mg-callout strong { color: #7c3aed; }
.mg-callout-warn {
  padding: 10px 12px;
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
  border-radius: 0 4px 4px 0;
  margin: 10px 0;
  font-size: 12.5px;
  color: #78350f;
}
.mg-callout-tip {
  padding: 10px 12px;
  border-left: 3px solid #10b981;
  background: #ecfdf5;
  border-radius: 0 4px 4px 0;
  margin: 10px 0;
  font-size: 12.5px;
  color: #065f46;
}

/* ─── Inputs & textareas de base (homogeneite avec form-input existant) ─── */
.mg-input,
.mg-select,
.mg-textarea {
  width: 100%;
  padding: 7px 10px;
  border: 2px solid var(--w-line);
  border-radius: var(--w-r-xs);
  font-size: 13px;
  font-family: inherit;
  background: white;
  color: #1e293b;
  transition: border-color 0.15s;
}
.mg-input:focus,
.mg-select:focus,
.mg-textarea:focus {
  outline: none;
  border-color: #a78bfa;
}
.mg-textarea { min-height: 80px; resize: vertical; }
.mg-textarea.mg-mono { font-family: ui-monospace, 'Courier New', monospace; font-size: 12px; line-height: 1.6; }
