/* ========== 菜单分组标题 ========== */
.menu-group-title {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-400);
    letter-spacing: 0.5px;
    border-top: 1px solid var(--gray-200);
    margin-top: 4px;
}
.sidebar-menu:first-child .menu-group-title {
    border-top: none;
    margin-top: 0;
}

/* ========== 后期功能标记 ========== */
.menu-item .badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 8px;
    background: var(--gray-200);
    color: var(--gray-500);
    margin-left: 4px;
    vertical-align: middle;
}
.menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========== 基础变量 ========== */
:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #DBEAFE;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #6366F1;
    --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;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

/* ========== 全局 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
}

/* ========== 导航栏 ========== */
.navbar {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
    color: var(--gray-800);
}
.nav-brand .logo { font-size: 24px; }
.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--gray-600);
}

/* ========== 布局 ========== */
.container {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: 200px;
    background: #fff;
    border-right: 1px solid var(--gray-200);
    padding: 16px 0;
    position: fixed;
    top: 56px;
    bottom: 0;
    overflow-y: auto;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.menu-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.menu-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}
.menu-item .icon { font-size: 16px; }

/* ========== 内容区 ========== */
.content {
    flex: 1;
    margin-left: 200px;
    padding: 24px;
    max-width: calc(100% - 200px);
}

/* ========== 页面标题 ========== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--gray-800);
}
.header-actions {
    display: flex;
    gap: 8px;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.stat-icon.blue { background: var(--primary-light); }
.stat-icon.green { background: #D1FAE5; }
.stat-icon.orange { background: #FEF3C7; }
.stat-icon.purple { background: #EDE9FE; }
.stat-icon.red { background: #FEE2E2; }
.stat-info { display: flex; flex-direction: column; }
.stat-number { font-size: 24px; font-weight: 700; color: var(--gray-800); }
.stat-label { font-size: 13px; color: var(--gray-500); }

/* ========== 区块 ========== */
.section {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.section h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
}

/* ========== 数据表格 ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    background: var(--gray-50);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
.data-table tr:hover td {
    background: var(--gray-50);
}
.id-card {
    font-family: "SF Mono", Monaco, monospace;
    font-size: 12px;
    color: var(--gray-500);
}
.empty-tip {
    text-align: center;
    color: var(--gray-400);
    padding: 32px !important;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-outline { background: #fff; color: var(--gray-600); border: 1px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

/* ========== 徽章 ========== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.badge-admin { background: #FEE2E2; color: #DC2626; }
.badge-teacher { background: #DBEAFE; color: #2563EB; }
.badge-class_teacher { background: #DBEAFE; color: #2563EB; }
.badge-subject_teacher { background: #E0F2FE; color: #0369A1; }
.badge-department { background: #EDE9FE; color: #7C3AED; }
.badge-success { background: #D1FAE5; color: #059669; }
.badge-warning { background: #FEF3C7; color: #D97706; }
.badge-danger { background: #FEE2E2; color: #DC2626; }
.badge-info { background: #DBEAFE; color: #2563EB; }

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.form-hint {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}
.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}
.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.form-row .form-group {
    flex: 1;
    min-width: 200px;
}
.filter-bar {
    margin-bottom: 16px;
}
.filter-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.filter-form input,
.filter-form select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
}

/* ========== 弹窗 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-content.modal-lg { width: 600px; }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-400);
    cursor: pointer;
}
.modal-close:hover { color: var(--gray-600); }

/* ========== 上传区域 ========== */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}
.upload-area:hover {
    border-color: var(--primary);
}
.upload-icon {
    font-size: 36px;
    margin-bottom: 8px;
}
.upload-tips {
    background: var(--gray-50);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.upload-tips h4 {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 4px;
}
.upload-tips ul {
    padding-left: 20px;
    font-size: 12px;
    color: var(--gray-500);
}
.upload-tips li { margin-bottom: 2px; }

/* ========== 提示框 ========== */
.flash-messages {
    margin-bottom: 16px;
}
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    position: relative;
    margin-bottom: 8px;
}
.alert-error { background: #FEE2E2; color: #DC2626; border: 1px solid #FECACA; }
.alert-success { background: #D1FAE5; color: #059669; border: 1px solid #A7F3D0; }
.alert-warning { background: #FEF3C7; color: #D97706; border: 1px solid #FDE68A; }
.alert-info { background: #DBEAFE; color: #2563EB; border: 1px solid #BFDBFE; }
.alert-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}
.page-info {
    font-size: 13px;
    color: var(--gray-500);
}

/* ========== 任务卡片 ========== */
.task-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
}
.task-card:hover {
    box-shadow: var(--shadow-md);
}
.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.task-header h3 {
    font-size: 16px;
    font-weight: 600;
}
.task-desc {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 4px;
}
.task-deadline {
    font-size: 13px;
    color: var(--gray-400);
    margin-bottom: 12px;
}
.task-actions {
    display: flex;
    gap: 8px;
}

/* ========== 信息卡片 ========== */
.info-card {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.info-card.highlight {
    background: var(--primary-light);
    border: 1px solid var(--primary);
}
.info-card h3 {
    margin-bottom: 8px;
    font-size: 15px;
}
.info-card .big-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-dark);
}
.info-card ul {
    padding-left: 20px;
    margin: 8px 0;
    font-size: 14px;
    color: var(--gray-600);
}
.info-card li { margin-bottom: 4px; }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.empty-state h3 {
    font-size: 18px;
    color: var(--gray-600);
    margin-bottom: 8px;
}
.empty-state p {
    color: var(--gray-400);
}

/* ========== 登录页 ========== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-header {
    text-align: center;
    margin-bottom: 32px;
}
.login-header h1 { font-size: 48px; }
.login-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-800);
    margin-top: 8px;
}
.login-header p {
    font-size: 14px;
    color: var(--gray-400);
    margin-top: 4px;
}
.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--gray-400);
}

/* ========== 工具类 ========== */
.text-muted { color: var(--gray-400); }
.text-success { color: var(--success); }

/* ========== 汉堡菜单按钮 ========== */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-700);
    padding: 4px 8px;
    border-radius: 4px;
}
.nav-toggle:hover { background: var(--gray-100); }

/* 侧边栏遮罩（移动端） */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 49;
}
.sidebar-overlay.active { display: block; }

/* ========== 弹窗确认消息样式 ========== */
.flash-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.flash-modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 24px 28px;
    min-width: 320px;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    text-align: center;
}
.flash-modal-box .flash-icon { font-size: 40px; margin-bottom: 12px; }
.flash-modal-box .flash-msg {
    font-size: 15px;
    color: var(--gray-700);
    margin-bottom: 20px;
    line-height: 1.6;
    word-break: break-word;
}
.flash-modal-box .flash-btn {
    padding: 8px 32px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    color: #fff;
}
.flash-modal-box .flash-btn.btn-success-bg { background: var(--success); }
.flash-modal-box .flash-btn.btn-danger-bg { background: var(--danger); }
.flash-modal-box .flash-btn.btn-warning-bg { background: var(--warning); }
.flash-modal-box .flash-btn.btn-info-bg { background: var(--primary); }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 50;
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 12px rgba(0,0,0,0.1);
    }
    .content { margin-left: 0; max-width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; }
    .navbar { padding: 0 12px; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 6px 8px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .header-actions { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .nav-brand span:last-child { display: none; }
}
