/* ==========================================================================
 * 课堂教学资源库 · 独立样式（浅色科技风，与平台主视觉一致）
 * 所有类名以 rl- 前缀，避免与 app.css 通用类冲突
 * ======================================================================== */
.reslib { --rl-line: #e6ecf7; --rl-dim: #64748b; --rl-brand: #4f46e5; }

.rl-wrap {
  max-width: 1320px; margin: 0 auto; padding: 16px 16px 60px;
  display: grid; grid-template-columns: 232px 1fr; gap: 16px; align-items: start;
}

/* ---------------- 侧栏 ---------------- */
.rl-side { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 12px; }
.rl-scopes { display: flex; flex-direction: column; gap: 8px; }
.rl-scope {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: #fff; border: 1px solid var(--rl-line); border-radius: 14px;
  padding: 11px 13px; cursor: pointer; text-align: left;
  box-shadow: 0 2px 10px rgba(30, 41, 59, .05); transition: all .15s;
}
.rl-scope:hover { border-color: #c7d2fe; transform: translateY(-1px); }
.rl-scope.on { background: linear-gradient(135deg, #4f46e5, #6366f1); border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(79, 70, 229, .25); }
.rl-scope .ic { font-size: 17px; }
.rl-scope b { flex: 1; font-size: 14.5px; font-weight: 700; }
.rl-scope i { font-style: normal; font-size: 12px; background: rgba(79, 70, 229, .1); color: var(--rl-brand); border-radius: 999px; padding: 1px 8px; }
.rl-scope.on i { background: rgba(255, 255, 255, .22); color: #fff; }

.rl-box { background: #fff; border: 1px solid var(--rl-line); border-radius: 14px; padding: 12px; box-shadow: 0 2px 10px rgba(30, 41, 59, .05); }
.rl-boxhd { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 800; color: #334155; margin-bottom: 8px; }
.rl-mini { font-size: 12px; color: var(--rl-dim); }
.rl-mini.click, .rl-boxhd .rl-mini { cursor: pointer; color: var(--rl-brand); }
.rl-empty-mini { font-size: 12.5px; color: #94a3b8; }

.rl-tree { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; }
.rl-node {
  display: flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 10px;
  cursor: pointer; font-size: 13.5px; color: #334155; border: 1px solid transparent;
}
.rl-node:hover { background: #f1f5f9; }
.rl-node.on { background: #eef2ff; border-color: #c7d2fe; color: var(--rl-brand); font-weight: 700; }
.rl-node .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-node .ct { font-size: 11px; color: #94a3b8; }
.rl-node .fx { font-size: 10px; background: #f1f5f9; color: #64748b; border-radius: 6px; padding: 0 5px; }

.rl-ck { display: flex; align-items: center; gap: 7px; font-size: 13px; color: #475569; padding: 4px 0; cursor: pointer; }
.rl-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.rl-tag { font-size: 12px; background: #f1f5f9; color: #475569; border-radius: 999px; padding: 2px 10px; cursor: pointer; }
.rl-tag.on { background: var(--rl-brand); color: #fff; }

/* ---------------- 主区工具条 ---------------- */
.rl-main { min-width: 0; }
.rl-tools { background: #fff; border: 1px solid var(--rl-line); border-radius: 16px; padding: 12px; box-shadow: 0 2px 10px rgba(30, 41, 59, .05); display: flex; flex-direction: column; gap: 10px; }
.rl-search { display: flex; gap: 8px; }
.rl-search input { flex: 1; padding: 9px 12px; border: 1px solid var(--rl-line); border-radius: 12px; background: #f8fafc; font-size: 14px; }
.rl-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.rl-filters select { padding: 7px 10px; border: 1px solid var(--rl-line); border-radius: 10px; background: #fff; font-size: 13px; color: #334155; }
.rl-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rl-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #d9424a; margin-left: 5px; vertical-align: middle; }
.rl-listbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px 2px; }

/* ---------------- 资源卡片 ---------------- */
.rl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; margin-top: 10px; }
.rl-card {
  background: #fff; border: 1px solid var(--rl-line); border-radius: 16px; padding: 13px;
  box-shadow: 0 2px 10px rgba(30, 41, 59, .05); display: flex; flex-direction: column; gap: 8px;
  cursor: pointer; transition: transform .15s, box-shadow .15s; position: relative;
}
.rl-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(79, 70, 229, .13); }
.rl-card .top { display: flex; gap: 10px; align-items: flex-start; }
.rl-ico { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, #eef2ff, #e0f2fe); display: grid; place-items: center; font-size: 20px; flex: 0 0 auto; }
.rl-card .nm { font-weight: 800; font-size: 14.5px; line-height: 1.4; word-break: break-all; }
.rl-card .sub { font-size: 12px; color: var(--rl-dim); margin-top: 2px; }
.rl-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.rl-chip { font-size: 11.5px; border-radius: 999px; padding: 1px 9px; background: #f1f5f9; color: #475569; }
.rl-chip.b { background: #eef2ff; color: #4f46e5; }
.rl-chip.g { background: #e8f8ef; color: #0f9d58; }
.rl-chip.y { background: #fff6e0; color: #c47f00; }
.rl-chip.r { background: #fdeeee; color: #d9424a; }
.rl-card .ft { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: #94a3b8; border-top: 1px dashed var(--rl-line); padding-top: 7px; }
.rl-card .ops { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rl-card .ops button { font-size: 12px; padding: 6px 11px; min-height: 30px; min-width: 46px; white-space: nowrap; flex: 0 0 auto; border-radius: 8px; border: 1px solid var(--rl-line); background: #fff; cursor: pointer; color: #475569; }
.rl-card .ops button:hover { border-color: var(--rl-brand); color: var(--rl-brand); }
.rl-badge { position: absolute; right: 10px; top: 10px; font-size: 10.5px; padding: 1px 7px; border-radius: 999px; }
.rl-more { text-align: center; padding: 18px 0; }

/* ---------------- 抽屉 ---------------- */
.rl-drawer { position: fixed; inset: 0; z-index: 60; display: none; }
.rl-drawer.on { display: block; }
.rl-dmask, .rl-mmask { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.rl-dpanel { position: absolute; right: 0; top: 0; bottom: 0; width: min(560px, 96vw); background: #fff; display: flex; flex-direction: column; animation: rlSlide .22s ease; }
@keyframes rlSlide { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.rl-dhd { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--rl-line); }
.rl-dhd b { font-size: 16px; }
.rl-dbody { padding: 14px 16px 40px; overflow: auto; }
.rl-x { background: none; border: 0; font-size: 18px; cursor: pointer; color: #94a3b8; }

.rl-sec { border: 1px solid var(--rl-line); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.rl-sec > h4 { font-size: 13.5px; margin-bottom: 8px; color: #334155; }
.rl-kv { display: grid; grid-template-columns: 84px 1fr; gap: 5px 10px; font-size: 13px; }
.rl-kv .k { color: var(--rl-dim); }
.rl-preview { border: 1px solid var(--rl-line); border-radius: 12px; overflow: hidden; background: #f8fafc; }
.rl-preview img { width: 100%; display: block; }
.rl-preview iframe { width: 100%; height: 420px; border: 0; display: block; }
.rl-nopreview { padding: 26px; text-align: center; color: #94a3b8; font-size: 13px; }

/* ---------------- 模态 ---------------- */
.rl-modal { position: fixed; inset: 0; z-index: 70; display: none; }
.rl-modal.on { display: block; }
.rl-mpanel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(620px, 94vw); max-height: 90vh; background: #fff; border-radius: 18px;
  display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
}
.rl-mpanel.wide { width: min(1020px, 96vw); }
.rl-mhd { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--rl-line); }
.rl-mhd b { font-size: 16px; }
.rl-mbody { padding: 14px 18px; overflow: auto; }
.rl-mft { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--rl-line); }
.rl-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.rl-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rl-lb { font-size: 12.5px; color: var(--rl-dim); }
.rl-row input, .rl-row select, .rl-row textarea, .rl-row2 input, .rl-row2 select {
  padding: 9px 11px; border: 1px solid var(--rl-line); border-radius: 11px; font-size: 14px; background: #fff; width: 100%;
}
.rl-row textarea { resize: vertical; line-height: 1.6; }
.rl-hintline { font-size: 12.5px; color: var(--rl-dim); background: #f8fafc; border: 1px dashed var(--rl-line); border-radius: 10px; padding: 7px 10px; margin: 4px 0 10px; }

/* ---------------- 拍照切题 ---------------- */
.rl-cutwrap { max-height: 46vh; overflow: auto; border: 1px solid var(--rl-line); border-radius: 12px; background: #f8fafc; padding: 8px; text-align: center; }
.rl-cutwrap canvas { max-width: 100%; display: block; margin: 0 auto; }
.rl-cutbar { display: flex; align-items: center; gap: 10px; padding: 10px 0; flex-wrap: wrap; }
.rl-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.rl-shot { border: 1px solid var(--rl-line); border-radius: 12px; overflow: hidden; background: #fff; }
.rl-shot img { width: 100%; display: block; background: #f1f5f9; }
.rl-shot .cap { font-size: 12px; padding: 6px 8px; display: flex; justify-content: space-between; align-items: center; }
.rl-shot .del { color: #d9424a; cursor: pointer; }

/* ---------------- 题库编辑 ---------------- */
.rl-bkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.rl-qlist { display: flex; flex-direction: column; gap: 10px; }
.rl-q {
  border: 1px solid var(--rl-line); border-radius: 14px; padding: 11px 12px; background: #fff;
  display: grid; grid-template-columns: 1fr auto; gap: 10px;
}
.rl-q .stem { font-size: 14px; line-height: 1.6; }
.rl-q .stem img { max-width: 180px; border-radius: 8px; margin-top: 5px; display: block; }
.rl-q .opts { font-size: 12.5px; color: #475569; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.rl-q .opts .right { color: #0f9d58; font-weight: 700; }
.rl-q .meta { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.rl-q .ops { display: flex; flex-direction: column; gap: 5px; }
.rl-q .ops button { font-size: 12px; padding: 4px 10px; border-radius: 9px; border: 1px solid var(--rl-line); background: #fff; cursor: pointer; white-space: nowrap; }
.rl-q .ops button:hover { border-color: var(--rl-brand); color: var(--rl-brand); }
.rl-q.pushed { border-color: #c7d2fe; background: #fbfcff; }

.rl-qwrap { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; }
.rl-aibox { border: 1px solid #c7d2fe; background: #fbfcff; border-radius: 14px; padding: 11px; margin-bottom: 10px; }
.rl-aimeta { font-size: 12.5px; color: #475569; margin-top: 8px; line-height: 1.7; }
.rl-aimeta .kb { display: inline-block; background: #eef2ff; color: #4f46e5; border-radius: 6px; padding: 0 6px; margin: 0 3px 3px 0; }
.rl-hints { display: flex; flex-direction: column; gap: 6px; }
.rl-hints input { padding: 7px 10px; border: 1px solid var(--rl-line); border-radius: 10px; font-size: 13px; width: 100%; }

/* ---------------- 列表弹窗（审核 / 回收站 / 统计） ---------------- */
.rl-lrow { display: flex; align-items: center; gap: 10px; border: 1px solid var(--rl-line); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.rl-lrow .nm { flex: 1; font-size: 13.5px; font-weight: 700; }
.rl-lrow .ops { display: flex; gap: 6px; }
.rl-lrow .ops button { font-size: 12px; padding: 4px 10px; border-radius: 9px; border: 1px solid var(--rl-line); background: #fff; cursor: pointer; }
.rl-statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.rl-statbox { border: 1px solid var(--rl-line); border-radius: 12px; padding: 9px; text-align: center; }
.rl-statbox .k { font-size: 12px; color: var(--rl-dim); }
.rl-statbox .v { font-size: 19px; font-weight: 800; color: var(--rl-brand); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 980px) {
  .rl-wrap { grid-template-columns: 1fr; }
  .rl-side { position: static; }
  .rl-scopes { flex-direction: row; }
  .rl-scope { flex: 1; }
  .rl-qwrap { grid-template-columns: 1fr; }
}
/* 顶栏用户信息过长时截断，避免小屏挤出视口 */
.reslib #rlWho { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }

@media (max-width: 640px) {
  .reslib .tbWrap { padding: 12px 12px 14px; gap: 8px; }
  .reslib .tbRight { gap: 6px; }
  .reslib #rlWho { max-width: 34vw; font-size: 11.5px; }
  .rl-wrap { padding: 12px 12px 40px; }
  .rl-grid { grid-template-columns: 1fr; }
  .rl-row2 { grid-template-columns: 1fr; }
  .rl-filters select { flex: 1 1 44%; }
  .rl-actions .btn { flex: 1 1 46%; }
}
