/* Resources: the shelf, drawn as a list.
 *
 * The card grid this replaced spent most of a wide screen on padding and
 * 34px icons, and fitted about six things above the fold. A shelf is read by
 * running an eye down a column of names, so the names get the width and
 * everything else gets what is left.
 *
 * The card rules in styles.css and the drag rules in dealtools.css are still
 * there and still used by the folder chips in the crumb trail. Nothing here
 * overrides them; these are new class names so the two sheets cannot fight. */

/* ---- Toolbar ---- */

.res-bar { align-items: center; }

.res-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 9px;
  min-width: 220px;
}
.res-search svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.res-search input {
  border: 0;
  outline: 0;
  background: none;
  padding: 7px 0;
  font-size: 13.5px;
  width: 100%;
  min-width: 0;
}
.res-search:focus-within { border-color: var(--blue); }

.res-scope {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.res-scope span { white-space: nowrap; }
.res-scope select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  font-size: 13px;
  max-width: 200px;
}

.res-lede { margin: -4px 0 12px; }
.res-legacy { margin-bottom: 12px; font-weight: 500; line-height: 1.5; }
.res-count { margin: 0 0 8px; }

/* ---- The list ---- */

.res-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* One template shared by the header and every row, so the columns line up
   without a table and without a second place to change a width. */
.res-head,
.res-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 122px 210px 92px;
  gap: 10px;
  align-items: center;
  padding: 8px 13px;
}
/* Grid children default to min-width:auto, so one long filename with no
   spaces in it pushes the sharing column off the end of the card. */
.res-head > *,
.res-row > * { min-width: 0; }

.res-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding-top: 7px;
  padding-bottom: 7px;
}

.res-row { border-bottom: 1px solid var(--border); }
.res-row:last-child { border-bottom: 0; }
.res-row:hover { background: #f8fafc; }
.res-row.is-folder { cursor: pointer; }
.res-row.is-folder:hover { background: #eff6ff; }

.res-ic {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: none;
}
.res-ic svg { width: 14px; height: 14px; }
.res-ic img { width: 100%; height: 100%; object-fit: cover; }
.res-row.is-folder .res-ic { background: #dbeafe; color: var(--blue-dark); }

.res-name {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.res-name a, .res-name b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.res-name a:hover { color: var(--blue); text-decoration: underline; }
.res-name i { font-style: normal; }

.res-col-kind { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.res-col-share { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.res-share {
  display: inline-block;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.res-share.is-office { background: #d1fae5; color: #065f46; }
.res-share.is-mine { background: #fef3c7; color: #92400e; }

/* Only offered on hover, because it changes who can read something and a
   button that sits there permanently invites an accidental click. */
.res-sharebtn {
  border: 0;
  background: none;
  padding: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: underline;
  opacity: 0;
  transition: opacity .1s;
}
.res-row:hover .res-sharebtn,
.res-sharebtn:focus-visible { opacity: 1; }

.res-acts { display: flex; gap: 2px; justify-content: flex-end; }
.res-acts .icon-btn { padding: 4px; }
.res-acts .icon-btn svg { width: 14px; height: 14px; }
.res-acts .icon-btn[disabled] { opacity: .3; cursor: default; }

/* ---- Dragging a row into a folder ---- */
/* Same behaviour the cards had. The rules in dealtools.css are scoped to
   .res-card, so the list needs its own pair rather than borrowing them. */
.res-row[draggable="true"] { cursor: grab; }
.res-row.dragging { opacity: .45; }
.res-row.drop-on {
  outline: 2px dashed var(--blue);
  outline-offset: -3px;
  background: #eff6ff;
}

.res-hint { margin-top: 12px; }

/* ---- The viewer ---- */

.rv-wrapper { line-height: 1.55; font-weight: 500; }
.rv-wrapper b { display: block; margin-bottom: 2px; }

/* ---- Narrow screens ---- */
/* The two middle columns are context, not content. On a laptop split beside a
   lead they go first, and the sharing tag moves under the name so it is still
   answerable without a horizontal scrollbar. */
@media (max-width: 1000px) {
  .res-head,
  .res-row { grid-template-columns: 26px minmax(0, 1fr) 180px 84px; }
  .res-col-kind { display: none; }
}
@media (max-width: 720px) {
  .res-head,
  .res-row { grid-template-columns: 26px minmax(0, 1fr) 84px; }
  .res-col-share { display: none; }
  .res-search { min-width: 0; flex: 1 1 100%; order: 5; }
}
