/* ============================================================================
 * manage.css - Outil "Rank / Demote" sur l'annuaire /staff.
 * DA : reprend les tokens de staff/style.css (near-black #070709, accent #A78BFF,
 * bordures fines). Boutons icones discrets sur les cartes + mini-fenetre sobre.
 * ========================================================================== */

/* ── Boutons d'action sur une carte ── */
.staff-dir .card.smng-has-actions { position: relative; }
.smng-actions-bar {
  position: absolute; top: 10px; right: 10px;
  display: flex; gap: 6px; z-index: 4;
  opacity: 0; transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
}
.staff-dir .card:hover .smng-actions-bar,
.staff-dir .card:focus-within .smng-actions-bar { opacity: 1; transform: none; }
/* Tactile : toujours visibles (pas de hover) */
@media (hover: none) { .smng-actions-bar { opacity: 1; transform: none; } }

.smng-act {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; cursor: pointer;
  color: var(--ink, #f2f2f6);
  background: rgba(10, 10, 14, .72);
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .12s ease;
}
.smng-act svg { width: 17px; height: 17px; }
.smng-act:hover { transform: translateY(-1px); }
.smng-act.rank:hover { border-color: var(--accent, #a78bff); color: var(--accent, #a78bff); background: rgba(var(--accent-rgb, 167, 139, 255), .14); }
.smng-act.demote:hover { border-color: #ff5468; color: #ff6274; background: rgba(255, 84, 104, .14); }
.smng-act.mail:hover { border-color: #4aa3ff; color: #6bb6ff; background: rgba(74, 163, 255, .14); }
.smng-act:focus-visible { outline: 2px solid var(--accent, #a78bff); outline-offset: 2px; }

/* Carte "retiree" (apres demote) */
.staff-dir .card.smng-removed { opacity: .4; filter: grayscale(.7); pointer-events: none; }

/* ── Mini-fenetre (modale) ── */
.smng-backdrop {
  position: fixed; inset: 0; z-index: 100000;
  display: grid; place-items: center; padding: 20px;
  background: rgba(4, 4, 7, .74);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden; transition: opacity .28s ease, visibility .28s ease;
}
.smng-backdrop.open { opacity: 1; visibility: visible; }

.smng-modal {
  position: relative; width: min(460px, 94vw); max-height: 88vh; overflow-y: auto;
  padding: 26px 24px 22px;
  border-radius: 20px;
  background: #0d0d13;
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 40px 90px rgba(0, 0, 0, .6);
  color: var(--ink, #f2f2f6);
  font-family: 'Archivo', system-ui, -apple-system, sans-serif;
  transform: translateY(14px) scale(.985);
  transition: transform .32s cubic-bezier(.22, 1, .36, 1);
}
.smng-backdrop.open .smng-modal { transform: none; }

.smng-close, .smng-back {
  position: absolute; top: 14px; width: 34px; height: 34px;
  display: grid; place-items: center; border-radius: 9px; cursor: pointer;
  color: var(--ink-2, #9c9cab); background: transparent;
  border: 1px solid var(--line, rgba(255, 255, 255, .1));
  transition: color .15s ease, border-color .15s ease, transform .15s ease;
}
.smng-close { right: 14px; }
.smng-back { left: 14px; }
.smng-close svg, .smng-back svg { width: 17px; height: 17px; }
.smng-close:hover { color: #fff; border-color: rgba(255, 255, 255, .3); transform: rotate(90deg); }
.smng-back:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }

.smng-head { text-align: center; padding: 6px 34px 14px; }
.smng-title { font-family: 'Archivo Expanded', 'Archivo', sans-serif; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.smng-sub { margin-top: 4px; }

.smng-target { display: flex; align-items: center; gap: 11px; justify-content: center; margin-top: 12px; }
.smng-target img { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line, rgba(255, 255, 255, .12)); object-fit: cover; }
.smng-target > div { display: flex; flex-direction: column; text-align: left; }
.smng-target b { font-size: 14.5px; }
.smng-target span { font-size: 12px; color: var(--ink-2, #9c9cab); }

.smng-step-lbl { font-size: 12.5px; color: var(--ink-2, #9c9cab); text-align: center; margin: 2px 0 14px; }

/* ── Choix (pole / grade) ── */
.smng-choices { display: flex; flex-direction: column; gap: 8px; }
.smng-choice {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 13px 14px; cursor: pointer; text-align: left;
  border-radius: 13px; color: var(--ink, #f2f2f6);
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--line, rgba(255, 255, 255, .09));
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
  font-size: 15px; font-weight: 600;
}
.smng-choice:hover { background: rgba(255, 255, 255, .07); border-color: color-mix(in srgb, var(--pc, #a78bff) 55%, transparent); transform: translateX(2px); }
.smng-choice:focus-visible { outline: 2px solid var(--pc, #a78bff); outline-offset: 2px; }
.smng-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--pc, #a78bff); flex: 0 0 auto; box-shadow: 0 0 10px color-mix(in srgb, var(--pc, #a78bff) 60%, transparent); }
.smng-choice-ic { width: 22px; height: 22px; color: var(--pc, #a78bff); flex: 0 0 auto; }
.smng-choice-ic svg { width: 22px; height: 22px; }
.smng-choice-lbl { flex: 1 1 auto; }
.smng-choice-arr { color: var(--ink-2, #9c9cab); font-size: 16px; }

/* ── Recap / confirmation ── */
.smng-recap { display: flex; flex-direction: column; gap: 1px; margin: 4px 0 4px; border: 1px solid var(--line, rgba(255, 255, 255, .1)); border-radius: 13px; overflow: hidden; }
.smng-recap-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; background: rgba(255, 255, 255, .025); }
.smng-recap-row span { color: var(--ink-2, #9c9cab); font-size: 13px; }
.smng-recap-row b { font-size: 14.5px; }
.smng-note { color: var(--ink-2, #9c9cab); font-size: 12.5px; text-align: center; margin: 12px 4px 4px; line-height: 1.5; }

/* ── Apercu des roles staff finaux (ecran de confirmation) ── */
.smng-roleset { margin: 12px 2px 2px; }
.smng-roleset-lbl {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; font-weight: 700;
  color: var(--ink-2, #9c9cab); margin: 0 2px 8px;
}
.smng-roleset-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.smng-role-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
  font-size: 12px; font-weight: 600; line-height: 1;
  color: var(--ink, #f2f2f6);
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--line, rgba(255, 255, 255, .1));
}
.smng-role-chip.pole { border-color: color-mix(in srgb, var(--pc, #a78bff) 45%, transparent); }
.smng-role-chip.pole::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--pc, #a78bff);
  box-shadow: 0 0 8px color-mix(in srgb, var(--pc, #a78bff) 65%, transparent);
}
.smng-role-chip.perm { color: #ded2ff; background: rgba(167, 139, 255, .13); border-color: rgba(167, 139, 255, .34); }

/* ── Switch "Transferer le poste entier" (ecran de confirmation) ── */
.smng-switch {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0 2px; padding: 11px 13px; border-radius: 13px; cursor: pointer;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line, rgba(255, 255, 255, .1));
  transition: border-color .16s ease, background .16s ease;
}
.smng-switch:hover { border-color: rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .05); }
.smng-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.smng-switch-track {
  position: relative; flex: 0 0 auto; width: 42px; height: 24px; border-radius: 999px;
  background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .1);
  transition: background .2s ease, border-color .2s ease;
}
.smng-switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #f2f2f6; box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  transition: transform .22s cubic-bezier(.22, 1, .36, 1);
}
.smng-switch input:checked + .smng-switch-track { background: var(--accent, #a78bff); border-color: transparent; }
.smng-switch input:checked + .smng-switch-track .smng-switch-thumb { transform: translateX(18px); }
.smng-switch input:focus-visible + .smng-switch-track { outline: 2px solid var(--accent, #a78bff); outline-offset: 2px; }
.smng-switch-txt { display: flex; flex-direction: column; gap: 2px; }
.smng-switch-txt b { font-size: 13.5px; font-weight: 700; }
.smng-switch-txt span { font-size: 11.5px; color: var(--ink-2, #9c9cab); line-height: 1.4; }

.smng-danger { display: flex; gap: 11px; align-items: flex-start; margin: 6px 0 2px; padding: 13px 14px; border-radius: 13px; background: rgba(255, 84, 104, .09); border: 1px solid rgba(255, 84, 104, .28); font-size: 13.5px; line-height: 1.5; color: #ffd7dc; }
.smng-danger svg { width: 22px; height: 22px; color: #ff6274; flex: 0 0 auto; margin-top: 1px; }

/* ── Boutons d'action de la modale ── */
.smng-actions { display: flex; gap: 10px; margin-top: 18px; }
.smng-btn {
  flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 16px; border-radius: 12px; cursor: pointer; font-size: 14.5px; font-weight: 700;
  border: 1px solid transparent; transition: transform .12s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
}
.smng-btn svg { width: 17px; height: 17px; }
.smng-btn:hover { transform: translateY(-1px); }
.smng-btn.primary { background: var(--accent, #a78bff); color: #0b0b10; }
.smng-btn.primary:hover { background: #b7a2ff; }
.smng-btn.danger { background: #ff4d62; color: #fff; }
.smng-btn.danger:hover { background: #ff6274; }
.smng-btn.ghost { background: transparent; color: var(--ink, #f2f2f6); border-color: var(--line, rgba(255, 255, 255, .16)); }
.smng-btn.ghost:hover { border-color: rgba(255, 255, 255, .32); }
.smng-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ── Courrier (zone de saisie du message prive) ── */
.smng-textarea {
  width: 100%; margin-top: 12px; padding: 12px 13px; box-sizing: border-box;
  min-height: 122px; resize: vertical;
  border-radius: 13px; color: var(--ink, #f2f2f6);
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  font-family: 'Archivo', system-ui, -apple-system, sans-serif; font-size: 14.5px; line-height: 1.55;
  transition: border-color .15s ease, background .15s ease;
}
.smng-textarea:focus { outline: none; border-color: var(--accent, #a78bff); background: rgba(255, 255, 255, .06); }
.smng-textarea::placeholder { color: var(--ink-2, #9c9cab); }
.smng-charcount { text-align: right; font-size: 12px; color: var(--ink-2, #9c9cab); margin-top: 6px; }

/* ── Etiquettes (vignettes) du courrier ── */
.smng-tags-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; font-weight: 700; color: var(--ink-2, #9c9cab); margin: 12px 2px 8px; }
.smng-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.smng-tag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 700; line-height: 1; color: var(--ink, #f2f2f6);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line, rgba(255, 255, 255, .12));
  transition: background .14s ease, border-color .14s ease, transform .1s ease;
}
.smng-tag-emo { font-size: 14px; line-height: 1; }
.smng-tag:hover { border-color: rgba(255, 255, 255, .3); transform: translateY(-1px); }
.smng-tag.active { background: rgba(var(--accent-rgb, 167, 139, 255), .16); border-color: var(--accent, #a78bff); color: #fff; }
.smng-tag:focus-visible { outline: 2px solid var(--accent, #a78bff); outline-offset: 2px; }

/* ── Etats busy / result ── */
.smng-busy { text-align: center; padding: 26px 10px; }
.smng-busy p { color: var(--ink-2, #9c9cab); margin-top: 14px; font-size: 14px; }
.smng-spin { width: 30px; height: 30px; display: inline-block; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .14); border-top-color: var(--accent, #a78bff); animation: smng-spin .8s linear infinite; }
@keyframes smng-spin { to { transform: rotate(360deg); } }

.smng-result { text-align: center; padding: 12px 6px 6px; }
.smng-result p { line-height: 1.55; margin: 4px 0; }
.smng-result-ic { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; }
.smng-result-ic svg { width: 26px; height: 26px; }
.smng-result.ok .smng-result-ic { background: rgba(42, 143, 56, .16); border: 1px solid rgba(42, 143, 56, .4); color: #4fd06a; }
.smng-result.err .smng-result-ic { background: rgba(255, 84, 104, .14); border: 1px solid rgba(255, 84, 104, .36); color: #ff6274; }

@media (prefers-reduced-motion: reduce) {
  .smng-backdrop, .smng-modal, .smng-actions-bar, .smng-choice, .smng-btn, .smng-act { transition: none; }
  .smng-spin { animation-duration: 1.4s; }
}
