/*
 * 校园智能阅卷平台 — 全局自定义样式
 * 配合 Bootstrap 使用，纯离线环境，无外部 CDN 依赖
 */

/* ==================== 通用样式 ==================== */

:root {
    --primary: #0d6efd;
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
    --sidebar-width: 240px;
    --header-height: 56px;
}

body {
    font-family: "Microsoft YaHei", "微软雅黑", -apple-system, sans-serif;
    background-color: #f5f6fa;
    min-height: 100vh;
}

/* ==================== 布局 ==================== */

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

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a237e 0%, #283593 100%);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

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

.sidebar-brand h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-brand small {
    opacity: 0.7;
    font-size: 0.75rem;
}

.sidebar-nav {
    padding: 8px 0;
}

.sidebar-nav .nav-item {
    padding: 0;
}

.sidebar-nav .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-left-color: #fff;
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* 顶部栏 */
.top-bar {
    background: #fff;
    padding: 12px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
}

.top-bar h4 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.top-bar .btn {
    font-size: 0.85rem;
}

/* 内容区 */
.content-area {
    padding: 24px;
}

/* ==================== 页面卡片 ==================== */

.card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 16px 20px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* 统计卡片 */
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #888;
    margin-top: 4px;
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }

/* ==================== 表格增强 ==================== */

.table-container {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* ==================== 阅卷专用样式 ==================== */

.grading-container {
    display: flex;
    gap: 16px;
    height: calc(100vh - 140px);
}

.grading-left {
    width: 280px;
    flex-shrink: 0;
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.grading-center {
    flex: 1;
    background: #f0f0f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.grading-center img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.grading-right {
    width: 320px;
    flex-shrink: 0;
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 16px;
}

/* 评分面板 */
.score-input-group {
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    background: #fafafa;
}

.score-input-group .question-label {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.score-input-group .score-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-input-group input {
    width: 80px;
    text-align: center;
}

/* 评分规则面板 */
.rules-panel {
    margin-top: 16px;
}

.rule-chip {
    display: inline-block;
    padding: 4px 10px;
    margin: 2px;
    background: #e3f2fd;
    border-radius: 16px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.rule-chip:hover {
    background: #bbdefb;
}

/* ==================== 扫描管理样式 ==================== */

.scan-device-list {
    list-style: none;
    padding: 0;
}

.scan-device-list li {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.scan-device-list li:hover {
    background: #f5f5f5;
}

.scan-device-list li.active {
    background: #e3f2fd;
    border-left: 3px solid var(--primary);
}

.scan-preview-area {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8e8e8;
    border-radius: 8px;
    border: 2px dashed #ccc;
    color: #999;
    font-size: 1.1rem;
}

/* ==================== 模板编辑器样式 ==================== */

.template-canvas-container {
    position: relative;
    display: inline-block;
    border: 1px solid #ddd;
    background: #fff;
}

.template-canvas-container canvas {
    display: block;
}

.region-overlay {
    position: absolute;
    border: 2px solid #0d6efd;
    background: rgba(13, 110, 253, 0.1);
    cursor: move;
}

/* ==================== 登录页面 ==================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a237e 0%, #4a148c 100%);
}

.login-card {
    width: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    padding: 40px;
}

.login-card h3 {
    text-align: center;
    margin-bottom: 8px;
    color: #333;
}

.login-card .subtitle {
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 32px;
}

/* ==================== 响应式适配 ==================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .grading-container {
        flex-direction: column;
    }
    .grading-left,
    .grading-right {
        width: 100%;
    }
}

/* ==================== 通用工具类 ==================== */

.cursor-pointer { cursor: pointer; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.85rem; }
.overflow-hidden { overflow: hidden; }

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 500;
}

.status-draft { background: #e0e0e0; color: #555; }
.status-active { background: #e8f5e9; color: #2e7d32; }
.status-scanning { background: #fff3e0; color: #e65100; }
.status-grading { background: #e3f2fd; color: #1565c0; }
.status-completed { background: #e8f5e9; color: #1b5e20; }
.status-archived { background: #f3e5f5; color: #6a1b9a; }
.status-pending { background: #fff8e1; color: #f57f17; }
.status-paused { background: #fce4ec; color: #c62828; }
