/* ==========================================================================
 * 教育套装 · 资料中心（edu.php?act=materials）
 * 文件：static/edu/css/materials.css · 前缀 mtl-
 * 设计稿：docs/design/materials_ui_draft.html（2026-10-28 已确认）
 * 依赖：tokens.css → components.css → site.css → edu.css → 本文件
 * ========================================================================== */

/* ---------- 页头 ---------- */
.mtl-hd {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    margin: 6px 0 20px;
    flex-wrap: wrap;
}
.mtl-hd-t h1 {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
    color: var(--zai-text-primary);
}
.mtl-hd-t p {
    margin: 0;
    font-size: 13px;
    color: var(--zai-text-secondary);
}
.mtl-hd-t p b {
    color: var(--zai-color-primary);
    font-weight: 600;
}
.mtl-search {
    margin-left: auto;
    display: flex;
    gap: 8px;
}
.mtl-search .zai-input {
    width: 280px;
    height: 38px;
}
.mtl-search .zai-btn {
    height: 38px;
    padding: 0 18px;
}

/* ---------- 双栏布局 ---------- */
.mtl-layout {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

/* 左：课程目录树 */
.mtl-tree {
    flex: 0 0 258px;
    width: 258px;
    position: sticky;
    top: 74px;
    background: var(--zai-surface);
    border: 1px solid var(--zai-border);
    border-radius: var(--zai-radius-lg);
    overflow: hidden;
    box-shadow: var(--zai-shadow-xs);
}
.mtl-tree-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--zai-text-primary);
    border-bottom: 1px solid var(--zai-border);
    background: var(--zai-surface);
}
.mtl-tree-hd span {
    font-size: 12px;
    font-weight: 400;
    color: var(--zai-text-muted);
}
.mtl-tree-list {
    max-height: 560px;
    overflow-y: auto;
}
.mtl-tree-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--zai-text-primary);
    border-left: 3px solid transparent;
}
.mtl-tree-item:hover {
    background: var(--zai-neutral-50);
}
.mtl-tree-item.is-on {
    background: var(--zai-color-primary-soft);
    border-left-color: var(--zai-color-primary);
}
.mtl-tree-item .t {
    flex: 1;
    min-width: 0;
}
.mtl-tree-item .t b {
    display: block;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mtl-tree-item .t i {
    font-style: normal;
    font-size: 11px;
    color: var(--zai-text-muted);
}
.mtl-tree-item .n {
    flex: 0 0 auto;
    font-size: 11px;
    background: var(--zai-neutral-50);
    border: 1px solid var(--zai-border);
    border-radius: var(--zai-radius-full);
    padding: 1px 8px;
    color: var(--zai-text-secondary);
}
.mtl-tree-item.is-on .n {
    background: var(--zai-surface);
    border-color: var(--zai-color-primary);
    color: var(--zai-color-primary);
}
/* 目录树里的封面：固定小尺寸（图片不约束会把侧栏撑爆） */
.mtl-tree-cov {
    flex: 0 0 44px;
    width: 44px;
    height: 32px;
    font-size: 11px;
    line-height: 1.2;
}

/* 封面：图片 / 回退色块（装饰色，无对应 token，按课程 id 取模固定） */
.mtl-cov {
    flex: 0 0 auto;
    border-radius: var(--zai-radius-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    background: var(--zai-neutral-500);
}
.mtl-cov img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.mtl-cov-0 { background: #2563EB; }
.mtl-cov-1 { background: #7C3AED; }
.mtl-cov-2 { background: #0D9488; }
.mtl-cov-3 { background: #D97706; }
.mtl-cov-4 { background: #DB2777; }
.mtl-cov-5 { background: #64748B; }

/* ---------- 右：课程分组 ---------- */
.mtl-main {
    flex: 1;
    min-width: 0;
}
.mtl-course {
    background: var(--zai-surface);
    border: 1px solid var(--zai-border);
    border-radius: var(--zai-radius-lg);
    margin-bottom: 18px;
    overflow: hidden;
    box-shadow: var(--zai-shadow-xs);
    scroll-margin-top: 80px;
}
.mtl-course-hd {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--zai-border);
    background: linear-gradient(180deg, var(--zai-neutral-50), var(--zai-surface));
}
.mtl-course-hd .mtl-cov {
    width: 74px;
    height: 52px;
    font-size: 13px;
    text-align: center;
    line-height: 1.3;
}
.mtl-course-info {
    flex: 1;
    min-width: 0;
}
.mtl-course-info h2 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    color: var(--zai-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mtl-course-info p {
    margin: 0;
    font-size: 12px;
    color: var(--zai-text-secondary);
}
.mtl-course-info p b {
    color: var(--zai-color-primary);
    font-weight: 600;
}
.mtl-course-go {
    flex: 0 0 auto;
    font-size: 12.5px;
    color: var(--zai-color-primary);
    background: var(--zai-color-primary-soft);
    border: 1px solid var(--zai-color-primary);
    border-radius: var(--zai-radius-full);
    padding: 6px 14px;
    text-decoration: none;
}
.mtl-course-go:hover {
    background: var(--zai-color-primary);
    color: #fff;
}

/* 资料行 */
.mtl-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.mtl-list li {
    border-bottom: 1px solid var(--zai-border);
}
.mtl-list li:last-child {
    border-bottom: 0;
}
.mtl-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 18px;
    text-decoration: none;
    color: var(--zai-text-primary);
}
.mtl-row:hover {
    background: var(--zai-neutral-50);
}
.mtl-row .ic {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: var(--zai-radius-sm);
    background: var(--zai-color-primary-soft);
    color: var(--zai-color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}
.mtl-row.is-locked .ic {
    background: var(--zai-color-warning-soft);
    color: var(--zai-color-warning);
}
.mtl-row .t {
    flex: 1;
    min-width: 0;
}
.mtl-row .t b {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--zai-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mtl-row.is-locked .t b {
    color: var(--zai-text-secondary);
}
.mtl-row .t i {
    font-style: normal;
    font-size: 11.5px;
    color: var(--zai-text-muted);
}
.mtl-pill {
    flex: 0 0 auto;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: var(--zai-radius-full);
}
.mtl-pill.is-ok {
    background: var(--zai-color-success-soft, #DCFCE7);
    color: var(--zai-color-success, #15803D);
}
.mtl-pill.is-lock {
    background: var(--zai-color-warning-soft);
    color: var(--zai-color-warning);
}
.mtl-row .arr {
    flex: 0 0 auto;
    color: var(--zai-text-muted);
    font-size: 14px;
}

/* 空态 */
.mtl-empty {
    background: var(--zai-surface);
    border: 1px solid var(--zai-border);
    border-radius: var(--zai-radius-lg);
    padding: 40px 24px;
    text-align: center;
}

/* 窄屏：目录树转为置顶横排 */
@media (max-width: 900px) {
    .mtl-layout { flex-direction: column; }
    .mtl-tree {
        position: static;
        width: 100%;
        flex: 1 1 auto;
    }
    .mtl-tree-list {
        display: flex;
        overflow-x: auto;
        max-height: none;
    }
    .mtl-tree-item {
        flex: 0 0 auto;
        border-left: 0;
        border-bottom: 3px solid transparent;
    }
    .mtl-tree-item.is-on { border-bottom-color: var(--zai-color-primary); }
}
