/* 商务风 - 深蓝/灰调 */
:root {
  --navy-900: #0a1e3f;
  --navy-800: #0f2a5a;
  --navy-700: #16387a;
  --navy-600: #1e4a9e;
  --navy-500: #2d5fb8;
  --gray-50: #f7f9fc;
  --gray-100: #eef2f7;
  --gray-200: #dfe5ed;
  --gray-300: #c1cad6;
  --gray-500: #6b7a90;
  --gray-700: #3a4a63;
  --gray-900: #1a2538;
  --white: #ffffff;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 3px rgba(10,30,63,0.06), 0 1px 2px rgba(10,30,63,0.04);
  --shadow-md: 0 4px 12px rgba(10,30,63,0.08);
  --shadow-lg: 0 10px 30px rgba(10,30,63,0.12);
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  font-size: 14px;
  line-height: 1.6;
}

/* 后台布局 */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--navy-900);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
}

.brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--navy-500), #4f7fd6);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; letter-spacing: 0.5px;
}
.logo.small { width: 32px; height: 32px; font-size: 13px; }
.brand-name { font-size: 16px; font-weight: 600; }
.brand-sub { font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 2px; }

.nav { flex: 1; padding: 16px 12px; }
.nav-item {
  display: block;
  padding: 10px 14px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 14px;
  transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active { background: var(--navy-700); color: white; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px;
  background: var(--navy-600);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.6); }

.main {
  flex: 1;
  margin-left: 240px;
  padding: 24px 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
}
.topbar h1 { font-size: 22px; color: var(--navy-900); font-weight: 600; }
.badge {
  background: var(--navy-100);
  color: var(--navy-700);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.badge { background: var(--gray-100); color: var(--gray-700); }

/* 工具栏 */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.search, .filter {
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: white;
  font-size: 14px;
  outline: none;
  transition: border 0.15s;
}
.search { flex: 1; max-width: 320px; }
.search:focus, .filter:focus { border-color: var(--navy-500); }

/* 题目卡片网格 */
.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.q-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.q-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.q-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.q-card-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--gray-900);
  line-height: 1.5;
  flex: 1;
}
.q-card-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 12px;
}
.q-type-tag, .q-cat-tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.q-type-tag { background: var(--navy-100); color: var(--navy-700); }
.q-type-tag.single { background: #dbeafe; color: #1e40af; }
.q-type-tag.multiple { background: #dcfce7; color: #166534; }
.q-type-tag.text { background: #fef3c7; color: #92400e; }
.q-type-tag.rating { background: #fce7f3; color: #9d174d; }
.q-cat-tag { background: var(--gray-100); color: var(--gray-700); }

.q-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.btn {
  padding: 6px 12px;
  border: 1px solid var(--gray-200);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--gray-700);
  transition: all 0.15s;
}
.btn:hover { border-color: var(--navy-500); color: var(--navy-700); }
.btn-primary { background: var(--navy-700); color: white; border-color: var(--navy-700); }
.btn-primary:hover { background: var(--navy-800); color: white; }
.btn-ghost { background: transparent; }
.btn-block { display: block; width: 100%; padding: 12px; font-size: 14px; }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; color: var(--danger); }

/* 表单 */
.form-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 720px;
  box-shadow: var(--shadow-sm);
}
.form-row { margin-bottom: 20px; }
.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border 0.15s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--navy-500);
}
.form-row textarea { resize: vertical; }
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-100);
}

/* 数据看板 */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12px; color: var(--gray-500); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 600; color: var(--navy-900); }
.stat-value.success { color: var(--success); }

/* 弹窗 */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10,30,63,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: white;
  border-radius: var(--radius);
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 16px; color: var(--navy-900); }
.close {
  background: none; border: none; font-size: 24px;
  color: var(--gray-500); cursor: pointer;
}
.modal-body { padding: 24px 20px; }
.qr-tip { color: var(--gray-500); font-size: 13px; margin-top: 16px; }
.qr-url {
  margin-top: 8px;
  font-size: 11px;
  color: var(--gray-500);
  word-break: break-all;
  background: var(--gray-50);
  padding: 8px;
  border-radius: 4px;
}

.hidden { display: none !important; }

/* 学生端 */
.student-body {
  background: linear-gradient(135deg, #0a1e3f 0%, #16387a 100%);
  min-height: 100vh;
  padding: 0;
}
.student-wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px;
  min-height: 100vh;
}
.student-header {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  margin-bottom: 24px;
}
.student-header .brand-name { color: white; }
.student-header .brand-sub { color: rgba(255,255,255,0.7); }

.loading {
  color: white;
  text-align: center;
  padding: 40px;
  font-size: 15px;
}

.student-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 16px;
}
.q-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.q-type-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--navy-100);
  color: var(--navy-700);
}
.q-category {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  background: var(--gray-100);
  color: var(--gray-700);
}
.q-title {
  font-size: 17px;
  color: var(--navy-900);
  line-height: 1.5;
  margin-bottom: 20px;
  font-weight: 500;
}

.option-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}
.option-item:hover { border-color: var(--navy-500); background: var(--gray-50); }
.option-item.selected { border-color: var(--navy-700); background: #eff6ff; }
.option-item input { margin-right: 12px; transform: scale(1.1); }
.option-item .opt-text { flex: 1; font-size: 15px; }

.text-answer {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
.text-answer:focus { border-color: var(--navy-500); }

.rating-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 16px 0;
}
.rating-star {
  font-size: 36px;
  cursor: pointer;
  color: var(--gray-300);
  transition: all 0.15s;
  line-height: 1;
}
.rating-star.active { color: var(--warning); }

.success-card {
  background: white;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.success-icon {
  width: 80px; height: 80px;
  background: var(--success);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
  margin: 0 auto 20px;
}
.success-card h2 { color: var(--navy-900); margin-bottom: 8px; }
.success-card p { color: var(--gray-500); }

/* 看板内题目详情 */
.q-detail {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.q-detail h3 {
  color: var(--navy-900);
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}
.bar-label { width: 100px; font-size: 13px; color: var(--gray-700); }
.bar-container {
  flex: 1;
  background: var(--gray-100);
  border-radius: 4px;
  height: 24px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy-700), var(--navy-500));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px;
  color: white;
  font-size: 11px;
  font-weight: 500;
  transition: width 0.6s;
}
.bar-count { font-size: 12px; color: var(--gray-500); min-width: 30px; text-align: right; }

@media (max-width: 768px) {
  .sidebar { width: 100%; position: relative; height: auto; }
  .main { margin-left: 0; padding: 16px; }
  .app { flex-direction: column; }
}
