﻿/* ===========================================================
   teacher-ui.css — 课件平台双端样式
   风格与登录页统一：翠绿色系，浅灰背景，白底圆角卡片
   PC: 侧边栏 + 吸顶内容头部 + 内容
   移动: 吸顶头部 + 水平标签 + 列表
   =========================================================== */

:root {
    --green: #10b981;
    --green-d: #059669;
    --green-l: #34d399;
    --green-bg: #ecfdf5;
    --gray-bg: #f5f6f8;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --radius: 12px;
    --side-w: 230px;
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--gray-bg);
    color: var(--gray-800);
    min-height: 100vh;
}

/* ============================================================
   移动端 (< 768px)
   ============================================================ */
.sidebar, .pc-bar { display: none; }

.sticky-top {
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 10px rgba(5,150,105,0.18);
}
.m-header {
    background: linear-gradient(135deg, var(--green-d), var(--green));
    color: #fff; padding: 14px 16px;
    position: relative; z-index: 2;
}
.mh-row { display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: 600; }
.mh-user { font-size: 12px; font-weight: 400; opacity: 0.85; }
.mh-back { color: #fff; text-decoration: none; font-size: 15px; }
.mh-sub { font-size: 12px; opacity: 0.85; }
.mh-sort { color: #fff; text-decoration: none; font-size: 16px; padding: 4px 10px; background: rgba(255,255,255,0.15); border-radius: 16px; }

.mobile-cats {
    background: #fff; overflow: hidden;
    position: relative; z-index: 1;
    max-height: 88px;  /* 默认折叠 */
    transition: max-height .3s;
}
.mobile-cats.open { max-height: 800px; }
.mobile-cats-inner {
    display: flex; flex-wrap: wrap;
    padding: 8px 12px; gap: 6px;
}
.mobile-cats .cat-item {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 14px; border-radius: 20px; font-size: 13px;
    border: 1px solid var(--gray-200);
    color: var(--gray-600); background: #fff;
    text-decoration: none; white-space: nowrap; transition: all .2s;
}
.mobile-cats .cat-item.on {
    background: linear-gradient(135deg, var(--green-d), var(--green));
    color: #fff; border-color: transparent;
}
.mobile-cats .cat-item .cat-icon { width: 16px; height: 16px; border-radius: 3px; }
.cats-toggle {
    display: flex; align-items: center; justify-content: center; gap: 4px;
    padding: 8px 0; font-size: 12px; color: #fff;
    cursor: pointer; user-select: none;
    background: var(--green-d); margin: 0;
    border-top: 1px solid rgba(255,255,255,0.2);
}
.cats-toggle::after { content: ' ▾'; font-size: 10px; }
.mobile-cats.open + .cats-toggle::after { content: ' ▴'; }

/* 课件列表 */
.course-list { padding: 10px 12px 80px; }
.course-card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 14px; margin-bottom: 10px;
    background: #fff; border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    border: 1px solid var(--gray-200);
    border-left: 4px solid transparent;
    text-decoration: none; color: inherit;
    transition: all .2s;
}
.course-card:active { transform: scale(0.985); background: var(--gray-50); }
.mobile-cats .cat-item:active { background: var(--gray-100); }
.file-card:active { transform: scale(0.95); background: var(--gray-50); }
.cc-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.cc-emoji { font-size: 22px; line-height: 1; }
.cc-body { flex: 1; min-width: 0; }
.cc-title {
    font-size: 15px; font-weight: 600; margin: 0 0 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: var(--gray-800); line-height: 1.3;
}
.cc-row { display: flex; align-items: center; gap: 8px; }
.cc-tag {
    display: inline-block; padding: 2px 10px; border-radius: 4px;
    background: var(--green-bg); color: var(--green-d);
    font-size: 11px; font-weight: 500; letter-spacing: 0.3px;
}
.cc-stats {
    display: flex; gap: 12px; flex-shrink: 0;
    font-size: 12px; color: var(--gray-500);
}
.cc-stat-num { font-weight: 700; color: var(--gray-700); }
.cc-arrow { color: var(--gray-300); font-size: 16px; flex-shrink: 0; }

/* 详情卡片 */
.info-card {
    background: #fff; margin: 12px 12px;
    border-radius: var(--radius); padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--gray-200);
    border-top: 4px solid var(--green);
}
.ic-title { font-size: 19px; font-weight: 700; margin: 0 0 16px; color: var(--gray-900); }
.ic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.ic-item { padding: 9px 0; border-bottom: 1px solid var(--gray-100); display: flex; justify-content: space-between; align-items: center; }
.ic-full { grid-column: 1/-1; }
.icl { font-size: 12px; color: var(--gray-400); }
.icv { font-size: 14px; font-weight: 600; color: var(--gray-800); }

