/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; background: #f0f2f5; color: #333; min-height: 100vh; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #001529; color: #fff; padding: 20px 0; }
.sidebar .logo { text-align: center; font-size: 20px; font-weight: bold; padding: 10px 20px 20px; border-bottom: 1px solid #002140; margin-bottom: 10px; }
.sidebar .nav-item { display: block; color: #a6adb4; padding: 12px 24px; text-decoration: none; font-size: 14px; transition: all 0.2s; }
.sidebar .nav-item:hover, .sidebar .nav-item.active { color: #fff; background: #1890ff; }
.main { flex: 1; padding: 24px; overflow-y: auto; }
.header { background: #fff; padding: 16px 24px; margin-bottom: 24px; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); display: flex; justify-content: space-between; align-items: center; }
.header h2 { font-size: 18px; }
.content { background: #fff; padding: 24px; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 14px; transition: border-color 0.2s; }
.form-control:focus { outline: none; border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.2); }
select.form-control { background: #fff; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* Buttons */
.btn { display: inline-block; padding: 8px 20px; border: none; border-radius: 4px; font-size: 14px; cursor: pointer; text-decoration: none; transition: all 0.2s; }
.btn-primary { background: #1890ff; color: #fff; }
.btn-primary:hover { background: #40a9ff; }
.btn-success { background: #52c41a; color: #fff; }
.btn-success:hover { background: #73d13d; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #ff7875; }
.btn-warning { background: #faad14; color: #fff; }
.btn-default { background: #fff; color: #333; border: 1px solid #d9d9d9; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Tables */
.table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.table th, .table td { padding: 12px; border-bottom: 1px solid #f0f0f0; text-align: left; font-size: 14px; }
.table th { background: #fafafa; font-weight: 600; }
.table tr:hover { background: #fafafa; }

/* Cards */
.card { background: #fff; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); padding: 24px; margin-bottom: 16px; }

/* Badges / Tags */
.tag { display: inline-block; padding: 2px 8px; border-radius: 2px; font-size: 12px; }
.tag-blue { background: #e6f7ff; color: #1890ff; }
.tag-green { background: #f6ffed; color: #52c41a; }
.tag-red { background: #fff1f0; color: #ff4d4f; }
.tag-orange { background: #fff7e6; color: #fa8c16; }

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mr-8 { margin-right: 8px; }
.float-right { float: right; }
.clearfix::after { content: ''; display: table; clear: both; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.hidden { display: none !important; }

/* Login / Register page */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); width: 400px; }
.login-box h1 { text-align: center; margin-bottom: 32px; color: #333; font-size: 24px; }

/* Filter bar */
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; padding: 16px; background: #fafafa; border-radius: 4px; }
.filter-bar .form-control { width: auto; min-width: 150px; }
.filter-bar label { margin: 0; font-weight: normal; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 8px; margin: 16px 0; }
.pagination button { padding: 6px 12px; border: 1px solid #d9d9d9; background: #fff; border-radius: 4px; cursor: pointer; }
.pagination button.active { background: #1890ff; color: #fff; border-color: #1890ff; }
.pagination button:disabled { cursor: not-allowed; opacity: 0.5; }

/* Modal */
.modal-mask { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.45); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-box { background: #fff; border-radius: 8px; padding: 24px; min-width: 400px; max-width: 600px; max-height: 80vh; overflow-y: auto; }
.modal-box h3 { margin-bottom: 16px; }

/* Exam page special */
.exam-header { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 12px 24px; margin-bottom: 16px; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); position: sticky; top: 0; z-index: 100; }
.exam-timer { font-size: 20px; font-weight: bold; color: #ff4d4f; }
.exam-timer.warning { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.5; } }
.question-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.question-nav .q-btn { width: 36px; height: 36px; border: 1px solid #d9d9d9; border-radius: 4px; text-align: center; line-height: 36px; cursor: pointer; font-size: 13px; background: #fff; }
.question-nav .q-btn.active { background: #1890ff; color: #fff; border-color: #1890ff; }
.question-nav .q-btn.answered { background: #e6f7ff; border-color: #91d5ff; }
.question-nav .q-btn.marked { background: #fff7e6; border-color: #ffd591; }
.question-card { background: #fff; padding: 24px; border-radius: 4px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.question-card .q-content { font-size: 16px; margin-bottom: 16px; line-height: 1.6; }
.question-card .q-option { display: block; padding: 10px 16px; margin-bottom: 8px; border: 1px solid #e8e8e8; border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.question-card .q-option:hover { border-color: #1890ff; }
.question-card .q-option.selected { border-color: #1890ff; background: #e6f7ff; }
.question-card .q-score { color: #999; font-size: 13px; margin-top: 8px; }

/* Stats dashboard */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; padding: 24px; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); text-align: center; }
.stat-card .stat-num { font-size: 32px; font-weight: bold; color: #1890ff; }
.stat-card .stat-label { color: #999; margin-top: 8px; }

/* Toast */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); padding: 12px 24px; border-radius: 4px; color: #fff; z-index: 2000; animation: slideDown 0.3s; }
.toast-success { background: #52c41a; }
.toast-error { background: #ff4d4f; }
.toast-info { background: #1890ff; }
@keyframes slideDown { from { top: -50px; opacity: 0; } to { top: 24px; opacity: 1; } }
