/* app.css - 完整样式 v2.1.0 */

:root {
  --primary: #FF9500;
  --primary-light: #FFF4E6;
  --text: #333;
  --text-secondary: #666;
  --text-light: #999;
  --bg: #f5f5f5;
  --border: #e0e0e0;
  --white: #fff;
  --danger: #F5222D;
  --success: #52C41A;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  max-width: 430px;
  margin: 0 auto;
}

.page-content { padding: 16px; padding-bottom: 80px; min-height: 100vh; }

/* ========== TabBar ========== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 430px; margin: 0 auto;
  background: var(--white); display: flex; border-top: 1px solid var(--border); z-index: 100;
}
.tab-item { flex: 1; text-align: center; padding: 8px 0; cursor: pointer; color: var(--text-secondary); font-size: 12px; }
.tab-item.active { color: var(--primary); }
.tab-icon { display: block; font-size: 20px; margin-bottom: 2px; }

/* ========== 认证页 ========== */
.auth-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-header { text-align: center; margin-bottom: 30px; }
.auth-logo { font-size: 60px; margin-bottom: 10px; }
.auth-header h1 { font-size: 24px; margin-bottom: 8px; }
.auth-header p { color: var(--text-secondary); }
.auth-form { width: 100%; max-width: 320px; }
.auth-link { text-align: center; margin-top: 16px; color: var(--text-secondary); }
.auth-link span { color: var(--primary); cursor: pointer; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-secondary); }
.form-input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: var(--white); }
.form-input:focus { outline: none; border-color: var(--primary); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: none; }

/* ========== 按钮 ========== */
.btn { padding: 12px 20px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; display: inline-block; }
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--bg); color: var(--text); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-full { width: 100%; display: block; text-align: center; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-icon { width: 32px; height: 32px; border: none; border-radius: 50%; background: var(--bg); cursor: pointer; font-size: 16px; }
.btn-group { display: flex; gap: 12px; margin-top: 16px; }
.btn-group .btn { flex: 1; }

/* ========== 首页 ========== */
.home-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.home-header h2 { font-size: 20px; }
.home-header p { color: var(--text-secondary); font-size: 13px; }
.section { margin-bottom: 24px; }
.section h3 { font-size: 16px; margin-bottom: 12px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-header h3 { margin-bottom: 0; }
.more-link { color: var(--primary); font-size: 13px; cursor: pointer; }

.pets-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.pet-card {
  min-width: 100px; background: var(--white); border-radius: 12px; padding: 16px;
  text-align: center; cursor: pointer; border: 2px solid transparent; position: relative;
}
.pet-card.selected { border-color: var(--primary); background: var(--primary-light); }
.pet-card.add-card { border: 2px dashed var(--border); display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--text-light); }
.pet-card .edit-pet-btn { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border: none; background: rgba(0,0,0,0.1); border-radius: 50%; cursor: pointer; font-size: 12px; }
.pet-avatar { font-size: 40px; margin-bottom: 8px; display: flex; justify-content: center; }
.pet-avatar img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
.pet-name { font-weight: 500; margin-bottom: 4px; }
.pet-breed { font-size: 12px; color: var(--text-secondary); }
.pet-info { font-size: 11px; color: var(--text-light); margin-top: 4px; }

.quick-actions { display: flex; gap: 12px; margin-bottom: 24px; }
.quick-action { flex: 1; background: var(--white); border-radius: 12px; padding: 16px; text-align: center; cursor: pointer; }
.quick-action .icon { font-size: 24px; display: block; margin-bottom: 8px; }
.quick-action span:last-child { font-size: 13px; }

/* ========== 诊断页 ========== */
.diagnosis-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; background: var(--white); position: sticky; top: 0; z-index: 10; }
.diagnosis-header h2 { font-size: 17px; }
.back-btn { width: 32px; height: 32px; border: none; background: var(--bg); border-radius: 8px; cursor: pointer; font-size: 18px; }

.steps-bar { display: flex; justify-content: space-between; padding: 16px 0; background: var(--white); margin-bottom: 16px; }
.step-item { text-align: center; flex: 1; }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--border); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; margin-bottom: 4px; }
.step-item.active .step-num { background: var(--primary); color: white; }
.step-item.done .step-num { background: var(--success); color: white; }
.step-label { font-size: 11px; color: var(--text-secondary); }
.step-item.active .step-label { color: var(--primary); }

.step-content { background: var(--white); border-radius: 12px; padding: 16px; }
.step-content h3 { font-size: 16px; margin-bottom: 16px; }

