/* ========================================
   企业用工风险自测系统 - 公共样式
   ======================================== */

/* CSS 变量 */
:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #93c5fd;
  --primary-dark: #1d4ed8;
  --bg-start: #0f172a;
  --bg-mid: #1e293b;
  --bg-end: #0f172a;
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-radius: 16px;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --success: #22c55e;
  --success-bg: #dcfce7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --info: #3b82f6;
  --info-bg: #dbeafe;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
  --transition: all 0.3s ease;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-mid), var(--bg-end));
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 页面容器 */
.page-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 40px;
  padding-left: env(safe-area-inset-left, 16px);
  padding-right: env(safe-area-inset-right, 16px);
}

/* 卡片 */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  text-align: center;
  line-height: 1.4;
  -webkit-user-select: none;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

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

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4);
}

.btn-success:hover {
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 18px;
  border-radius: 14px;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: #fff;
}

/* 进度条 */
.progress-bar-wrapper {
  width: 100%;
  max-width: 480px;
  margin: 0 auto 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  border-radius: 100px;
  transition: width 0.4s ease;
}

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

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 16px;
  color: var(--text-primary);
  background: #fff;
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

.form-input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.form-error.show {
  display: block;
}

/* 标签网格 */
.tag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}

.tag-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.tag-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tag-icon svg {
  width: 20px;
  height: 20px;
}

/* 风险等级颜色 */
.risk-low {
  color: #22c55e;
}

.risk-medium {
  color: #f59e0b;
}

.risk-high {
  color: #ef4444;
}

.risk-critical {
  color: #991b1b;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
}

.risk-badge-low {
  background: #dcfce7;
  color: #16a34a;
}

.risk-badge-medium {
  background: #fef3c7;
  color: #d97706;
}

.risk-badge-high {
  background: #fee2e2;
  color: #dc2626;
}

.risk-badge-critical {
  background: #fecaca;
  color: #991b1b;
}

/* 风险卡片 */
.risk-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #f1f5f9;
}

.risk-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.risk-card-section {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.7;
}

.risk-card-section:last-child {
  margin-bottom: 0;
}

.risk-card-section.analysis {
  background: #fefce8;
  border-left: 3px solid #eab308;
  color: #854d0e;
}

.risk-card-section.case {
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  color: #1e40af;
}

.risk-card-section.compensation {
  background: #fef2f2;
  border-left: 3px solid #ef4444;
  color: #991b1b;
  font-weight: 600;
}

.risk-card-section.law {
  background: #f8fafc;
  border-left: 3px solid #94a3b8;
  color: #475569;
  font-size: 13px;
}

/* 资料列表 */
.material-list {
  list-style: none;
  padding: 0;
}

.material-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  color: var(--text-primary);
}

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

.material-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.material-icon svg {
  width: 16px;
  height: 16px;
  color: var(--primary-color);
}

/* 加载状态 */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

/* 成功状态 */
.success-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
}

.success-icon svg {
  width: 40px;
  height: 40px;
  color: #fff;
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-30px);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
}

.animate-fade-in {
  animation: fadeIn 0.4s ease forwards;
}

.animate-slide-in {
  animation: slideInRight 0.3s ease forwards;
}

.animate-slide-out {
  animation: slideOutLeft 0.2s ease forwards;
}

/* 分数显示 */
.score-display {
  text-align: center;
  padding: 24px 0;
}

.score-number {
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
}

.score-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.score-level {
  font-size: 20px;
  font-weight: 700;
}

/* 金额显示 */
.compensation-display {
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, #fef2f2, #fff1f2);
  border-radius: 14px;
  margin: 16px 0;
}

.compensation-amount {
  font-size: 32px;
  font-weight: 800;
  color: #dc2626;
}

.compensation-label {
  font-size: 13px;
  color: #991b1b;
  margin-top: 4px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: #22c55e;
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 700;
  color: #22c55e;
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 14px;
  color: var(--text-secondary);
}

/* 分隔线 */
.divider {
  height: 1px;
  background: #e2e8f0;
  margin: 20px 0;
}

/* 文字工具类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-secondary { color: var(--text-secondary); }
.text-light { color: var(--text-light); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* 响应式 */
@media screen and (max-width: 480px) {
  .card {
    padding: 24px 20px;
    border-radius: 14px;
  }

  .score-number {
    font-size: 56px;
  }

  .compensation-amount {
    font-size: 28px;
  }

  .btn-lg {
    padding: 14px 28px;
    font-size: 16px;
  }

  .tag-grid {
    gap: 10px;
  }

  .tag-item {
    padding: 12px 10px;
    font-size: 13px;
  }
}

@media screen and (max-width: 360px) {
  .card {
    padding: 20px 16px;
  }

  .score-number {
    font-size: 48px;
  }

  .tag-grid {
    gap: 8px;
  }
}

/* 安全区域适配（iPhone X+） */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .page-container {
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
}
