/* ============================================
   移动端响应式样式
   桌面端完全不受影响，所有规则在 @media 内
   ============================================ */

/* ---- 通用工具类（始终生效） ---- */
.mobile-hide {}
.mobile-only { display: none !important; }
.mobile-stack {}

/* ---- 汉堡菜单按钮（默认隐藏） ---- */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.mobile-menu-toggle:active { background: var(--bg-page); }
.mobile-menu-toggle svg { width: 22px; height: 22px; stroke: var(--text-primary); }

/* ---- 遮罩层（默认隐藏） ---- */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mobile-overlay.active {
    opacity: 1;
}

/* ---- 管理员页面移动端提示条 ---- */
.mobile-desktop-hint {
    display: none;
    padding: 10px 16px;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    font-size: 13px;
    color: #92400e;
    text-align: center;
}

/* ============================================
   移动端断点 (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {

    /* ---- 工具类 ---- */
    .mobile-hide { display: none !important; }
    .mobile-only { display: block !important; }
    .mobile-only.mobile-only--flex { display: flex !important; }
    .mobile-only.mobile-only--grid { display: grid !important; }
    .mobile-stack { flex-direction: column !important; }

    /* ---- Body ---- */
    body { overflow-x: hidden; }

    /* ---- 侧边栏 → 滑出菜单 ---- */
    .sidebar {
        transform: translateX(-100%);
        z-index: 200;
    }
    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .mobile-overlay { display: block; pointer-events: none; }
    .sidebar-open .mobile-overlay { pointer-events: auto; opacity: 1; }

    /* ---- 主内容区 ---- */
    .main-content {
        margin-left: 0;
        width: 100%;
    }

    /* ---- 页面头部 ---- */
    .page-header {
        padding: 12px 16px;
        gap: 8px;
    }
    .page-title { font-size: 17px; }

    .mobile-menu-toggle { display: flex; }

    /* 用户菜单精简 */
    .user-name { display: none; }
    .user-role-chip { display: none; }
    .user-caret { display: none; }
    .user-menu-trigger {
        padding: 4px;
        border: none;
        background: none;
    }
    .page-actions-wrap { gap: 8px; }
    .page-actions { display: none; }

    /* ---- 内容区 ---- */
    .content-body {
        padding: 16px;
    }

    /* ---- 统计卡片 ---- */
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-card {
        padding: 14px;
        gap: 10px;
    }
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 12px; }

    /* ---- 网格布局 ---- */
    .grid-2 { grid-template-columns: 1fr; gap: 16px; }
    .grid-3 { grid-template-columns: 1fr; gap: 16px; }

    /* ---- 表格：横向滚动 ---- */
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table thead,
    .data-table tbody,
    .data-table tr { min-width: max-content; }
    .data-table th,
    .data-table td {
        white-space: nowrap;
        padding: 10px 12px;
        font-size: 13px;
    }

    /* ---- 卡片 ---- */
    .card-body { padding: 16px; }
    .card-header { padding: 14px 16px; }

    /* ---- 按钮：触摸友好 ---- */
    .btn {
        min-height: 40px;
        padding: 10px 16px;
        font-size: 14px;
    }
    .btn-sm {
        min-height: 34px;
        padding: 6px 12px;
        font-size: 13px;
    }
    .btn-lg {
        min-height: 48px;
        padding: 14px 24px;
        font-size: 16px;
    }

    /* ---- 表单控件：触摸友好 ---- */
    .form-control {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 16px; /* 防止 iOS 自动缩放 */
    }
    select.form-control {
        min-height: 44px;
    }
    .form-label { font-size: 14px; }

    /* ---- 模态框全屏化 ---- */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    .modal {
        max-width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        animation: slideUpModal 0.3s ease;
    }
    @keyframes slideUpModal {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    .modal-header { padding: 16px; }
    .modal-body { padding: 16px; }

    /* ---- Toast：居中显示 ---- */
    .toast {
        left: 16px;
        right: 16px;
        top: 16px;
        text-align: center;
    }

    /* ---- 空状态 ---- */
    .empty-state { padding: 32px 16px; }

    /* ---- 上传区域 ---- */
    .upload-area { padding: 32px 16px; }

    /* ---- 报告页面 ---- */
    .report-layout { padding: 16px; }
    .report-student-name { font-size: 24px; }
    .report-title { font-size: 16px; letter-spacing: 2px; }
    .report-meta {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    .chart-container { height: 260px; }
    .chart-container-sm { height: 220px; }
    .chart-container-lg { height: 300px; }

    /* ---- 角色权限页面 ---- */
    .role-layout {
        grid-template-columns: 1fr;
    }
    .role-sidebar {
        position: static;
    }
    .role-detail { padding: 16px; }

    /* ---- 登录页 ---- */
    .login-card {
        padding: 28px 20px;
        border-radius: var(--radius-md);
    }
    .login-logo { font-size: 40px; }
    .login-title { font-size: 20px; }

    /* ---- 管理员页面提示 ---- */
    .mobile-desktop-hint { display: block; }

    /* ---- 账户页面 ---- */
    .info-row { flex-direction: column; gap: 4px; }
    .info-label { width: auto; }

    /* ---- 下拉菜单 ---- */
    .dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        min-width: auto;
        animation: slideUpModal 0.25s ease;
    }
    .dropdown-item {
        padding: 14px 16px;
        font-size: 15px;
    }

    /* ---- 进度条标签 ---- */
    .score-compare-row { gap: 8px; }
    .score-compare-label { width: 60px; font-size: 12px; }
    .score-compare-value { width: 50px; font-size: 13px; }
}

