/* ===== 健康保卫系统 - 样式表 ===== */

:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #dbeafe;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f0f4f8;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Auth Pages ===== */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 50%, #1e3a5f 100%);
}

.auth-container { width: 100%; max-width: 420px; padding: 20px; }

.auth-card {
  background: white;
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header h1 { font-size: 48px; margin-bottom: 8px; }
.auth-header h2 { font-size: 24px; color: var(--text); }
.auth-header p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 500; }

/* ===== Navbar ===== */
.navbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
  text-decoration: none;
}

.nav-links { display: flex; gap: 8px; align-items: center; }

.nav-link {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-link:hover { background: var(--primary-light); color: var(--primary); }

.nav-logout { color: var(--danger); }
.nav-logout:hover { background: #fef2f2; }

/* ===== Main Content ===== */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 { font-size: 28px; color: var(--text); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: white;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-block { display: flex; width: 100%; justify-content: center; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }

/* ===== Alerts ===== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-normal { background: #dcfce7; color: #166534; }
.badge-moderate { background: #fef3c7; color: #92400e; }
.badge-high { background: #fef2f2; color: #991b1b; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-lg { padding: 6px 14px; font-size: 14px; }

/* ===== Dashboard Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-icon { font-size: 32px; margin-bottom: 8px; }
.stat-value { font-size: 36px; font-weight: 700; color: var(--primary-dark); }
.stat-label { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.risk-normal { color: var(--success); }
.risk-moderate { color: var(--warning); }
.risk-high { color: var(--danger); }

/* ===== Actions Row ===== */
.actions-row {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

/* ===== Upload Zone ===== */
.upload-card { text-align: center; }

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.upload-zone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-hint { color: var(--text-muted); font-size: 13px; margin-top: 8px; }

.file-info {
  background: var(--primary-light);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

/* ===== Report List ===== */
.report-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  gap: 12px;
}

.report-item-header { display: flex; align-items: center; gap: 12px; }
.report-icon { font-size: 28px; }
.report-info h3 { font-size: 15px; margin-bottom: 2px; }
.report-info p { font-size: 13px; color: var(--text-muted); }

/* ===== Report Detail ===== */
.report-meta p { margin-bottom: 8px; }
.report-text { margin-top: 16px; }
.report-text h3 { margin-bottom: 12px; }

.text-content {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 500px;
  overflow-y: auto;
}

/* ===== Plan List ===== */
.plan-card-full { padding: 20px 24px; }

.plan-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.risk-indicator {
  width: 8px;
  height: 40px;
  border-radius: 4px;
}

.risk-indicator.risk-normal { background: var(--success); }
.risk-indicator.risk-moderate { background: var(--warning); }
.risk-indicator.risk-high { background: var(--danger); }

.plan-badges { margin-left: auto; display: flex; gap: 8px; }
.plan-summary { margin-bottom: 8px; color: var(--text-muted); }
.plan-meta { display: flex; align-items: center; gap: 16px; margin-top: 12px; flex-wrap: wrap; }

/* ===== Plan Detail ===== */
.header-actions { display: flex; align-items: center; gap: 12px; }

.analysis-detail pre,
.plan-text {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  background: #f8fafc;
  padding: 16px;
  border-radius: 8px;
  margin-top: 12px;
}

.suggestion-list { padding-left: 20px; }
.suggestion-list li { margin-bottom: 8px; line-height: 1.6; }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.plan-grid .card h3 { margin-bottom: 8px; }

.follow-up {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-left: 4px solid var(--primary);
}

/* ===== Analyzing Animation ===== */
.analyzing-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.analyzing-card {
  text-align: center;
  background: white;
  border-radius: var(--radius);
  padding: 48px;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 24px;
}

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

/* ===== Profile ===== */
.profile-card { max-width: 560px; }

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state h2 { margin-bottom: 8px; color: var(--text-muted); }
.empty-state p { color: var(--text-muted); margin-bottom: 20px; }

/* ===== Error Page ===== */
.error-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50vh;
}

.error-card {
  text-align: center;
}

.error-card h1 { font-size: 64px; }
.error-card h2 { font-size: 24px; margin: 8px 0; }
.error-card p { color: var(--text-muted); margin-bottom: 20px; }

/* ===== Text helpers ===== */
.text-muted { color: var(--text-muted); }

/* ===== Section ===== */
.section { margin-bottom: 32px; }
.section h2 { margin-bottom: 16px; font-size: 20px; }
