/* ================================================
   清大AI学平台 - 统一样式系统 v2.0
   保持侧边栏 #4A90D9 蓝色渐变不变
   ================================================ */

/* 基础变量 */
:root {
    --primary: #4A90D9;
    --primary-dark: #3A7BC8;
    --primary-light: #67B8FF;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --purple: #8B5CF6;
    --bg-light: #f5f7fa;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: PingFang SC, Microsoft YaHei, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 侧边栏 - 保持蓝色渐变不变 */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: linear-gradient(180deg, #4A90D9, #3A7BC8);
    color: white;
    z-index: 100;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(74,144,217,0.25);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    text-align: center;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sidebar-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sidebar-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    border-radius: var(--radius-sm);
    margin: 2px 12px;
    transition: all 0.25s ease;
    font-size: 14px;
    position: relative;
}

.menu-item:hover {
    background: rgba(255,255,255,0.15);
    color: white;
    transform: translateX(4px);
}

.menu-item.active {
    background: rgba(255,255,255,0.2);
    color: white;
    font-weight: 500;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: white;
    border-radius: 0 4px 4px 0;
}

.menu-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.12);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: all 0.25s;
}

.menu-item:hover .menu-icon,
.menu-item.active .menu-icon {
    background: rgba(255,255,255,0.2);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    opacity: 0.8;
}

.logout-btn {
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* 主内容区 */
.main-content {
    margin-left: 260px;
    padding: 28px 32px;
    min-height: 100vh;
    background: var(--bg-light);
}

/* 页面标题 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title i {
    color: var(--primary);
}

/* 卡片组件 */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    transition: all 0.25s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: var(--primary);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card.blue::before { background: linear-gradient(90deg, #4A90D9, #67B8FF); }
.stat-card.green::before { background: linear-gradient(90deg, #10B981, #34D399); }
.stat-card.orange::before { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.stat-card.purple::before { background: linear-gradient(90deg, #8B5CF6, #A78BFA); }
.stat-card.red::before { background: linear-gradient(90deg, #EF4444, #F87171); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.stat-card.blue .stat-icon { background: rgba(74,144,217,0.1); color: #4A90D9; }
.stat-card.green .stat-icon { background: rgba(16,185,129,0.1); color: #10B981; }
.stat-card.orange .stat-icon { background: rgba(245,158,11,0.1); color: #F59E0B; }
.stat-card.purple .stat-icon { background: rgba(139,92,246,0.1); color: #8B5CF6; }
.stat-card.red .stat-icon { background: rgba(239,68,68,0.1); color: #EF4444; }

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.2;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-trend {
    font-size: 12px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(74,144,217,0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74,144,217,0.4);
}

.btn-secondary {
    background: #f3f4f6;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
}

/* 表格 */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    text-align: left;
    padding: 14px 16px;
    background: #f9fafb;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--text-primary);
}

.table tr:hover td {
    background: #f9fafb;
}

.table tr:last-child td {
    border-bottom: none;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-success { background: rgba(16,185,129,0.1); color: #10B981; }
.badge-warning { background: rgba(245,158,11,0.1); color: #F59E0B; }
.badge-danger { background: rgba(239,68,68,0.1); color: #EF4444; }
.badge-info { background: rgba(74,144,217,0.1); color: #4A90D9; }
.badge-purple { background: rgba(139,92,246,0.1); color: #8B5CF6; }

/* 表单 */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    background: white;
    transition: all 0.25s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74,144,217,0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 520px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #e5e7eb;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: flex-end;
}

/* 过滤器栏 */
.filter-bar {
    background: white;
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-item label {
    font-size: 14px;
    color: var(--text-secondary);
}

.filter-item select,
.filter-item input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    min-width: 140px;
}

/* 分页 */
.pagination {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}

.pagination button {
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: #f3f4f6;
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* 加载动画 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 移动端菜单按钮 */
.menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 150;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
}

/* 快捷操作卡片 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.quick-action {
    background: white;
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.quick-action:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.quick-action i {
    font-size: 32px;
    margin-bottom: 12px;
}

.quick-action.blue i { color: var(--primary); }
.quick-action.green i { color: var(--success); }
.quick-action.orange i { color: var(--warning); }
.quick-action.purple i { color: var(--purple); }

.quick-action h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.quick-action p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 响应式适配 */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    .main-content {
        margin-left: 220px;
        padding: 24px;
    }
    .page-title {
        font-size: 22px;
    }
}


@media (max-width: 480px) {
    .page-title {
        font-size: 18px;
    }
    .stat-value {
        font-size: 26px;
    }
    .quick-actions {
        grid-template-columns: 1fr;
    }
    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    .modal-content {
        padding: 20px;
        width: 95%;
    }
}

/* 动画 */
.fade-in {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar .progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* 工具提示 */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: #333;
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}
/* ================================================
   手机端 Sidebar 抽屉式导航 - 20240530
   ================================================ */

/* 移动端遮罩层 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    display: block;
}

/* 移动端汉堡菜单按钮 */
.menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 150;
    background: linear-gradient(135deg, #4A90D9, #3A7BC8);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(74,144,217,0.4);
    align-items: center;
    justify-content: center;
}

.menu-toggle:active {
    transform: scale(0.95);
}

/* 手机端响应式 - 抽屉式侧边栏 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        transition: transform 0.3s ease;
        z-index: 100;
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    }
    
    .main-content {
        margin-left: 0;
        padding: 70px 12px 12px;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    /* 页面标题适配 */
    .page-title {
        font-size: 18px;
    }
    
    /* 卡片适配 */
    .card {
        padding: 14px;
        margin-bottom: 14px;
    }
    
    /* 统计卡片适配 */
    .stat-card {
        padding: 14px;
    }
    
    .stat-value {
        font-size: 26px;
    }
    
    /* 表格适配 */
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
    }
    
    /* 按钮适配 */
    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    /* 筛选器适配 */
    .filter-bar {
        padding: 12px;
    }
    
    .filter-item select,
    .filter-item input {
        padding: 8px 10px;
        font-size: 13px;
        min-width: 120px;
    }
    
    /* 网格适配 */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    /* 模态框适配 */
    .modal-content {
        padding: 16px;
        width: 95%;
        margin: 10px auto;
    }
    
    .modal-header {
        margin-bottom: 14px;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    /* 分页适配 */
    .pagination button {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    /* 隐藏手机端不需要的元素 */
    .hide-mobile {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 16px;
    }
    
    .stat-value {
        font-size: 22px;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        padding: 14px;
    }
}