/* ============================================
   教师角色底部 Tab 栏（手机端）
   ============================================ */
.teacher-tab-bar {
    display: none;
}

@media (max-width: 768px) {
    /* 关键决策说明：
       底部 Tab 栏改造成“悬浮 Dock 舱”样式。不再死板地贴在屏幕最底部，
       而是略带外间距和圆角悬浮于屏幕上方，并加入高斯模糊毛玻璃背景（backdrop-filter: blur(14px)）。
       在各种比例的手机屏下都能保留现代且高端的交互质感。 */
    body.role-teacher .teacher-tab-bar {
        display: flex;
        position: fixed;
        bottom: max(12px, env(safe-area-inset-bottom));
        left: 12px;
        right: 12px;
        height: 56px;
        background: rgba(255, 255, 255, 0.88);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border: 1px solid rgba(255, 255, 255, 0.4);
        border-radius: var(--radius-lg);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
        z-index: 150;
        padding-bottom: 0;
    }
    body.role-teacher .content-body {
        padding-bottom: 84px;
    }
    body.role-teacher .mobile-menu-toggle {
        display: none;
    }

    /* 关键决策说明：
       加入 Tab 图标的弹性微动效。当 Tab 处于 active 激活态时，
       图标会利用 cubic-bezier 缓动函数略微往上滑移 3px 并且放大，产生精美的力学反馈。 */
    .teacher-tab-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 11px;
        font-weight: 500;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        -webkit-tap-highlight-color: transparent;
    }
    .teacher-tab-item .tab-icon {
        font-size: 19px;
        line-height: 1;
        transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    .teacher-tab-item.active {
        color: var(--primary);
        font-weight: 600;
    }
    .teacher-tab-item.active .tab-icon {
        transform: translateY(-3px) scale(1.15);
    }
    .teacher-tab-item:active {
        color: var(--primary-dark);
    }
}

/* ============================================
   教师角色顶部导航（桌面端）
   在 base_teacher.html 中使用
   ============================================ */
/* 关键决策说明：
   教师桌面端顶部导航栏重设为微透明与高斯模糊背景融合，
   配合微弱的底部细线投影，使用户在滑动查看成绩或学生报表时，视线能更聚焦。 */
.teacher-topnav {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
    position: sticky;
    top: 0;
    z-index: 50;
}
.teacher-topnav .topnav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 32px;
    text-decoration: none;
    flex-shrink: 0;
}
.teacher-topnav .topnav-logo-icon { font-size: 22px; }
.teacher-topnav .topnav-logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.teacher-topnav .topnav-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
}
.teacher-topnav .topnav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}
.teacher-topnav .topnav-tab:hover {
    background: var(--bg-page);
    color: var(--text-primary);
}
.teacher-topnav .topnav-tab.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}
.teacher-topnav .topnav-tab .tab-icon { font-size: 16px; }
.teacher-topnav .topnav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

@media (max-width: 768px) {
    .teacher-topnav {
        height: 50px;
        padding: 0 16px;
        background: rgba(255, 255, 255, 0.88);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
    }
    .teacher-topnav .topnav-tabs { display: none; }
    .teacher-topnav .topnav-logo-text { display: none; }
    .teacher-topnav .topnav-right .user-name { display: none; }
    .teacher-topnav .topnav-right .user-role-chip { display: none; }
    .teacher-topnav .topnav-right .user-caret { display: none; }
    .teacher-topnav .topnav-right .user-menu-trigger {
        padding: 4px;
        border: none;
        background: none;
    }

    /* 教师手机端页面标题 */
    .teacher-topnav .topnav-page-title {
        display: block;
        font-size: 17px;
        font-weight: 600;
        color: var(--text-primary);
    }
}
@media (min-width: 769px) {
    .teacher-topnav .topnav-page-title { display: none; }
}

/* ============================================
   移动端卡片视图（替代表格）
   ============================================ */
.mobile-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mobile-card-item {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}
.mobile-card-item:active {
    background: #f8f9fb;
}
.mobile-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.mobile-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.mobile-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.mobile-card-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.mobile-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

/* ============================================
   移动端筛选面板（底部弹出）
   ============================================ */
.mobile-filter-btn {
    display: none;
}
@media (max-width: 768px) {
    .mobile-filter-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
}
.mobile-filter-panel {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 250;
    background: var(--bg-card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
    max-height: 70vh;
    overflow-y: auto;
    padding: 20px 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    animation: slideUpModal 0.3s ease;
}
.mobile-filter-panel.active { display: block; }
.mobile-filter-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.mobile-filter-panel-title {
    font-size: 16px;
    font-weight: 600;
}
.mobile-filter-panel-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
}

/* ============================================
   小屏断点补充 (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 20px; }
    .stat-icon { width: 36px; height: 36px; font-size: 18px; }

    .content-body { padding: 12px; }

    .btn { font-size: 13px; padding: 8px 14px; }
}
