/* ============================================================
 * 心理督导系统 NFC 二次验证 - 全局样式
 * 从原型 deepseek_html_20260729_43d4b9.html 提取并改造为纯 CSS
 * 移除 Tailwind 依赖，使用语义化类名
 * ============================================================ */

/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  letter-spacing: -0.01em;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.hidden { display: none !important; }

/* ===== 布局工具类（替代部分 Tailwind） ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.min-h-screen { min-height: 100vh; }
.rounded { border-radius: 6px; }
.rounded-xl { border-radius: 12px; }
.rounded-2xl { border-radius: 16px; }
.rounded-3xl { border-radius: 24px; }
.rounded-full { border-radius: 9999px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }
.text-4xl { font-size: 36px; }
.text-5xl { font-size: 48px; }
.text-white { color: #fff; }
.text-center { text-align: center; }

/* ===== 颜色（brand 主色 / nfc 紫色 / surface 灰阶 / amber 琥珀） ===== */
.text-brand-500 { color: #3b6df0; } .text-brand-600 { color: #2952cc; } .text-brand-700 { color: #1e3fa8; }
.bg-brand-50 { background: #f0f5ff; } .bg-brand-100 { background: #dbe8ff; }
.bg-brand-500 { background: #3b6df0; } .bg-brand-600 { background: #2952cc; } .bg-brand-700 { background: #1e3fa8; }
.text-nfc-500 { color: #8b5cf6; } .text-nfc-600 { color: #7c3aed; }
.bg-nfc-50 { background: #f5f3ff; } .bg-nfc-100 { background: #ede9fe; }
.bg-nfc-600 { background: #7c3aed; } .bg-nfc-700 { background: #6d28d9; }
.text-surface-400 { color: #9ca3af; } .text-surface-500 { color: #6b7280; }
.text-surface-600 { color: #4b5563; } .text-surface-700 { color: #374151; } .text-surface-800 { color: #1f2937; }
.bg-surface-50 { background: #f9fafb; } .bg-surface-100 { background: #f3f4f6; }
.bg-surface-200 { background: #e5e7eb; } .bg-surface-900 { background: #111827; }
.border-surface-100 { border-color: #f3f4f6; } .border-surface-200 { border-color: #e5e7eb; }
.text-amber-600 { color: #d97706; } .text-amber-700 { color: #b45309; }
.bg-amber-50 { background: #fffbeb; } .bg-amber-100 { background: #fef3c7; }
.border-amber-200 { border-color: #fde68a; } .border-amber-300 { border-color: #fcd34d; }
.text-green-500 { color: #10b981; } .text-green-600 { color: #059669; } .text-green-700 { color: #047857; }
.bg-green-50 { background: #ecfdf5; } .bg-green-100 { background: #d1fae5; }
.bg-green-500 { background: #10b981; }
.text-red-500 { color: #ef4444; } .text-red-600 { color: #dc2626; }
.bg-red-50 { background: #fef2f2; } .bg-red-100 { background: #fee2e2; }
.text-blue-600 { color: #2563eb; } .text-blue-700 { color: #1d4ed8; }
.bg-blue-50 { background: #eff6ff; }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(to bottom right, #f8fafc, #fff, #eff6ff);
  padding: 24px; position: relative; overflow: hidden;
}
.login-bg-blob1 { position: absolute; top: 64px; left: 96px; width: 500px; height: 500px;
  background: rgba(219,232,255,0.4); border-radius: 50%; filter: blur(60px); }
.login-bg-blob2 { position: absolute; bottom: 48px; right: 112px; width: 400px; height: 400px;
  background: rgba(237,233,254,0.3); border-radius: 50%; filter: blur(60px); }
.login-container { position: relative; z-index: 10; width: 100%; max-width: 1152px;
  display: flex; align-items: center; gap: 80px; flex-wrap: wrap; }
.login-brand { flex: 1; }
.login-brand h1 { font-size: 48px; font-weight: 800; color: #1f2937; line-height: 1.1; margin: 0 0 16px; }
.login-brand p { color: #6b7280; font-size: 18px; max-width: 500px; line-height: 1.6; }
.text-gradient-brand {
  background: linear-gradient(135deg, #3b6df0, #8b5cf6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.login-card { width: 100%; max-width: 440px; }
.login-card-inner {
  background: #fff; border-radius: 24px; padding: 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.06), 0 6px 20px rgba(0,0,0,0.03);
  border: 1px solid #f3f4f6;
}
.input-group { margin-bottom: 20px; }
.input-label { display: block; font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.input-wrap { position: relative; }
.input-wrap input {
  width: 100%; padding: 14px 16px 14px 40px; border: 1px solid #e5e7eb;
  border-radius: 16px; font-size: 15px; color: #1f2937; background: #f9fafb;
  outline: none; transition: all 0.2s;
}
.input-wrap input:focus { border-color: #5c8aff; box-shadow: 0 0 0 3px rgba(92,138,255,0.2); }
.input-wrap .input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 14px; }
.btn-login {
  width: 100%; padding: 14px; background: linear-gradient(to right, #2952cc, #1e3fa8);
  color: #fff; font-weight: 600; border-radius: 16px; font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s;
}
.btn-login:hover { background: linear-gradient(to right, #1e3fa8, #18318a); }
.btn-login:active { transform: scale(0.98); }

/* ===== 主应用框架 ===== */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
  background: #fff; border-bottom: 1px solid #e5e7eb; padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04); z-index: 30; flex-shrink: 0;
}
.app-logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(to bottom right, #3b6df0, #7c3aed);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.auth-badge {
  padding: 4px 12px; border-radius: 9999px; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.auth-badge.level1 { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.auth-badge.level2 { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.app-body { display: flex; flex: 1; overflow: hidden; }
.sidebar {
  width: 256px; background: #fff; border-right: 1px solid #e5e7eb;
  display: flex; flex-direction: column; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px;
  color: #4b5563; font-weight: 500; font-size: 14px; transition: all 0.2s; margin: 2px 12px;
}
.nav-link:hover { background: #f0f5ff; color: #1e3fa8; }
.nav-link.active { background: #f0f5ff; color: #1e3fa8; font-weight: 600; }
.nav-lock-badge {
  margin-left: auto; font-size: 10px; padding: 2px 8px; border-radius: 9999px;
  background: #fef3c7; color: #b45309; display: flex; align-items: center; gap: 4px;
}
.nav-lock-badge.unlocked { background: #d1fae5; color: #047857; }
.main { flex: 1; overflow-y: auto; background: #f9fafb; padding: 24px 32px; }
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.25s ease; }

/* ===== 卡片 ===== */
.card {
  background: #fff; border-radius: 16px; padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03), 0 1px 3px rgba(0,0,0,0.02);
  transition: all 0.2s;
}
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(0,0,0,0.05); }
.stat-card { display: flex; align-items: center; justify-content: space-between; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-value { font-size: 30px; font-weight: 700; color: #1f2937; margin-top: 8px; }

/* ===== 敏感操作按钮 ===== */
.sensitive-btn {
  padding: 20px; border-radius: 16px; border: 2px dashed #fcd34d;
  background: rgba(255,251,235,0.2); transition: all 0.2s; text-align: center; cursor: pointer;
}
.sensitive-btn:hover { background: #fffbeb; }
.sensitive-btn.danger { border-color: #fca5a5; background: rgba(254,242,242,0.2); }
.sensitive-btn.danger:hover { background: #fef2f2; }
.sensitive-btn .icon { font-size: 24px; color: #fbbf24; display: block; margin-bottom: 12px; }
.sensitive-btn.danger .icon { color: #f87171; }
.sensitive-btn.unlocked .icon { color: #10b981; }
.sensitive-btn .label { font-size: 14px; font-weight: 600; color: #374151; }
.sensitive-btn .hint { font-size: 10px; color: #f59e0b; display: block; margin-top: 4px; }
.sensitive-btn.danger .hint { color: #ef4444; }

/* ===== 模糊锁定 ===== */
.blur-sensitive { filter: blur(6px); user-select: none; pointer-events: none; transition: filter 0.35s; }
.blur-sensitive.unlocked { filter: blur(0); user-select: auto; pointer-events: auto; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table thead { background: #f9fafb; }
table.data-table th { padding: 12px 24px; text-align: left; font-weight: 600; color: #374151; }
table.data-table td { padding: 16px 24px; border-top: 1px solid #f3f4f6; }
.tag { padding: 4px 8px; border-radius: 9999px; font-size: 12px; font-weight: 500; }

/* ===== 二维码模态框 ===== */
.modal-mask {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: center; justify-content: center;
  background: rgba(17,24,39,0.6); backdrop-filter: blur(4px); padding: 16px;
}
.modal-mask.open { display: flex; animation: fadeIn 0.25s ease; }
.modal-card {
  background: #fff; border-radius: 24px; max-width: 960px; width: 100%; overflow: hidden;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25); animation: popIn 0.25s ease;
}
.modal-header {
  background: linear-gradient(to right, #2952cc, #6d28d9); padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between; color: #fff;
}
.modal-body { padding: 24px; display: flex; gap: 32px; }
.qr-display {
  padding: 4px; border-radius: 16px;
  background: linear-gradient(to bottom right, #5c8aff, #8b5cf6);
  box-shadow: 0 0 20px rgba(59,109,240,0.25);
}
.qr-display .inner { background: #fff; border-radius: 16px; padding: 12px; }
#qrCanvas { display: block; }

/* ===== 手机模拟器 ===== */
.phone-frame {
  width: 270px; height: 540px; background: #e5e7eb; border-radius: 38px; padding: 10px;
  box-shadow: 0 0 0 3px #d1d5db, 0 0 0 6px #e5e7eb, 0 0 0 8px #9ca3af, 0 30px 70px rgba(0,0,0,0.18);
  position: relative; overflow: hidden;
}
.phone-screen {
  width: 100%; height: 100%; background: #fff; border-radius: 28px; overflow: hidden;
  display: flex; flex-direction: column; position: relative;
}
.phone-notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 110px; height: 30px; background: #e5e7eb; border-radius: 0 0 20px 20px; z-index: 20;
}
.phone-screen .state { display: none; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; gap: 16px; }
.phone-screen .state.show { display: flex; }

/* NFC 波纹 */
.nfc-ripple-ring {
  position: absolute; width: 60px; height: 60px; border-radius: 50%;
  border: 2px solid #8b5cf6; animation: ripple 2s ease-out infinite;
  top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: 0.6;
}
.nfc-ripple-ring:nth-child(2) { animation-delay: 0.7s; }
.nfc-ripple-ring:nth-child(3) { animation-delay: 1.4s; }

/* ===== 状态点 ===== */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; position: relative; }
.status-dot::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; animation: ping 1.5s cubic-bezier(0,0,0.2,1) infinite; }
.status-dot.warning { background: #f59e0b; }
.status-dot.warning::after { background: rgba(245,158,11,0.35); }
.status-dot.success { background: #10b981; }
.status-dot.success::after { background: rgba(16,185,129,0.35); }
.status-dot.idle { background: #9ca3af; }
.status-dot.idle::after { background: rgba(156,163,175,0.2); }

/* ===== 进度条 ===== */
.progress-bar {
  background: linear-gradient(90deg, #3b6df0, #8b5cf6);
  background-size: 200% 100%; animation: progressShine 2s linear infinite;
  height: 4px; border-radius: 4px; transition: width 0.8s linear;
}

/* ===== 授权横幅 ===== */
.auth-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40; display: none;
  background: linear-gradient(to right, #10b981, #059669); color: #fff; padding: 12px 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.auth-banner.show { display: block; animation: slideDown 0.3s ease; }
.auth-banner .container { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }

/* ===== Toast ===== */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.toast {
  padding: 14px 22px; border-radius: 16px; font-weight: 500; font-size: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.08); display: flex; align-items: center; gap: 10px;
  max-width: 380px; pointer-events: auto; background: #fff; border: 1px solid #e5e7eb;
  animation: slideInRight 0.35s cubic-bezier(0.2,0.8,0.2,1.2), fadeOut 0.35s ease 2.5s forwards;
}
.toast.info    { border-color: #dbeafe; background: #eff6ff; color: #1d4ed8; }
.toast.success { border-color: #a7f3d0; background: #ecfdf5; color: #047857; }
.toast.warning { border-color: #fde68a; background: #fffbeb; color: #b45309; }
.toast.error   { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }

/* ===== 手机端独立授权页（nfc_auth.php） ===== */
.mobile-page { min-height: 100vh; background: linear-gradient(180deg, #f5f3ff, #fff); padding: 20px; display: flex; flex-direction: column; align-items: center; }
.mobile-card { background: #fff; border-radius: 20px; padding: 24px; width: 100%; max-width: 420px; box-shadow: 0 8px 30px rgba(0,0,0,0.05); margin-top: 16px; }
.mobile-btn { width: 100%; padding: 14px; border-radius: 12px; font-weight: 600; color: #fff; font-size: 15px; transition: all 0.2s; }
.mobile-btn.primary { background: #2952cc; }
.mobile-btn.primary:hover { background: #1e3fa8; }
.mobile-btn.nfc { background: #7c3aed; }
.mobile-btn.nfc:hover { background: #6d28d9; }
.scan-video { width: 100%; border-radius: 12px; background: #000; }
.scan-region { width: 100%; aspect-ratio: 1; position: relative; overflow: hidden; border-radius: 12px; background: #000; }
.scan-region::after {
  content: ''; position: absolute; left: 5%; right: 5%; height: 3px;
  background: linear-gradient(90deg, transparent, #3b6df0, #5c8aff, #3b6df0, transparent);
  border-radius: 6px; animation: scanLine 2.5s linear infinite; box-shadow: 0 0 20px rgba(59,109,240,0.7); z-index: 5;
}

/* ===== 动画 ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@keyframes slideInRight { from { transform: translateX(130%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-12px); } }
@keyframes popIn { 0% { transform: scale(0.9); opacity: 0; } 80% { transform: scale(1.02); } 100% { transform: scale(1); opacity: 1; } }
@keyframes scanLine { 0% { top: -5%; } 100% { top: 105%; } }
@keyframes ripple { 0% { width: 20px; height: 20px; opacity: 0.8; } 100% { width: 120px; height: 120px; opacity: 0; } }
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }
@keyframes progressShine { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }

.animate-float { animation: float 3s ease-in-out infinite; }
.animate-shake:hover { animation: shake 0.5s ease-in-out; }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .modal-body { flex-direction: column; }
  .login-container { flex-direction: column; gap: 32px; }
  .login-brand { text-align: center; }
  .sidebar { width: 200px; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
  .login-brand h1 { font-size: 32px; }
}
