/* viewer.css — arbre de selecció (unitats/activitats), panell de PDF i
   barra de selecció persistent. Complementa tokens/layout/components,
   que es reutilitzen tal qual de pd-main. */

/* ── Marca al topbar de la pàgina de curs ───────────────────────────── */
.brand { font-size: 13.5px; font-weight: 700; color: var(--navy); white-space: nowrap; }
.brand small { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); }

/* ── Capçalera de l'índex del curs, dins la sidebar ─────────────────── */
.tree-master {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.tree-master label {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 700; color: var(--navy);
  cursor: pointer; user-select: none;
}

/* ── Grup «Document del curs» (índex, opcional) ─────────────────────── */
.bonus-item .act-ico { color: var(--doc-prog); background: rgba(181,96,16,.10); }

/* ── Blocs d'unitat ──────────────────────────────────────────────────── */
.unit-block { margin-bottom: 4px; }
.unit-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 6px 8px 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
}
.unit-header:hover { background: var(--blue-bg); }
.unit-collapse {
  flex-shrink: 0; width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--hint); transition: transform .16s var(--ease);
}
.unit-block.collapsed .unit-collapse { transform: rotate(-90deg); }
.unit-block.collapsed .unit-activities { display: none; }
.unit-check {
  flex-shrink: 0; width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer;
}
.unit-label {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; line-height: 1.25;
}
.unit-num { font-size: 10.5px; font-weight: 800; letter-spacing: .05em; color: var(--blue); }
.unit-title-text {
  font-size: 13.5px; font-weight: 700; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.unit-badge {
  flex-shrink: 0; font-size: 10.5px; font-weight: 700;
  color: var(--muted); background: var(--line-2);
  padding: 2px 7px; border-radius: 20px;
}
.unit-badge.all { color: #fff; background: var(--blue); }

/* ── Files d'activitat (variant de .nav-item amb checkbox) ──────────── */
.unit-activities { padding-left: 4px; margin: 2px 0 10px; }
.activity-item {
  display: flex; align-items: center; gap: 6px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
}
.act-check-wrap { flex-shrink: 0; display: flex; padding: 0 2px 0 6px; }
.act-check { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }
.activity-row {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px 7px 4px; text-align: left;
  border-radius: var(--radius-sm);
  color: var(--ink); cursor: pointer;
  transition: background .12s, color .12s;
}
.activity-row:hover { background: var(--blue-bg); }
.activity-row.active { background: var(--blue); color: #fff; }
.activity-row.active .act-sub { color: rgba(255,255,255,.82); }
.act-ico {
  flex-shrink: 0; width: 25px; height: 25px;
  border-radius: 7px; display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  color: var(--doc-ud); background: rgba(46,117,182,.10);
}
.activity-row.active .act-ico { background: rgba(255,255,255,.22); color: #fff; }
.act-body { flex: 1; min-width: 0; }
.act-title {
  font-size: 13.5px; font-weight: 600; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.act-sub {
  font-size: 11px; color: var(--muted); margin-top: 1px; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Panell principal: visor de PDF ─────────────────────────────────── */
.viewer-panel {
  height: calc(100dvh - 54px);
  display: flex; flex-direction: column;
}
.viewer-topbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.viewer-topbar #viewerTitle { font-size: 14.5px; font-weight: 700; color: var(--navy);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-topbar .topbar-spacer { flex: 1; }
.pdf-frame { flex: 1 1 auto; width: 100%; border: none; background: #525659; }
.viewer-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--hint); text-align: center; padding: 40px;
}
.viewer-empty svg { width: 40px; height: 40px; color: var(--line); }
.viewer-empty p { font-size: 14px; max-width: 320px; }

/* ── Barra de selecció persistent ───────────────────────────────────── */
.selection-bar {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0,0,0,.05);
}
.selection-bar[hidden] { display: none; }
.selection-info { font-size: 13.5px; color: var(--ink); white-space: nowrap; }
.selection-info strong { color: var(--navy); }
.selection-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.selection-actions .pill-btn svg { width: 14px; height: 14px; }
.selection-actions .pill-btn[disabled] { opacity: .5; pointer-events: none; }

/* ── Estat de càrrega inline dins botons ─────────────────────────────── */
.pill-btn .btn-spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
