/* -*- coding: utf-8 -*- */
/**
 * 华师辅导AI学情管理系统 - Web端全局样式
 */

:root {
    --primary: #4a90d9;
    --primary-hover: #357abd;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #ff4d4f;
    --info: #1890ff;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #333333;
    --text-secondary: #666666;
    --border: #e8e8e8;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 6px;
    --nav-height: 56px;
}

* { 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(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* 导航栏 */
.nav-bar {
    background: var(--primary);
    color: #fff;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}
.nav-bar .logo {
    font-size: 18px;
    font-weight: 600;
    margin-right: 32px;
    white-space: nowrap;
}
.nav-bar a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}
.nav-bar a:hover { background: rgba(255,255,255,0.15); color: #fff; }
.nav-bar a.active { background: rgba(255,255,255,0.25); color: #fff; font-weight: 500; }

/* 页面容器 */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

/* 页面标题 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.page-header h2 {
    font-size: 20px;
    font-weight: 600;
}

/* 筛选区域 */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}
.filter-bar label {
    font-size: 14px;
    color: var(--text-secondary);
}
.filter-bar select,
.filter-bar input[type="text"],
.filter-bar input[type="date"],
.filter-bar input[type="number"] {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    min-width: 120px;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    background: #fafafa;
    padding: 12px 10px;
    text-align: left;
    font-weight: 500;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}
.data-table tr:nth-child(even) { background: #fafafa; }
.data-table tr:hover { background: #f0f5ff; }

/* 按钮 */
.btn {
    display: inline-block;
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.5;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}
.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: var(--text-secondary); }

/* 弹窗 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    min-width: 420px;
    max-width: 640px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}
.modal-box h3 {
    margin-bottom: 16px;
    font-size: 16px;
}
.modal-box .form-group {
    margin-bottom: 14px;
}
.modal-box .form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    color: var(--text-secondary);
}
.modal-box .form-group input,
.modal-box .form-group select,
.modal-box .form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
}
.modal-box .form-group textarea {
    min-height: 80px;
    resize: vertical;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

/* 状态标签 */
.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}
.status-tag.active { background: #f6ffed; color: #52c41a; }
.status-tag.graduated { background: #e6f7ff; color: #1890ff; }
.status-tag.transferred { background: #fff7e6; color: #faad14; }
.status-tag.draft { background: #f5f5f5; color: #999; }
.status-tag.pending { background: #fff7e6; color: #faad14; }
.status-tag.approved { background: #f6ffed; color: #52c41a; }
.status-tag.rejected { background: #fff1f0; color: #ff4d4f; }

/* Toast提示 */
.toast-container {
    position: fixed;
    top: 70px;
    right: 24px;
    z-index: 300;
}
.toast {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #fff;
    animation: slideIn 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 首页卡片网格 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary);
}
.stat-card .stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.module-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    display: block;
}
.module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.module-card .module-icon {
    font-size: 32px;
    margin-bottom: 8px;
}
.module-card .module-title {
    font-size: 16px;
    font-weight: 500;
}

/* Markdown内容渲染 */
.md-content h1, .md-content h2, .md-content h3 {
    margin-top: 16px;
    margin-bottom: 8px;
}
.md-content h2 { font-size: 18px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.md-content h3 { font-size: 16px; }
.md-content p { margin-bottom: 8px; }
.md-content ul, .md-content ol { padding-left: 20px; margin-bottom: 8px; }
.md-content li { margin-bottom: 4px; }
.md-content strong { font-weight: 600; }

/* 开关 */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    display: inline-block;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 22px;
    cursor: pointer;
    transition: 0.3s;
}
.toggle-switch .slider:before {
    content: "";
    position: absolute;
    width: 18px; height: 18px;
    left: 2px; bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle-switch input:checked + .slider { background: var(--success); }
.toggle-switch input:checked + .slider:before { transform: translateX(18px); }

/* 响应式 */
@media (max-width: 768px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .module-grid { grid-template-columns: repeat(2, 1fr); }
    .nav-bar a { padding: 6px 8px; font-size: 12px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
}
