/* zero2hero — admin: Videos y propedéuticos (page-scoped styles)
   Depends on admin.css tokens. Scoped under #admin-catalog / .ctlg-drawer. */

/* ── Tabs ──────────────────────────────────────────────────────────── */
.ctlg-tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-sm);
  background: var(--adm-surface);
}
.ctlg-tabs button {
  border: 0;
  background: transparent;
  color: var(--adm-text-2);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 0.4rem 1rem;
  border-radius: var(--adm-radius-sm);
}
.ctlg-tabs button.is-active { background: var(--adm-ink); color: #fff; }
.ctlg-tabs button:focus-visible { outline: 0; box-shadow: var(--adm-ring); }

/* ── Propedéutico list (left column) ───────────────────────────────── */
.ctlg-prop {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-sm);
  background: var(--adm-surface);
  margin-bottom: 0.5rem;
}
.ctlg-prop:hover { border-color: var(--adm-violet-line); background: var(--adm-surface-2); }
.ctlg-prop.is-active { border-color: var(--adm-violet); box-shadow: var(--adm-ring); }
.ctlg-prop__name { font-weight: 700; font-size: 0.92rem; color: var(--adm-text); }
.ctlg-prop__meta { font-size: 0.78rem; color: var(--adm-muted); }
.ctlg-prop__topics { display: flex; flex-wrap: wrap; gap: 0.25rem; }

/* ── Editor (right column) ─────────────────────────────────────────── */
.ctlg-courses { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.ctlg-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.ctlg-item {
  display: grid;
  grid-template-columns: 2rem 96px minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: start;
  padding: 0.65rem;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-sm);
  background: var(--adm-surface-2);
}
.ctlg-item__pos {
  font-family: var(--adm-font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--adm-violet-strong);
  background: var(--adm-violet-soft);
  border-radius: 6px;
  text-align: center;
  padding: 0.2rem 0;
}
.ctlg-thumb { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; border: 1px solid var(--adm-border); background: var(--adm-ink); }
.ctlg-item__body { display: grid; gap: 0.35rem; min-width: 0; }
.ctlg-item__title { font-weight: 600; font-size: 0.86rem; line-height: 1.3; }
.ctlg-item__fields { display: grid; gap: 0.4rem; }
.ctlg-item__fields input { max-width: 280px; }
.ctlg-item__fields textarea { resize: vertical; font-size: 0.8rem; }
.ctlg-item__actions { display: flex; flex-direction: column; gap: 0.25rem; }
.ctlg-item__actions .btn { padding: 0.15rem 0.45rem; }

.ctlg-add { position: relative; margin-top: 0.75rem; }
.ctlg-add__results {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-sm);
  background: var(--adm-surface);
  max-height: 320px;
  overflow-y: auto;
}
.ctlg-add__results:empty { display: none; }
.ctlg-add__results li + li { border-top: 1px solid var(--adm-border); }
.ctlg-add__results button {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.6rem;
  font-size: 0.84rem;
}
.ctlg-add__results button:hover, .ctlg-add__results button:focus-visible { background: var(--adm-violet-soft); outline: 0; }
.ctlg-add__results img { width: 72px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; }
.ctlg-add__results small { display: block; color: var(--adm-muted); font-size: 0.74rem; }

/* ── Video list ────────────────────────────────────────────────────── */
.ctlg-video {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
}
.ctlg-video .ctlg-thumb { width: 128px; }
.ctlg-video.is-archived { opacity: 0.6; }
.ctlg-video__title { font-weight: 600; font-size: 0.9rem; margin: 0 0 0.15rem; }
.ctlg-video__meta { font-size: 0.78rem; color: var(--adm-muted); margin: 0 0 0.3rem; }
.ctlg-video__pills { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.ctlg-video__actions { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }

/* ── Drawer (create / edit a video) ────────────────────────────────── */
.ctlg-drawer {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(15, 11, 31, 0.5);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: flex-end;
}
.ctlg-drawer[hidden] { display: none; }
.ctlg-drawer__panel {
  width: min(600px, 100%);
  height: 100%;
  background: var(--adm-surface);
  border-left: 1px solid var(--adm-border);
  box-shadow: var(--adm-shadow-lg);
  display: flex;
  flex-direction: column;
}
.ctlg-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem 1.3rem;
  border-bottom: 1px solid var(--adm-border);
}
.ctlg-drawer__head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.ctlg-drawer__head p { margin: 0; color: var(--adm-muted); font-size: 0.8rem; }
.ctlg-drawer__close {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--adm-border);
  background: var(--adm-surface);
  color: var(--adm-muted);
  display: grid;
  place-items: center;
}
.ctlg-drawer__body { flex: 1 1 auto; overflow-y: auto; padding: 1.1rem 1.3rem 1.5rem; }
.ctlg-drawer__foot {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.9rem 1.3rem;
  border-top: 1px solid var(--adm-border);
  background: var(--adm-surface-2);
}

/* search input: make room for the icon (beats admin.css specificity) */
body.adm-body .adm-content #admin-catalog .adm-toolbar__search .form-control { padding-left: 2.3rem; }

@media (max-width: 767.98px) {
  .ctlg-item { grid-template-columns: 2rem minmax(0, 1fr) auto; }
  .ctlg-item .ctlg-thumb { display: none; }
  .ctlg-item__fields input { max-width: none; }
  .ctlg-video { grid-template-columns: minmax(0, 1fr); }
  .ctlg-video .ctlg-thumb { width: 100%; }
  .ctlg-video__actions { justify-content: flex-start; }
  .ctlg-tabs { display: flex; }
  .ctlg-tabs button { flex: 1; }
}
