/* 耶鲁情绪智力成人测评 — 全局样式 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

/* === 设计令牌 === */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-glass: rgba(255, 255, 255, 0.1);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --color-red: #ef4444;
  --color-blue: #3b82f6;
  --color-green: #10b981;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(99,102,241,0.3);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === 重置和基础 === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* 背景装饰 */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(59,130,246,0.04) 0%, transparent 50%);
  z-index: -1;
  animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-2%, 2%); }
}

/* === 容器 === */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.container-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* === 玻璃态卡片 === */
.card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255,255,255,0.15);
  box-shadow: var(--shadow-lg);
}

.card-compact { padding: 20px; }

/* === 排版 === */
h1 {
  font-size: 2rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

h3 {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

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

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.form-input::placeholder {
  color: var(--text-muted);
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 500px) {
  .form-row { grid-template-columns: 1fr; }
}

/* === 按钮 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  gap: 8px;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(99,102,241,0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.15);
}

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--color-red);
  border: 1px solid rgba(239,68,68,0.3);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* === 进度条 === */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: right;
}

/* === 题目样式 === */
.question-item {
  padding: 20px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.question-item:last-child { border-bottom: none; }

.question-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent-gradient);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  margin-right: 10px;
  flex-shrink: 0;
}

.question-text {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
}

.question-text span {
  line-height: 28px;
}

.options-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-left: 38px;
}

.option-btn {
  flex: 1;
  min-width: 60px;
  padding: 8px 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.option-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

.option-btn.selected {
  background: rgba(99,102,241,0.2);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  font-weight: 600;
}

.option-btn.selected-red {
  background: rgba(239,68,68,0.15);
  border-color: var(--color-red);
  color: var(--color-red);
}

.option-btn.selected-blue {
  background: rgba(59,130,246,0.15);
  border-color: var(--color-blue);
  color: var(--color-blue);
}

.option-btn.selected-green {
  background: rgba(16,185,129,0.15);
  border-color: var(--color-green);
  color: var(--color-green);
}

/* === 提示/警告 === */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
}

.alert-success {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  color: #6ee7b7;
}

.alert-info {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.3);
  color: #93c5fd;
}

/* === 页面切换动画 === */
.page { display: none; }
.page.active {
  display: block;
  animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === 完成页 === */
.completion-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: rgba(16,185,129,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.completion-text {
  text-align: center;
}

.wechat-info {
  margin-top: 24px;
  padding: 20px;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--radius-md);
  text-align: center;
}

.wechat-info .phone {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--success);
  margin: 8px 0;
}

.wechat-info a {
  color: var(--accent-primary);
  text-decoration: none;
}

.wechat-info a:hover {
  text-decoration: underline;
}

/* === 管理后台 === */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}

.admin-tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
}

.admin-tab.active {
  background: var(--accent-primary);
  color: white;
}

.admin-tab:hover:not(.active) {
  background: rgba(255,255,255,0.08);
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-primary);
}

.data-table tr:hover td {
  background: rgba(255,255,255,0.03);
}

.data-table .clickable {
  cursor: pointer;
}

/* 状态标签 */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-unused {
  background: rgba(16,185,129,0.15);
  color: var(--success);
}

.badge-used {
  background: rgba(100,116,139,0.15);
  color: var(--text-muted);
}

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

.stat-card {
  padding: 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 详情模态框 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
}

.modal-overlay.active { display: flex; justify-content: center; align-items: flex-start; }

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 900px;
  width: 100%;
  margin: 40px auto;
  animation: fadeInUp 0.3s ease-out;
}

.modal-close {
  float: right;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover { color: var(--text-primary); }

/* 雷达图容器 */
.radar-container {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

/* === 登录页 === */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  max-width: 400px;
  width: 100%;
}

/* === 授权码入口 === */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.auth-logo {
  font-size: 3rem;
  margin-bottom: 8px;
}

.code-input {
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 4px;
  text-transform: uppercase;
  font-weight: 700;
}

/* === 响应式 === */
@media (max-width: 768px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  .card { padding: 20px; }
  .container { padding: 12px; }
  .options-row { padding-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 8px; }
  .modal-content { padding: 20px; margin: 20px auto; }
}

/* === 加载动画 === */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 隐藏工具类 */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