.pet-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.type-card { background: var(--bg); border-radius: 12px; padding: 16px; text-align: center; cursor: pointer; border: 2px solid transparent; }
.type-card.selected { border-color: var(--primary); background: var(--primary-light); }
.type-icon { font-size: 32px; margin-bottom: 8px; }
.type-name { font-weight: 500; margin-bottom: 4px; }
.type-desc { font-size: 12px; color: var(--text-secondary); }

.symptoms-input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; resize: none; height: 120px; margin-bottom: 16px; }
.tips-box { background: #FFF9E6; border-radius: 10px; padding: 12px; margin-bottom: 16px; font-size: 13px; color: #996600; }
.tips-title { font-weight: 500; margin-bottom: 6px; }
.diagnosis-summary { background: var(--bg); border-radius: 10px; padding: 12px; margin-bottom: 16px; }

.upload-zone { border: 2px dashed var(--border); border-radius: 12px; padding: 32px; text-align: center; cursor: pointer; margin-bottom: 16px; position: relative; z-index: 1; }
.upload-zone .icon, .upload-zone .hint { pointer-events: none; }
.upload-zone .icon { font-size: 32px; display: block; margin-bottom: 8px; }
.upload-zone .hint { font-size: 12px; color: var(--text-secondary); }
.image-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.preview-item { position: relative; }
.preview-img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.remove-img { position: absolute; top: -6px; left: 44px; width: 20px; height: 20px; background: var(--danger); color: white; border-radius: 50%; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.result-content { text-align: center; }
.result-card { background: var(--bg); border-radius: 12px; padding: 16px; margin-bottom: 16px; text-align: left; }
.result-card h4 { font-size: 14px; margin-bottom: 8px; }
.result-card.urgent { background: #FFF2F0; border: 1px solid var(--danger); color: var(--danger); }
.result-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.result-value { font-size: 16px; font-weight: 500; }
.result-card.suggestion { background: #F6FFED; border: 1px solid var(--success); }

/* ========== 社交平台参考 ========== */
.social-search-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.social-search-section .section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.social-search-section h3 { font-size: 16px; margin: 0; }
.search-count { font-size: 12px; color: var(--text-secondary); }
.social-intro { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.social-hint { font-size: 12px; color: var(--text-light); text-align: center; margin-top: 8px; }

.social-loading { text-align: center; padding: 20px; }
.loading-spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

.social-results { display: flex; flex-direction: column; gap: 8px; }
.social-result-item { display: block; background: var(--white); border-radius: 10px; padding: 12px; text-decoration: none; color: inherit; position: relative; }
.social-result-item:active { background: var(--bg); }
.social-source { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.source-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.source-badge.xiaohongshu { background: #FF2442; color: white; }
.source-badge.weibo { background: #FF6600; color: white; }
.source-badge.baidu { background: #2932E1; color: white; }
.source-likes { font-size: 11px; color: var(--text-secondary); }
.social-title { font-size: 14px; font-weight: 500; line-height: 1.4; margin-bottom: 4px; }
.social-snippet { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.social-arrow { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-light); }

.result-actions { display: flex; gap: 8px; margin-top: 16px; }
.result-actions .btn { flex: 1; }

/* ========== 诊断历史 ========== */
.page-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; margin-bottom: 16px; }
.page-header h2 { font-size: 17px; }

.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-list.full .history-item { padding: 16px; }
.history-item { display: flex; align-items: center; gap: 12px; background: var(--white); padding: 12px; border-radius: 8px; cursor: pointer; }
.history-icon { font-size: 24px; }
.history-info { flex: 1; }
.history-pet { font-weight: 500; }
.history-type { font-size: 12px; color: var(--primary); }
.history-symptoms { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.history-time { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.history-arrow { color: var(--text-light); }

/* ========== 诊断详情 ========== */
.detail-card { background: var(--white); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-secondary); }
.detail-value { font-weight: 500; }

.result-section { margin-top: 16px; }
.result-section h3 { font-size: 16px; margin-bottom: 12px; }

.social-refs { background: var(--white); border-radius: 12px; padding: 16px; }
.refs-intro { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.ref-item { display: block; padding: 12px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.ref-item:last-child { border-bottom: none; }
.ref-source { font-size: 11px; color: var(--primary); margin-bottom: 4px; }
.ref-title { font-size: 14px; color: var(--text); line-height: 1.4; }

/* ========== 社区 ========== */
.community-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.community-header h2 { font-size: 20px; }
.community-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab-btn { padding: 8px 16px; background: var(--white); border-radius: 20px; font-size: 13px; cursor: pointer; color: var(--text-secondary); }
.tab-btn.active { background: var(--primary); color: white; }
.topic-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.topic-btn { padding: 6px 12px; background: var(--white); border-radius: 16px; font-size: 12px; cursor: pointer; color: var(--text-secondary); }
.topic-btn.active { background: var(--primary-light); color: var(--primary); }

.posts-list { display: flex; flex-direction: column; gap: 12px; }
.post-card { background: var(--white); border-radius: 12px; padding: 16px; }
.post-header { display: flex; gap: 12px; margin-bottom: 12px; }
.post-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 20px; overflow: hidden; }
.post-avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-user { flex: 1; }
.post-nickname { font-weight: 500; font-size: 14px; }
.post-time { font-size: 12px; color: var(--text-secondary); }
.post-content { margin-bottom: 12px; line-height: 1.6; font-size: 14px; }
.post-images { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 12px; }
.post-image { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; cursor: pointer; }
.post-topic { display: inline-block; background: var(--primary-light); color: var(--primary); padding: 4px 8px; border-radius: 4px; font-size: 12px; margin-bottom: 12px; }
.post-actions { display: flex; gap: 16px; }
.post-action { background: none; border: none; font-size: 14px; cursor: pointer; color: var(--text-secondary); padding: 0; }
.post-action.liked { color: #F5222D; }

/* ========== 发帖 ========== */
.post-textarea { width: 100%; border: none; resize: none; font-size: 14px; line-height: 1.6; padding: 0; }
.post-topics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.topic-tag { padding: 6px 12px; background: var(--bg); border-radius: 16px; font-size: 12px; cursor: pointer; }
.topic-tag.active { background: var(--primary); color: white; }
.post-images-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.post-image-item { position: relative; width: 80px; height: 80px; }
.post-image-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.remove-post-img { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; background: var(--danger); color: white; border-radius: 50%; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.add-image-btn { width: 80px; height: 80px; border: 2px dashed var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--text-light); cursor: pointer; }

/* ========== 提醒 ========== */
.reminders-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.reminders-header h2 { font-size: 20px; }
.reminders-list { display: flex; flex-direction: column; gap: 12px; }
.reminder-item { display: flex; align-items: center; gap: 12px; background: var(--white); border-radius: 12px; padding: 12px; }
.reminder-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.reminder-content { flex: 1; }
.reminder-title { font-weight: 500; }
.reminder-pet { font-size: 12px; color: var(--text-secondary); }
.reminder-time { font-size: 12px; color: var(--text-light); }
.reminder-actions { display: flex; gap: 8px; }

/* ========== 设置 ========== */
.settings-section { margin-bottom: 24px; }
.settings-section h3 { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; padding-left: 4px; }
.settings-item { display: flex; align-items: center; gap: 12px; background: var(--white); border-radius: 12px; padding: 16px; cursor: pointer; margin-bottom: 8px; }
.settings-item.danger { color: var(--danger); }
.settings-avatar { width: 50px; height: 50px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 24px; overflow: hidden; }
.settings-avatar img { width: 100%; height: 100%; object-fit: cover; }
.settings-label { font-weight: 500; }
.settings-desc { font-size: 12px; color: var(--text-secondary); }
.danger-zone { margin-top: 32px; border-top: 1px solid var(--border); padding-top: 16px; }

/* ========== 弹窗 ========== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: flex-end; z-index: 200; }
.modal { background: var(--white); width: 100%; border-radius: 16px 16px 0 0; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 17px; }
.modal-header .close { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; }
.modal-header .submit-btn { color: var(--primary); font-size: 15px; cursor: pointer; }
.modal-header span:first-child { color: var(--text-secondary); cursor: pointer; }
.modal-body { padding: 16px; }
.avatar-upload { text-align: center; margin-bottom: 16px; cursor: pointer; position: relative; z-index: 1; }
.avatar-upload-lg { text-align: center; margin-bottom: 16px; cursor: pointer; position: relative; z-index: 1; }
.avatar-upload * { pointer-events: none; }
.avatar-upload-lg * { pointer-events: none; }
.avatar-preview { width: 60px; height: 60px; border-radius: 50%; background: var(--bg); margin: 0 auto; display: flex; align-items: center; justify-content: center; font-size: 24px; overflow: hidden; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-preview-lg { width: 80px; height: 80px; border-radius: 50%; background: var(--bg); margin: 0 auto; display: flex; align-items: center; justify-content: center; font-size: 32px; overflow: hidden; }
.avatar-preview-lg img { width: 100%; height: 100%; object-fit: cover; }
.upload-hint { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 8px; }

/* ========== 空状态 ========== */
.empty { text-align: center; padding: 32px; color: var(--text-secondary); }

/* ========== Toast ========== */
.toast { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.8); color: white; padding: 8px 16px; border-radius: 20px; font-size: 14px; z-index: 9999; max-width: 80%; text-align: center; }
