Files
EXAM-MASTER/static/style.css
CiE-XinYuChen e2eeb326be fix: 修复浏览题目页面筛选和UI问题
- 修复移动端筛选功能:修正JavaScript获取题目类型的数据属性问题
- 改进筛选功能:从前端筛选改为后端全站筛选,支持跨页面搜索
- 修复电脑端UI串位问题:添加完整的Bootstrap工具类CSS定义
- 修复翻页组件:添加完整的翻页样式CSS,确保样式一致性
- 优化搜索体验:搜索框保持当前值,清除按钮状态正确显示
- 翻页链接保持筛选参数:确保筛选状态在翻页时不丢失

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-26 12:24:10 +00:00

1706 lines
34 KiB
CSS

/* style.css - 现代化响应式设计 */
/* ====== 基础设置 ====== */
:root {
/* 颜色变量 */
--primary-color: #4361ee;
--primary-hover: #3a56e7;
--secondary-color: #3f8efc;
--success-color: #2ec4b6;
--danger-color: #e63946;
--warning-color: #ffb703;
--info-color: #4cc9f0;
--light-color: #f8f9fa;
--dark-color: #212529;
--gray-100: #f8f9fa;
--gray-200: #e9ecef;
--gray-300: #dee2e6;
--gray-400: #ced4da;
--gray-500: #adb5bd;
--gray-600: #6c757d;
--gray-700: #495057;
--gray-800: #343a40;
--gray-900: #212529;
/* 字体与尺寸 */
--font-main: 'Roboto', 'Noto Sans SC', sans-serif;
--border-radius: 0.5rem;
--box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
--transition: all 0.3s ease;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
scroll-behavior: smooth;
}
body {
font-family: var(--font-main);
background: linear-gradient(135deg, #f0f7ff 0%, #eaf5ff 100%);
color: var(--gray-800);
line-height: 1.6;
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* ====== 顶部导航栏 ====== */
nav {
background-color: #fff;
box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
padding: 0.8rem 1.5rem;
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
top: 0;
z-index: 1000;
transition: var(--transition);
}
.nav-left {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.nav-logo {
color: var(--primary-color);
font-size: 1.5rem;
font-weight: 700;
text-decoration: none;
margin-right: 2rem;
display: flex;
align-items: center;
}
.nav-logo i {
margin-right: 0.5rem;
}
.nav-links {
display: flex;
gap: 1rem;
flex-wrap: wrap;
justify-content: center; /* 电脑模式下剧中 */
width: 100%;
}
.nav-link {
color: var(--gray-700);
text-decoration: none;
font-size: 1rem;
padding: 0.5rem 0.75rem;
border-radius: var(--border-radius);
transition: var(--transition);
}
.nav-link:hover {
background-color: var(--gray-100);
color: var(--primary-color);
}
.nav-link.active {
background-color: var(--primary-color);
color: white;
}
.nav-right .logout-link {
background-color: var(--danger-color);
padding: 0.5rem 1rem;
border-radius: var(--border-radius);
color: white;
text-decoration: none;
transition: var(--transition);
display: inline-block;
}
.nav-right .logout-link:hover {
background-color: #d32f2f;
transform: translateY(-2px);
}
.menu-toggle {
display: none;
background: var(--primary-color);
border: none;
font-size: 1.5rem;
color: white;
cursor: pointer;
width: 42px;
height: 42px;
border-radius: 50%;
align-items: center;
justify-content: center;
transition: var(--transition);
box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
z-index: 1001;
}
/* ====== 主内容容器 ====== */
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 1.5rem;
flex: 1;
}
.card {
background-color: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
padding: 1.5rem;
margin-bottom: 1.5rem;
transition: var(--transition);
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 0.8rem 1.5rem rgba(0, 0, 0, 0.1);
}
.card-title {
color: var(--gray-800);
font-size: 1.5rem;
margin-bottom: 1rem;
font-weight: 600;
}
.card-subtitle {
color: var(--gray-600);
font-size: 1.1rem;
margin-bottom: 1rem;
}
/* ====== 表单元素 ====== */
.form-group {
margin-bottom: 1.5rem;
}
.form-label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: var(--gray-700);
}
.form-control {
width: 100%;
padding: 0.75rem 1rem;
font-size: 1rem;
line-height: 1.5;
color: var(--gray-700);
background-color: #fff;
background-clip: padding-box;
border: 1px solid var(--gray-300);
border-radius: var(--border-radius);
transition: var(--transition);
-webkit-appearance: none; /* 移除iOS默认样式 */
appearance: none;
/* 移动端触摸优化 */
touch-action: manipulation;
}
.form-control:focus {
border-color: var(--primary-color);
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}
/* 输入框优化 */
input.form-control {
min-height: 2.75rem; /* 确保触摸区域足够大 */
}
/* 为移动设备优化的选择框 */
select.form-control {
cursor: pointer;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M3.5 4.5L6 7l2.5-2.5L10 6l-4 4-4-4z'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 1rem center;
background-size: 0.75rem;
padding-right: 2.5rem;
}
/* 为移动设备优化的复选框和单选框 */
.option-checkbox,
input[type="checkbox"],
input[type="radio"] {
min-width: 1.25rem;
min-height: 1.25rem;
/* 确保足够大的触摸区域 */
}
/* 移动端表单布局优化 */
@media (max-width: 768px) {
.form-row {
flex-direction: column;
}
.form-group {
margin-bottom: 1.25rem;
}
.form-control {
font-size: 16px; /* 避免iOS缩放 */
padding: 0.7rem 0.9rem;
}
/* 增大按钮间距,防止误触 */
.btn + .btn {
margin-top: 0.5rem;
margin-left: 0 !important;
}
}
/* 更小屏幕的表单元素优化 */
@media (max-width: 480px) {
.form-control {
padding: 0.65rem 0.85rem;
}
.form-label {
font-size: 0.9rem;
}
}
/* ====== 按钮样式 ====== */
.btn {
display: inline-block;
font-weight: 500;
text-align: center;
white-space: nowrap;
vertical-align: middle;
user-select: none;
border: 1px solid transparent;
padding: 0.75rem 1.5rem;
font-size: 1rem;
line-height: 1.5;
border-radius: var(--border-radius);
transition: var(--transition);
cursor: pointer;
/* 触摸优化 */
touch-action: manipulation;
-webkit-tap-highlight-color: transparent;
position: relative;
overflow: hidden;
/* 确保移动端触摸区域足够大 */
min-height: 2.75rem;
}
/* 添加触摸反馈效果 */
.btn::after {
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events: none;
background-image: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 10.01%);
background-repeat: no-repeat;
background-position: 50%;
transform: scale(10, 10);
opacity: 0;
transition: transform 0.5s, opacity 0.8s;
}
.btn:active::after {
transform: scale(0, 0);
opacity: 0.3;
transition: 0s;
}
.btn:focus {
outline: 0;
box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}
.btn-primary {
color: #fff;
background-color: var(--primary-color);
border-color: var(--primary-color);
}
.btn-primary:hover {
background-color: var(--primary-hover);
border-color: var(--primary-hover);
transform: translateY(-2px);
}
.btn-success {
color: #fff;
background-color: var(--success-color);
border-color: var(--success-color);
}
.btn-success:hover {
background-color: #25a99d;
border-color: #25a99d;
transform: translateY(-2px);
}
.btn-danger {
color: #fff;
background-color: var(--danger-color);
border-color: var(--danger-color);
}
.btn-danger:hover {
background-color: #d32f2f;
border-color: #d32f2f;
transform: translateY(-2px);
}
.btn-warning {
color: #212529;
background-color: var(--warning-color);
border-color: var(--warning-color);
}
.btn-warning:hover {
background-color: #e5a602;
border-color: #e5a602;
transform: translateY(-2px);
}
.btn-outline-primary {
color: var(--primary-color);
background-color: transparent;
border-color: var(--primary-color);
}
.btn-outline-primary:hover {
color: #fff;
background-color: var(--primary-color);
transform: translateY(-2px);
}
.btn-sm {
padding: 0.5rem 1rem;
font-size: 0.875rem;
min-height: 2.25rem;
}
.btn-lg {
padding: 1rem 2rem;
font-size: 1.25rem;
min-height: 3.25rem;
}
.btn-block {
display: block;
width: 100%;
}
/* 移动端按钮优化 */
@media (max-width: 768px) {
.btn {
padding: 0.7rem 1.25rem;
}
/* 增大按钮之间的间距以避免误触 */
.btn + .btn {
margin-top: 0.75rem;
}
/* 移动端交互元素适配 */
.card-actions .btn,
.question-actions .btn {
width: 100%;
margin-bottom: 0.5rem;
}
}
/* 更小屏幕的按钮优化 */
@media (max-width: 480px) {
.btn {
padding: 0.65rem 1.15rem;
font-size: 0.95rem;
}
.btn-sm {
padding: 0.45rem 0.9rem;
font-size: 0.85rem;
}
.btn-lg {
padding: 0.9rem 1.75rem;
font-size: 1.1rem;
}
}
/* ====== 徽章 ====== */
.badge {
display: inline-block;
padding: 0.25rem 0.75rem;
font-size: 0.875rem;
font-weight: 500;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: 50rem;
}
.badge-primary { background-color: var(--primary-color); color: white; }
.badge-success { background-color: var(--success-color); color: white; }
.badge-danger { background-color: var(--danger-color); color: white; }
.badge-warning { background-color: var(--warning-color); color: var(--gray-800); }
.badge-info { background-color: var(--info-color); color: white; }
/* ====== 答题页面样式 ====== */
.question-container {
background-color: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
padding: 2rem;
margin-bottom: 2rem;
}
.question-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1.5rem;
}
.question-number {
display: inline-block;
padding: 0.35rem 0.75rem;
font-size: 1rem;
font-weight: 600;
color: white;
background-color: var(--primary-color);
border-radius: var(--border-radius);
}
.question-difficulty {
padding: 0.35rem 0.75rem;
border-radius: var(--border-radius);
font-weight: 500;
}
.difficulty-easy { background-color: #a3e635; color: var(--gray-800); }
.difficulty-medium { background-color: #facc15; color: var(--gray-800); }
.difficulty-hard { background-color: #f87171; color: white; }
.question-stem {
font-size: 1.2rem;
line-height: 1.7;
margin-bottom: 2rem;
color: var(--gray-800);
}
.options-list {
list-style: none;
margin: 0;
padding: 0;
}
.option-item {
margin-bottom: 1rem;
}
.option-label {
display: flex;
align-items: center;
padding: 1rem;
background-color: var(--gray-100);
border: 1px solid var(--gray-300);
border-radius: var(--border-radius);
cursor: pointer;
transition: var(--transition);
/* 移动端触摸优化 */
touch-action: manipulation;
-webkit-tap-highlight-color: transparent;
position: relative;
overflow: hidden;
}
/* 添加触摸反馈效果 */
.option-label::after {
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events: none;
background-image: radial-gradient(circle, rgba(67, 97, 238, 0.1) 10%, transparent 10.01%);
background-repeat: no-repeat;
background-position: 50%;
transform: scale(10, 10);
opacity: 0;
transition: transform 0.5s, opacity 0.8s;
}
.option-label:active::after {
transform: scale(0, 0);
opacity: 0.3;
transition: 0s;
}
.option-label:hover {
background-color: var(--gray-200);
}
/* 选中状态增强 */
.option-item input:checked + .option-text {
font-weight: 500;
color: var(--primary-color);
}
.option-item input:checked ~ .option-label {
background-color: rgba(67, 97, 238, 0.05);
border-color: var(--primary-color);
box-shadow: 0 0 0 1px var(--primary-color);
}
.option-checkbox {
margin-right: 1rem;
transform: scale(1.2);
/* 移动端触摸优化 */
min-width: 1.5rem;
min-height: 1.5rem;
}
.option-text {
flex: 1;
}
/* 移动设备优化 */
@media (max-width: 768px) {
.option-label {
padding: 0.875rem;
}
.option-checkbox {
transform: scale(1.3);
margin-right: 0.75rem;
}
}
@media (max-width: 480px) {
.option-label {
padding: 0.75rem;
}
.option-text {
font-size: 0.95rem;
}
}
.question-actions {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 2rem;
}
.favorite-btn {
display: flex;
align-items: center;
gap: 0.5rem;
background-color: white;
border: 1px solid var(--gray-300);
border-radius: var(--border-radius);
padding: 0.5rem 1rem;
cursor: pointer;
transition: var(--transition);
}
.favorite-btn:hover {
background-color: var(--gray-100);
}
.favorite-btn.active {
background-color: var(--warning-color);
border-color: var(--warning-color);
color: var(--gray-800);
}
.result-message {
margin: 1.5rem 0;
padding: 1rem;
border-radius: var(--border-radius);
font-weight: 500;
}
.result-correct {
background-color: rgba(46, 196, 182, 0.2);
color: #1a8a7e;
border-left: 4px solid var(--success-color);
}
.result-incorrect {
background-color: rgba(230, 57, 70, 0.2);
color: #b71c1c;
border-left: 4px solid var(--danger-color);
}
/* ====== 进度条 ====== */
.progress-container {
margin-bottom: 2rem;
}
.progress-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.75rem;
}
.progress-title {
font-weight: 500;
color: var(--gray-700);
}
.progress-value {
font-weight: 600;
color: var(--primary-color);
}
.progress-bar-container {
width: 100%;
height: 0.75rem;
background-color: var(--gray-200);
border-radius: 1rem;
overflow: hidden;
}
.progress-bar {
height: 100%;
background-color: var(--primary-color);
border-radius: 1rem;
transition: width 0.3s ease;
}
/* ====== 表格样式 ====== */
.table-container {
overflow-x: auto;
margin-bottom: 2rem;
/* 添加移动端水平滚动支持 */
-webkit-overflow-scrolling: touch;
position: relative;
}
/* 添加滚动指示器 */
.table-container::after {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 20px;
background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(0, 0, 0, 0.05));
pointer-events: none;
opacity: 0;
transition: opacity 0.3s;
}
/* 仅在可滚动且非移动设备上显示滚动指示器 */
@media (min-width: 769px) {
.table-container.is-scrollable::after {
opacity: 1;
}
}
.table {
width: 100%;
border-collapse: collapse;
margin-bottom: 1rem;
/* 确保表格在移动设备上不会被压缩 */
table-layout: fixed;
}
.table th,
.table td {
padding: 1rem;
text-align: left;
border-bottom: 1px solid var(--gray-300);
/* 移动端文本处理 */
word-wrap: break-word;
overflow-wrap: break-word;
}
.table th {
font-weight: 600;
color: var(--gray-700);
background-color: var(--gray-100);
/* 粘性表头,在水平滚动时保持可见 */
position: sticky;
top: 0;
z-index: 10;
}
.table tbody tr {
transition: var(--transition);
}
.table tbody tr:hover {
background-color: rgba(67, 97, 238, 0.05);
}
/* 响应式表格 - 移动优化 */
@media (max-width: 768px) {
.table-container {
margin-left: -1rem;
margin-right: -1rem;
width: calc(100% + 2rem);
padding: 0 1rem;
/* 添加滚动提示 */
scrollbar-width: thin;
scrollbar-color: var(--gray-300) transparent;
}
.table th,
.table td {
padding: 0.85rem 0.75rem;
font-size: 0.95rem;
}
/* 特定表格列宽调整 - 适用于答题历史表格 */
.table th:nth-child(1),
.table td:nth-child(1) {
width: 40px;
min-width: 40px;
}
.table th:nth-child(2),
.table td:nth-child(2) {
width: 60px;
min-width: 60px;
}
.table th:nth-child(3),
.table td:nth-child(3) {
width: auto;
min-width: 120px;
}
.table th:nth-child(4),
.table td:nth-child(4) {
width: 60px;
min-width: 60px;
}
.table th:nth-child(5),
.table td:nth-child(5) {
width: 80px;
min-width: 60px;
}
.table th:nth-child(6),
.table td:nth-child(6) {
width: 100px;
min-width: 100px;
}
/* 为小屏幕添加水平滚动提示 */
.table-scroll-hint {
display: block;
text-align: center;
color: var(--gray-600);
font-size: 0.85rem;
margin-bottom: 0.5rem;
opacity: 0.7;
}
/* 卡片式移动表格 - 用于特定表格 */
.table.table-card-mobile {
border: 0;
}
.table.table-card-mobile thead {
display: none; /* 隐藏表头 */
}
.table.table-card-mobile tr {
display: block;
margin-bottom: 1rem;
border: 1px solid var(--gray-300);
border-radius: var(--border-radius);
}
.table.table-card-mobile td {
display: block;
text-align: right;
border-bottom: 1px solid var(--gray-200);
position: relative;
padding-left: 50%;
}
.table.table-card-mobile td:last-child {
border-bottom: 0;
}
.table.table-card-mobile td::before {
content: attr(data-label);
position: absolute;
left: 0.75rem;
width: 45%;
text-align: left;
font-weight: 600;
color: var(--gray-700);
}
}
@media (max-width: 480px) {
.table th,
.table td {
padding: 0.75rem 0.5rem;
font-size: 0.9rem;
}
.nav-right .logout-link {
width: 95%;
}
}
/* ====== 卡片样式 ====== */
.card-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 1.5rem;
}
.stat-card {
background-color: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
padding: 1.5rem;
display: flex;
flex-direction: column;
transition: var(--transition);
}
.stat-card:hover {
transform: translateY(-5px);
box-shadow: 0 0.8rem 1.5rem rgba(0, 0, 0, 0.1);
}
.stat-icon {
width: 3rem;
height: 3rem;
background-color: rgba(67, 97, 238, 0.1);
color: var(--primary-color);
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
margin-bottom: 1rem;
font-size: 1.5rem;
}
.stat-value {
font-size: 2rem;
font-weight: 700;
color: var(--gray-800);
margin-bottom: 0.5rem;
}
.stat-label {
color: var(--gray-600);
font-size: 1rem;
}
/* ====== 登录/注册页面 ====== */
.auth-container {
max-width: 400px;
margin: 2rem auto;
padding: 2rem;
background-color: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
}
.auth-logo {
text-align: center;
margin-bottom: 2rem;
}
.auth-title {
text-align: center;
color: var(--gray-800);
font-size: 1.75rem;
margin-bottom: 2rem;
}
.auth-form {
margin-bottom: 1.5rem;
}
.auth-footer {
text-align: center;
margin-top: 1.5rem;
}
.auth-footer a {
color: var(--primary-color);
text-decoration: none;
font-weight: 500;
}
.auth-footer a:hover {
text-decoration: underline;
}
/* ====== 提醒消息 ====== */
.alert {
padding: 1rem;
margin-bottom: 1.5rem;
border-radius: var(--border-radius);
font-weight: 500;
}
.alert-success {
background-color: rgba(46, 196, 182, 0.2);
color: #1a8a7e;
border-left: 4px solid var(--success-color);
}
.alert-danger {
background-color: rgba(230, 57, 70, 0.2);
color: #b71c1c;
border-left: 4px solid var(--danger-color);
}
.alert-warning {
background-color: rgba(255, 183, 3, 0.2);
color: #9c6d00;
border-left: 4px solid var(--warning-color);
}
.alert-info {
background-color: rgba(76, 201, 240, 0.2);
color: #0277bd;
border-left: 4px solid var(--info-color);
}
/* ====== 倒计时样式 ====== */
.countdown-container {
background-color: white;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
padding: 1.5rem;
text-align: center;
margin-bottom: 2rem;
}
.countdown-title {
color: var(--gray-700);
font-size: 1.2rem;
margin-bottom: 1rem;
}
.countdown-timer {
font-size: 2.5rem;
font-weight: 700;
color: var(--primary-color);
}
.countdown-warning {
color: var(--warning-color);
}
.countdown-danger {
color: var(--danger-color);
}
/* ====== 页脚样式 ====== */
.footer {
background-color: white;
padding: 2rem 0;
margin-top: auto;
text-align: center;
border-top: 1px solid var(--gray-200);
}
.footer-text {
color: var(--gray-600);
font-size: 0.875rem;
}
.footer-link {
color: var(--primary-color);
text-decoration: none;
font-weight: 500;
}
.footer-link:hover {
text-decoration: underline;
}
/* ====== 响应式设计 ====== */
@media (max-width: 992px) {
.nav-left {
gap: 0.5rem;
}
.nav-link {
padding: 0.4rem 0.6rem;
font-size: 0.9rem;
}
.card-grid {
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.stat-value {
font-size: 1.8rem;
}
}
@media (max-width: 768px) {
.nav {
flex-direction: column;
align-items: flex-start;
padding: 1rem;
}
.nav-logo {
margin-right: 0;
margin-bottom: 0.5rem;
}
.nav-links {
display: none;
width: 100%;
flex-direction: column;
margin-top: 1.5rem;
flex-wrap: nowrap;
background: white;
border-radius: 12px;
padding: 0.75rem;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
max-height: 70vh;
overflow-y: auto;
position: absolute;
right: 1rem;
width: auto;
min-width: 200px;
max-width: 80%;
top: 3.5rem;
/* 添加平滑滚动 */
scroll-behavior: smooth;
/* 美化滚动条 */
scrollbar-width: thin;
scrollbar-color: var(--gray-300) transparent;
}
.nav-links::-webkit-scrollbar {
width: 6px;
}
.nav-links::-webkit-scrollbar-track {
background: transparent;
}
.nav-links::-webkit-scrollbar-thumb {
background-color: var(--gray-300);
border-radius: 10px;
}
/* 菜单打开时添加背景遮罩 */
.menu-backdrop {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.4);
z-index: 999;
backdrop-filter: blur(2px);
opacity: 0;
transition: opacity 0.3s ease;
}
.menu-backdrop.active {
display: block;
opacity: 1;
}
.nav-links.active {
display: flex;
animation: slideDown 0.3s ease-out forwards;
position: relative;
z-index: 1000;
}
@keyframes slideDown {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.nav-link {
padding: 1rem;
width: 100%;
border-radius: 8px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: flex;
align-items: center;
margin-bottom: 0.5rem;
font-weight: 500;
transition: all 0.2s ease;
background-color: var(--gray-100);
}
.nav-link i {
margin-right: 0.75rem;
font-size: 1.1rem;
width: 24px;
text-align: center;
color: var(--primary-color);
}
.nav-link:last-child {
margin-bottom: 0;
}
.nav-link:hover {
background-color: var(--gray-200);
transform: translateX(3px);
}
.nav-link.active {
background-color: var(--primary-color);
color: white;
box-shadow: 0 4px 10px rgba(67, 97, 238, 0.25);
}
.nav-link.active i {
color: white;
}
.menu-toggle {
display: flex;
position: absolute;
top: 1rem;
right: 1rem;
transform: scale(1);
}
.menu-toggle:active {
transform: scale(0.92);
}
.nav-right {
width: 100%;
margin-top: 1.25rem;
display: flex;
justify-content: center;
padding: 0 1rem;
box-sizing: border-box;
}
.nav-right .logout-link {
width: 100%;
padding: 0.8rem 1rem;
text-align: center;
font-size: 0.95rem;
font-weight: 500;
display: flex;
justify-content: center;
align-items: center;
gap: 0.5rem;
margin: 0 auto;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.question-actions {
flex-direction: column;
gap: 1rem;
}
.question-actions button {
width: 100%;
}
.card-grid {
grid-template-columns: 1fr;
}
.question-header {
flex-direction: column;
align-items: flex-start;
gap: 0.5rem;
}
.table-container {
margin-left: -1rem;
margin-right: -1rem;
width: calc(100% + 2rem);
overflow-x: auto;
-webkit-overflow-scrolling: touch;
padding: 0 1rem;
}
.option-label {
padding: 0.875rem;
}
.option-checkbox {
min-width: 20px;
}
.pagination {
flex-wrap: wrap;
justify-content: center;
gap: 0.5rem;
}
}
@media (max-width: 576px) {
body {
font-size: 15px;
}
.container {
padding: 1rem;
}
.card, .question-container {
padding: 1.25rem;
}
.card-title {
font-size: 1.35rem;
}
.auth-container {
margin: 1rem;
max-width: none;
}
.question-stem {
font-size: 1.05rem;
}
.option-label {
padding: 0.75rem;
}
.stat-value {
font-size: 1.65rem;
}
.countdown-timer {
font-size: 1.85rem;
}
.table th, .table td {
padding: 0.75rem 0.5rem;
font-size: 0.9rem;
}
.btn {
padding: 0.65rem 1.25rem;
}
.btn-block {
width: 100%;
}
.form-control {
padding: 0.65rem 0.875rem;
font-size: 0.95rem;
}
.footer {
padding: 1.5rem 0;
}
.footer-text {
font-size: 0.8rem;
}
}
/* 更多手机端优化 */
@media (max-width: 480px) {
body {
font-size: 14px;
}
.container {
padding: 0.85rem;
}
.card, .question-container {
padding: 1rem;
margin-bottom: 1.25rem;
}
.card-title {
font-size: 1.25rem;
margin-bottom: 0.75rem;
}
.question-stem {
font-size: 1rem;
margin-bottom: 1.5rem;
}
.option-label {
padding: 0.625rem;
}
.option-checkbox {
transform: scale(1.1);
}
.btn {
padding: 0.6rem 1.2rem;
font-size: 0.95rem;
}
.badge {
padding: 0.2rem 0.5rem;
font-size: 0.8rem;
}
.alert {
padding: 0.85rem;
margin-bottom: 1.25rem;
}
.stat-card {
padding: 1.25rem;
}
.stat-value {
font-size: 1.5rem;
}
.stat-icon {
width: 2.5rem;
height: 2.5rem;
font-size: 1.25rem;
}
.auth-container {
padding: 1.5rem 1rem;
}
.auth-title {
font-size: 1.5rem;
margin-bottom: 1.5rem;
}
.countdown-timer {
font-size: 1.75rem;
}
/* 更小屏幕的导航菜单优化 */
.nav-links {
margin-top: 1.25rem;
padding: 0.65rem;
max-height: 65vh;
right: 0.85rem;
}
.nav-link {
padding: 0.85rem;
font-size: 0.95rem;
margin-bottom: 0.4rem;
text-align: left;
}
.nav-link i {
margin-right: 0.6rem;
font-size: 1rem;
width: 20px;
}
.menu-toggle {
width: 38px;
height: 38px;
font-size: 1.35rem;
top: 0.85rem;
right: 0.85rem;
}
}
/* ====== 主题色变量自定义 ====== */
[data-theme="blue"] {
--primary-color: #4361ee;
--primary-hover: #3a56e7;
}
[data-theme="green"] {
--primary-color: #2ec4b6;
--primary-hover: #25a99d;
}
[data-theme="purple"] {
--primary-color: #7209b7;
--primary-hover: #5f08a0;
}
[data-theme="orange"] {
--primary-color: #fb8500;
--primary-hover: #e67700;
}
/* ====== 翻页样式 ====== */
.pagination {
display: flex;
padding-left: 0;
list-style: none;
border-radius: var(--border-radius);
margin-bottom: 1rem;
}
.page-item {
position: relative;
display: block;
}
.page-item:not(:first-child) .page-link {
margin-left: -1px;
}
.page-item.active .page-link {
z-index: 3;
color: #fff;
background-color: var(--primary-color);
border-color: var(--primary-color);
}
.page-item.disabled .page-link {
color: #6c757d;
pointer-events: none;
background-color: #fff;
border-color: #dee2e6;
}
.page-link {
position: relative;
display: block;
color: var(--primary-color);
text-decoration: none;
background-color: #fff;
border: 1px solid #dee2e6;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
padding: 0.375rem 0.75rem;
margin-left: -1px;
line-height: 1.25;
}
.page-link:hover {
z-index: 2;
color: var(--primary-hover);
text-decoration: none;
background-color: #e9ecef;
border-color: #dee2e6;
}
.page-link:focus {
z-index: 3;
color: var(--primary-hover);
background-color: #e9ecef;
border-color: #86b7fe;
outline: 0;
box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
}
.page-item:first-child .page-link {
border-top-left-radius: var(--border-radius);
border-bottom-left-radius: var(--border-radius);
}
.page-item:last-child .page-link {
border-top-right-radius: var(--border-radius);
border-bottom-right-radius: var(--border-radius);
}
.pagination-lg .page-link {
padding: 0.75rem 1.5rem;
font-size: 1.25rem;
}
.pagination-sm .page-link {
padding: 0.25rem 0.5rem;
font-size: 0.875rem;
}
/* ====== 答题历史记录文本限制 ====== */
.question-text-truncate {
display: block;
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* 移动端答题历史文本限制 */
@media (max-width: 768px) {
.question-text-truncate {
max-width: 150px;
}
}
@media (max-width: 576px) {
.question-text-truncate {
max-width: 120px;
}
}
@media (max-width: 480px) {
.question-text-truncate {
max-width: 100px;
}
}
/* ====== 辅助工具类 ====== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-decoration-none { text-decoration: none !important; }
/* Margin utilities */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mb-4 { margin-bottom: 2rem !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }
.me-1 { margin-right: 0.5rem !important; }
.me-2 { margin-right: 1rem !important; }
.me-3 { margin-right: 1.5rem !important; }
.ms-1 { margin-left: 0.5rem !important; }
.ms-2 { margin-left: 1rem !important; }
.ms-3 { margin-left: 1.5rem !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }
/* Padding utilities */
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.5rem !important; }
.p-2 { padding: 1rem !important; }
.p-3 { padding: 1.5rem !important; }
/* Display utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
/* Responsive display utilities */
@media (min-width: 576px) {
.d-sm-none { display: none !important; }
.d-sm-block { display: block !important; }
.d-sm-flex { display: flex !important; }
}
@media (min-width: 768px) {
.d-md-none { display: none !important; }
.d-md-block { display: block !important; }
.d-md-flex { display: flex !important; }
}
@media (min-width: 992px) {
.d-lg-none { display: none !important; }
.d-lg-block { display: block !important; }
.d-lg-flex { display: flex !important; }
}
/* Flexbox utilities */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around { justify-content: space-around !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-baseline { align-items: baseline !important; }
.align-items-stretch { align-items: stretch !important; }
/* Gap utilities */
.gap-1 { gap: 0.5rem !important; }
.gap-2 { gap: 1rem !important; }
.gap-3 { gap: 1.5rem !important; }
/* Width utilities */
.w-25 { width: 25% !important; }
.w-50 { width: 50% !important; }
.w-75 { width: 75% !important; }
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }
/* Font utilities */
.font-weight-bold { font-weight: 700 !important; }
.font-weight-normal { font-weight: 400 !important; }
.fw-bold { font-weight: 700 !important; }
.fw-normal { font-weight: 400 !important; }
/* Text color utilities */
.text-primary { color: var(--primary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-info { color: var(--info-color) !important; }
.text-muted { color: var(--gray-600) !important; }
/* Position utilities */
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }
.position-sticky { position: sticky !important; }
/* 响应式显示类 */
.mobile-only {
display: none;
}
/* 移动端全宽元素 */
.mobile-full-width {
width: auto;
}
@media (max-width: 768px) {
.mobile-only {
display: block;
}
.desktop-only {
display: none;
}
.mobile-full-width {
width: 90% !important;
}
}
@media (max-width: 480px) {
.mobile-full-width {
width: 95% !important;
}
}