/* ===== 基础样式 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

/* ===== 布局 ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  padding: 30px;
  margin-bottom: 20px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
  color: #fff;
}

.btn-secondary {
  background: #6c757d;
  color: #fff;
}

/* ===== 表单 ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
}

.form-control {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: #667eea;
}

/* ===== 表格 ===== */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.table th {
  background: #f8f9fa;
  font-weight: 600;
}

/* ===== 拖拽组件样式 ===== */
.drag-container {
  display: flex;
  gap: 40px;
  margin: 30px 0;
  flex-wrap: wrap;
}

.drag-panel {
  flex: 1;
  min-width: 300px;
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
}

.drag-panel h3 {
  margin-bottom: 20px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 10px;
}

.drag-panel h3::before {
  content: '';
  width: 4px;
  height: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
}

.drag-item {
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  cursor: grab;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.drag-item:hover {
  border-color: #667eea;
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.drag-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.drag-item .icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}

.drag-item .text {
  flex: 1;
  font-size: 15px;
}

/* 放置区域 */
.drop-zone {
  min-height: 60px;
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  transition: all 0.3s;
  background: #fff;
}

.drop-zone.drag-over {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.1);
}

.drop-zone.filled {
  border-style: solid;
  border-color: #11998e;
}

.drop-zone .drag-item {
  margin-bottom: 0;
  background: #e8f5e9;
  border-color: #11998e;
}

/* 匹配对样式 */
.match-row {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
  padding: 15px;
  background: #fff;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
}

.match-row .left-item {
  flex: 1;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-radius: 8px;
  text-align: center;
}

.match-row .drop-zone {
  flex: 1;
  min-height: 50px;
}

.match-row .right-item {
  flex: 1;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  text-align: center;
  color: #666;
}

/* 排序题样式 */
.sort-list {
  list-style: none;
}

.sort-list .drag-item {
  position: relative;
}

.sort-list .drag-item::before {
  content: attr(data-index);
  width: 24px;
  height: 24px;
  background: #667eea;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* ===== 计时器 ===== */
.timer {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #fff;
  padding: 15px 25px;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.15);
  font-size: 24px;
  font-weight: bold;
  color: #667eea;
  z-index: 1000;
}

.timer.warning {
  color: #eb3349;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ===== 进度条 ===== */
.progress-bar {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin: 20px 0;
}

.progress-bar .progress {
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
  transition: width 0.3s;
}

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 25px;
  text-align: center;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.stat-card .value {
  font-size: 36px;
  font-weight: bold;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card .label {
  color: #666;
  margin-top: 5px;
}

/* ===== 弹窗 ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

/* ===== 结果弹窗 ===== */
.result-popup {
  text-align: center;
  padding: 20px;
}

.result-popup .score {
  font-size: 72px;
  font-weight: bold;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-popup .message {
  font-size: 18px;
  color: #666;
  margin: 20px 0;
}

.result-popup .stars {
  font-size: 40px;
  margin: 20px 0;
}

/* ===== 导航栏 ===== */
.navbar {
  background: #fff;
  padding: 15px 30px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar .logo {
  font-size: 20px;
  font-weight: bold;
  color: #667eea;
}

.navbar .nav-links {
  display: flex;
  gap: 20px;
}

.navbar .nav-links a {
  color: #666;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.3s;
}

.navbar .nav-links a:hover,
.navbar .nav-links a.active {
  background: #667eea;
  color: #fff;
}

/* ===== 题库卡片 ===== */
.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.question-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.question-card:hover {
  transform: translateY(-5px);
  border-color: #667eea;
}

.question-card .title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #333;
}

.question-card .meta {
  display: flex;
  gap: 15px;
  color: #999;
  font-size: 14px;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .drag-container {
    flex-direction: column;
  }

  .match-row {
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