/* 文件区 */
.file-section { padding: 16px 12px 80px; }
.fs-title {
    font-size: 15px; font-weight: 700; margin: 0 0 14px;
    padding: 0 0 10px 14px; border-left: 4px solid var(--green);
    border-bottom: 1px solid var(--gray-200); color: var(--gray-800);
    display: flex; align-items: center; gap: 6px;
}
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); gap: 10px; }
.file-card {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 20px 10px; background: #fff; border-radius: var(--radius);
    border: 1px solid var(--gray-200); text-decoration: none;
    color: var(--gray-600); font-size: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: all .2s;
}
.file-card:hover {
    border-color: var(--green-200);
    box-shadow: 0 4px 12px rgba(5,150,105,0.08);
    transform: translateY(-2px);
}
.file-card img { width: 32px; height: 32px; border-radius: 4px; }
.file-card:active { transform: scale(0.95); }

.weui-tabbar { background: #fff !important; border-top: 1px solid var(--gray-200) !important; box-shadow: 0 -1px 6px rgba(0,0,0,0.04); }
.weui-tabbar:before { display: none !important; }
.weui-tabbar__item.weui-bar__item_on .weui-tabbar__label { color: var(--green-d) !important; }
.weui-tabbar__label { font-size: 12px !important; font-weight: 500; }

.loading {
    width: 30px; height: 30px; margin: 40px auto;
    border: 3px solid var(--gray-200); border-top-color: var(--green);
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   PC 端 (≥ 768px)
   ============================================================ */
@media (min-width: 768px) {
    body { padding-left: var(--side-w); }
    .m-header, .mobile-cats, .cats-toggle, .weui-tabbar { display: none; }

    /* 侧边栏 - 深色主题 */
    .sidebar {
        display: flex; flex-direction: column;
        position: fixed; top: 0; left: 0; bottom: 0;
        width: var(--side-w);
        background: linear-gradient(180deg, #065f46 0%, #047857 40%, #059669 100%);
        z-index: 200;
    }
    .sidebar-hd {
        display: flex; align-items: center; gap: 12px;
        padding: 28px 20px 22px;
    }
    .logo {
        width: 42px; height: 42px; border-radius: 12px;
        background: rgba(255,255,255,0.15);
        color: #fff; display: flex; align-items: center; justify-content: center;
        font-size: 22px; backdrop-filter: blur(10px);
    }
    .logo-text { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: 1px; }
    .sidebar-user {
        display: flex; align-items: center; gap: 12px;
        padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08);
        border-bottom: 1px solid rgba(255,255,255,0.08);
        background: rgba(0,0,0,0.1);
    }
    .avatar {
        width: 38px; height: 38px; border-radius: 50%;
        background: rgba(255,255,255,0.2);
        color: #fff; display: flex; align-items: center; justify-content: center;
        font-size: 15px; font-weight: 700; flex-shrink: 0;
    }
    .user-info { min-width: 0; }
    .uname { font-size: 14px; font-weight: 600; color: #fff; line-height: 1.3; }
    .urole { font-size: 11px; color: rgba(255,255,255,0.6); margin-top: 2px; }
    .admin-link { color: #a7f3d0; text-decoration: none; font-weight: 600; }
    .admin-link:hover { text-decoration: underline; color: #fff; }

    .sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px; }
    .sidebar-nav .cat-item {
        display: flex; align-items: center; gap: 10px;
        padding: 11px 14px; border-radius: 10px;
        font-size: 13px; color: rgba(255,255,255,0.7);
        text-decoration: none; cursor: pointer;
        transition: all .2s; margin-bottom: 2px;
    }
    .sidebar-nav .cat-item:hover {
        background: rgba(255,255,255,0.1);
        color: #fff;
    }
    .sidebar-nav .cat-item.on {
        background: rgba(255,255,255,0.18);
        color: #fff; font-weight: 600;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }
    .sidebar-nav .cat-item .cat-icon { width: 20px; height: 20px; border-radius: 4px; opacity: 0.8; }
    .sidebar-nav .cat-item.on .cat-icon { opacity: 1; }
    .sidebar-ft { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,0.08); }
    .sidebar-ft a {
        flex: 1; text-align: center; padding: 8px 6px !important; border-radius: 8px;
        font-size: 12px; text-decoration: none !important; transition: all .2s;
    }
    .ft-admin {
        background: rgba(255,255,255,0.12) !important; color: rgba(255,255,255,0.85) !important;
        border: 1px solid rgba(255,255,255,0.15);
    }
    .ft-admin:hover { background: rgba(255,255,255,0.22) !important; color: #fff !important; }
    .ft-logout {
        background: rgba(255,255,255,0.05) !important; color: rgba(255,255,255,0.5) !important;
        border: 1px solid rgba(255,255,255,0.08);
    }
    .ft-logout:hover { background: rgba(255,255,255,0.12) !important; color: rgba(255,255,255,0.8) !important; }

    /* PC 吸顶顶部栏 */
    .pc-bar {
        display: flex; align-items: center; justify-content: space-between;
        padding: 16px 28px; background: #fff;
        border-bottom: 1px solid var(--gray-200);
        position: sticky; top: 0; z-index: 50;
        box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    }
    .pc-bar h2 { font-size: 18px; font-weight: 700; margin: 0; color: var(--gray-800); }
    .sort-btn {
        font-size: 13px; color: var(--green-d); cursor: pointer;
        background: var(--green-bg); border: none; padding: 6px 16px;
        border-radius: 8px; text-decoration: none; font-weight: 500;
        transition: background .2s;
    }
    .sort-btn:hover { background: #d1fae5; }

    /* PC 课件列表 */
    .course-list { padding: 20px 28px 28px; max-width: 900px; }
    .course-card {
        padding: 22px 24px; margin-bottom: 12px;
        border-radius: var(--radius);
        box-shadow: 0 1px 3px rgba(0,0,0,0.04);
        border: 1px solid var(--gray-200);
        border-left: 4px solid transparent;
        cursor: pointer; gap: 18px;
    }
    .course-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(5,150,105,0.10);
        border-color: var(--green-200);
        border-left-color: var(--green);
    }
    .course-card:hover .cc-icon {
        background: linear-gradient(135deg, #d1fae5, #a7f3d0);
        transform: scale(1.05);
    }
    .course-card:hover .cc-arrow { opacity: 1; transform: translateX(0); }
    .cc-icon { width: 52px; height: 52px; border-radius: 14px; transition: transform .2s; }
    .cc-emoji { font-size: 26px; }
    .cc-title { font-size: 16px; margin-bottom: 8px; }
    .cc-stats {
        display: flex; gap: 24px; flex-shrink: 0;
        padding-left: 20px; border-left: 1px solid var(--gray-200);
    }
    .cc-stat-item { text-align: center; min-width: 44px; }
    .cc-stat-num { display: block; font-size: 20px; font-weight: 700; color: var(--gray-800); line-height: 1.2; }
    .cc-stat-lbl { display: block; font-size: 11px; color: var(--gray-400); margin-top: 2px; }
    .cc-arrow {
        display: block; font-size: 18px; color: var(--green);
        opacity: 0; transform: translateX(-8px);
        transition: all .25s; flex-shrink: 0;
    }

    /* PC 详情 */
    .info-card {
        margin: 20px 28px; padding: 28px 32px; max-width: 900px;
        border-top: 5px solid var(--green);
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
    .ic-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
    .ic-title { font-size: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--gray-100); }
    .file-section { padding: 20px 28px 28px; max-width: 900px; }
    .fs-title { padding-left: 18px; font-size: 16px; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; }
    .file-card { padding: 24px 12px; }
    .file-card img { width: 36px; height: 36px; }
    .file-card:hover {
        box-shadow: 0 6px 18px rgba(5,150,105,0.10);
        transform: translateY(-2px);
        border-color: var(--green);
    }
}

/* 管理后台密码验证弹窗 */
.admin-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999;
    background: rgba(0,0,0,0.5); display: none !important;
    align-items: center; justify-content: center;
    backdrop-filter: blur(2px); opacity: 0; visibility: hidden;
    transition: opacity .2s, visibility .2s;
}
.admin-modal-overlay.show { display: flex !important; opacity: 1; visibility: visible; }
.admin-modal {
    background: #fff; border-radius: 14px; padding: 32px 28px 24px;
    width: 340px; max-width: 92vw; box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    text-align: center;
}
.admin-modal h4 { font-size: 17px; color: #1f2937; margin-bottom: 6px; }
.admin-modal .am-sub { font-size: 13px; color: #9ca3af; margin-bottom: 20px; }
.admin-modal input {
    width: 100%; height: 44px; padding: 0 14px; border: 1.5px solid #e5e7eb;
    border-radius: 8px; font-size: 15px; text-align: center;
    outline: none; transition: border-color .2s;
}
.admin-modal input:focus { border-color: #059669; }
.admin-modal .am-err { font-size: 12px; color: #ef4444; margin-top: 8px; min-height: 18px; }
.admin-modal .am-btns { display: flex; gap: 10px; margin-top: 14px; }
.admin-modal .am-btn {
    flex: 1; height: 42px; border: none; border-radius: 8px; font-size: 14px;
    cursor: pointer; font-weight: 600; transition: all .2s;
}
.am-btn-confirm { background: linear-gradient(135deg, #059669, #10b981); color: #fff; }
.am-btn-confirm:hover { opacity: 0.9; }
.am-btn-cancel { background: #f3f4f6; color: #6b7280; }
.am-btn-cancel:hover { background: #e5e7eb; }

@media (min-width: 1024px) {
    :root { --side-w: 250px; }
    .course-list, .info-card, .file-section { max-width: 960px; }
}
