/* ==========================================
   考试管理系统 - 主样式
   ========================================== */

:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1e293b;
    --sidebar-color: #e2e8f0;
    --sidebar-hover: #334155;
    --sidebar-active: #3b82f6;
    --topbar-height: 56px;
    --primary-color: #3b82f6;
    --body-bg: #f1f5f9;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--body-bg);
    color: #1e293b;
    font-size: 14px;
}

.wrapper { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-color);
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    transition: margin-left 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1rem 1.2rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar-nav {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.2rem;
    color: var(--sidebar-color);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav li a.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
    font-weight: 600;
}

.sidebar-nav li a i {
    font-size: 1rem;
    margin-right: 0.75rem;
    width: 1.2rem;
    text-align: center;
}

/* 主内容 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* 顶部栏 */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sidebar-toggle { background: none; border: none; color: #475569; }
.topbar-right { display: flex; align-items: center; }

/* 内容区 */
.content-area {
    flex: 1;
    padding: 1.5rem;
}

.content-footer {
    padding: 1rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

/* 卡片 */
.stat-card {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.stat-card .stat-title { font-size: 0.85rem; color: #64748b; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: #1e293b; }
.stat-card .stat-icon { font-size: 2rem; opacity: 0.15; }

/* 表格 */
.table-card {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}

.table-card .table-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.table-card .table-header h5 { margin: 0; font-weight: 600; }

.table-card table { margin: 0; }
.table-card th { background: #f8fafc; font-weight: 600; font-size: 0.85rem; color: #475569; }
.table-card td { vertical-align: middle; font-size: 0.9rem; }

/* 表单页 */
.form-card {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* 试卷打印样式 */
.paper-content {
    font-family: "SimSun", "宋体", serif;
    max-width: 210mm;
    margin: 0 auto;
    padding: 20mm 15mm;
    line-height: 1.8;
    background: #fff;
}

.paper-content h2 { font-size: 18pt; margin-bottom: 10px; }
.paper-content .paper-header hr { margin: 10px 0; }

.paper-section { margin: 16px 0; }
.paper-section h4 { font-size: 12pt; border-bottom: 1px dashed #ccc; padding-bottom: 4px; }

.question-item { margin: 8px 0; }
.question-item .q-content { font-size: 11pt; margin-bottom: 4px; }

.answer-line {
    border-bottom: 1px solid #ddd;
    height: 28px;
    margin: 4px 30px 4px 24px;
}

/* 试卷模板特殊样式 */
.english-grid td {
    border-bottom: 1px solid #333;
    height: 28px;
    padding: 4px 8px;
}
.english-grid tr:nth-child(4n) td {
    border-bottom: 2px solid #333;
}

.tian-grid {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 1px solid #333;
    position: relative;
    margin: 2px;
}
.tian-grid::before {
    content: "";
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    border-top: 1px dashed #aaa;
}
.tian-grid::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    border-left: 1px dashed #aaa;
}

/* 答题界面 */
.exam-panel { max-width: 900px; margin: 0 auto; }
.exam-question {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.exam-question.correct { border-color: #22c55e; background: #f0fdf4; }
.exam-question.wrong { border-color: #ef4444; background: #fef2f2; }

.exam-question .badge-qnum {
    background: var(--primary-color);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 6px;
}

/* 在线答题计时器 */
.exam-timer {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--primary-color);
    color: #fff;
    text-align: center;
    padding: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}
.exam-timer.warning { background: #f59e0b; }
.exam-timer.danger { background: #ef4444; }

/* 标签 */
.badge-q-type { font-size: 0.75rem; }

/* 批量操作栏 */
.batch-bar {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    .sidebar.show {
        margin-left: 0;
    }
    .main-content {
        margin-left: 0;
    }
    .content-area { padding: 1rem; }
    .paper-content { padding: 10mm 8mm; }
}

@media (max-width: 576px) {
    .table-card .table-header { flex-direction: column; align-items: flex-start; }
}

/* 打印 */
@media print {
    body { background: #fff; }
    .sidebar, .topbar, .content-footer, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0; }
    .paper-content { max-width: none; padding: 0; }
}

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}
.login-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
}
.login-box h3 {
    text-align: center;
    font-weight: 700;
    margin-bottom: 1.75rem;
    color: #1e293b;
}
