/* =============================================================
   FaceHOOK School — Espace admin (constructeur de cours)
   S'appuie sur ../style.css + school.css (mêmes tokens).
   ============================================================= */

.adm { padding-top: var(--header-h); min-height: 100vh; }

/* Barre d'actions */
.adm-bar {
  position: sticky; top: var(--header-h); z-index: 40;
  background: rgba(2,8,23,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); padding: 12px 0;
}
.adm-bar__inner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.adm-bar h1 { font-size: 1.1rem; color: var(--ink); margin-right: auto; }
.adm-bar .badge-soft { font-size: .72rem; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: var(--surface-glass); border: 1px solid var(--border); }

/* Layout deux colonnes */
.adm-grid { display: grid; grid-template-columns: 1fr; gap: 22px; padding: 22px 0 80px; }
@media (min-width: 920px) { .adm-grid { grid-template-columns: 300px 1fr; align-items: start; } }

/* Colonne liste des cours */
.adm-side { border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); overflow: hidden; }
.adm-side__head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.adm-side__head h2 { font-size: .95rem; color: var(--ink); }
.adm-courses { display: flex; flex-direction: column; padding: 8px; gap: 4px; max-height: 60vh; overflow: auto; }
.adm-course-item {
  text-align: left; font: inherit; cursor: pointer; width: 100%;
  background: none; border: 1px solid transparent; border-radius: 10px;
  padding: 11px 12px; color: var(--text); display: flex; align-items: center; gap: 10px; transition: .15s;
}
.adm-course-item:hover { background: var(--surface-glass); }
.adm-course-item.is-active { background: rgba(24,119,242,.14); border-color: var(--border-brand); color: #fff; }
.adm-course-item__dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.adm-course-item__t { flex: 1; min-width: 0; font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-course-item__n { font-size: .72rem; color: var(--muted); }

/* statuts */
.pill { font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; letter-spacing: .02em; }
.pill--draft { background: rgba(244,183,64,.14); color: var(--gold); border: 1px solid rgba(244,183,64,.3); }
.pill--pub   { background: rgba(16,185,129,.14); color: var(--green-light); border: 1px solid rgba(16,185,129,.3); }

/* Éditeur */
.adm-main { display: flex; flex-direction: column; gap: 18px; }
.adm-panel { border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); padding: 18px; }
.adm-panel__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.adm-panel__head h2 { font-size: 1.05rem; color: var(--ink); margin-right: auto; }

/* Formulaire */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--text); }
.field input, .field select, .field textarea {
  font: inherit; font-size: .92rem; color: var(--ink);
  background: var(--surface-glass); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--border-active); }
.field textarea { resize: vertical; min-height: 80px; }
.field select option { background: var(--bg-3); color: var(--ink); }
.field--row { flex-direction: row; gap: 14px; }
.field--row > * { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }

/* toggle */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .88rem; color: var(--text); }
.switch input { display: none; }
.switch__track { width: 42px; height: 24px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); position: relative; transition: .2s; flex: 0 0 auto; }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + .switch__track { background: var(--green); border-color: transparent; }
.switch input:checked + .switch__track::after { transform: translateX(18px); }

/* Modules */
.adm-module { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; overflow: hidden; background: var(--surface-glass); }
.adm-module__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface-2); }
.adm-module__grip { color: var(--muted); cursor: default; }
.adm-module__title { flex: 1; min-width: 0; font: inherit; font-weight: 700; font-size: .95rem; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; }
.adm-module__title:hover { border-color: var(--border); }
.adm-module__title:focus { outline: none; border-color: var(--border-active); background: var(--bg-3); }
.adm-module__count { font-size: .74rem; color: var(--muted); white-space: nowrap; }

/* Leçons */
.adm-lessons { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.adm-lesson {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--border);
}
.adm-lesson__type { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-2); color: var(--blue-pale); }
.adm-lesson__main { flex: 1; min-width: 0; }
.adm-lesson__t { font-size: .9rem; color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-lesson__m { font-size: .74rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.adm-lesson__actions { display: flex; gap: 4px; flex: 0 0 auto; }

/* mini boutons icônes */
.iconbtn {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; cursor: pointer;
  background: var(--surface-glass); border: 1px solid var(--border); color: var(--text); transition: .15s;
}
.iconbtn:hover { border-color: var(--border-active); color: #fff; }
.iconbtn--danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(239,68,68,.1); }
.iconbtn svg { width: 16px; height: 16px; }
.iconbtn:disabled { opacity: .3; cursor: not-allowed; }

.adm-empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.adm-empty svg { width: 46px; height: 46px; color: var(--border-strong); margin-bottom: 14px; }

.btn--sm { padding: 9px 14px; font-size: .85rem; }

/* =============================================================
   MODALE
   ============================================================= */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.is-open { display: block; }
.modal__overlay { position: absolute; inset: 0; background: rgba(1,4,13,.7); backdrop-filter: blur(4px); }
.modal__box {
  position: relative; z-index: 1; width: min(560px, 92vw); margin: 8vh auto 0;
  background: var(--bg-3); border: 1px solid var(--border-strong); border-radius: 18px;
  box-shadow: var(--shadow); max-height: 84vh; overflow: auto;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-3); }
.modal__head h3 { font-size: 1.1rem; color: var(--ink); }
.modal__body { padding: 20px; }
.modal__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--bg-3); }

/* aperçu vignette YouTube */
.yt-preview { margin-top: 10px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 16/9; background: var(--surface-2); display: none; }
.yt-preview.is-on { display: block; }
.yt-preview img { width: 100%; height: 100%; object-fit: cover; }

/* toast */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--green); color: #fff; font-weight: 600; font-size: .9rem; padding: 12px 20px;
  border-radius: 12px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s; z-index: 200;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
