/* ============================================================
   宝宝日常记录App - 样式表
   4套主题：暖阳橙(默认)、樱花粉、薄荷绿、星空蓝
   ============================================================ */

/* 主题变量 */
:root {
  --primary: #FF8C42;
  --primary-light: #FFB07A;
  --primary-dark: #E6732B;
  --primary-gradient: linear-gradient(135deg, #FFB07A 0%, #FF8C42 100%);
  --bg: #FFF8F2;
  --card-bg: #FFFFFF;
  --text: #333333;
  --text-light: #999999;
  --text-lighter: #CCCCCC;
  --border: #F0E6DC;
  --shadow: 0 4px 16px rgba(255, 140, 66, 0.12);
  --shadow-lg: 0 8px 32px rgba(255, 140, 66, 0.18);
  --success: #52C41A;
  --warning: #FAAD14;
  --danger: #FF4D4F;
  --info: #1890FF;
  --radius: 16px;
  --radius-lg: 24px;
}

/* 樱花粉 */
body.theme-pink {
  --primary: #FF85A2;
  --primary-light: #FFB3C6;
  --primary-dark: #E66B88;
  --primary-gradient: linear-gradient(135deg, #FFB3C6 0%, #FF85A2 100%);
  --bg: #FFF5F7;
  --shadow: 0 4px 16px rgba(255, 133, 162, 0.12);
  --shadow-lg: 0 8px 32px rgba(255, 133, 162, 0.18);
  --border: #F5E6EA;
}

/* 薄荷绿 */
body.theme-mint {
  --primary: #36CFC9;
  --primary-light: #7CE0DC;
  --primary-dark: #20B2AA;
  --primary-gradient: linear-gradient(135deg, #7CE0DC 0%, #36CFC9 100%);
  --bg: #F0FFFE;
  --shadow: 0 4px 16px rgba(54, 207, 201, 0.12);
  --shadow-lg: 0 8px 32px rgba(54, 207, 201, 0.18);
  --border: #E0F5F4;
}

/* 星空蓝 */
body.theme-blue {
  --primary: #4A90D9;
  --primary-light: #7BB3E8;
  --primary-dark: #3A7BC8;
  --primary-gradient: linear-gradient(135deg, #7BB3E8 0%, #4A90D9 100%);
  --bg: #F0F6FF;
  --shadow: 0 4px 16px rgba(74, 144, 217, 0.12);
  --shadow-lg: 0 8px 32px rgba(74, 144, 217, 0.18);
  --border: #E0EBF7;
}

/* 自定义背景图 */
body.custom-bg::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: var(--custom-bg);
  background-size: cover;
  background-position: center;
  filter: blur(8px);
  opacity: 0.35;
  z-index: -1;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* 应用容器：手机竖屏375px居中 */
.app {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 70px;
}

/* ========== 登录页 ========== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-gradient);
  padding: 20px;
}
.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { font-size: 56px; text-align: center; margin-bottom: 8px; }
.auth-title { text-align: center; font-size: 22px; font-weight: 700; color: var(--text); }
.auth-subtitle { text-align: center; color: var(--text-light); margin-top: 4px; margin-bottom: 24px; font-size: 13px; }
.auth-tabs { display: flex; margin-bottom: 20px; background: var(--bg); border-radius: 12px; padding: 4px; }
.auth-tab {
  flex: 1; border: none; background: transparent; padding: 10px;
  font-size: 14px; color: var(--text-light); border-radius: 8px; cursor: pointer;
  transition: all 0.2s;
}
.auth-tab.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.auth-form input {
  width: 100%; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 12px; font-size: 15px; margin-bottom: 12px; outline: none;
  transition: border-color 0.2s;
}
.auth-form input:focus { border-color: var(--primary); }

/* ========== 按钮 ========== */
.btn-primary {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--primary-gradient); color: #fff; font-size: 16px;
  font-weight: 600; cursor: pointer; transition: transform 0.1s, opacity 0.2s;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline {
  padding: 10px 20px; border: 1px solid var(--primary); color: var(--primary);
  background: transparent; border-radius: 10px; font-size: 14px; cursor: pointer;
}
.btn-ghost {
  padding: 8px 16px; border: none; background: var(--bg); color: var(--text-light);
  border-radius: 8px; font-size: 13px; cursor: pointer;
}
.btn-danger { color: var(--danger); border-color: var(--danger); }

/* ========== 顶部栏 ========== */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: var(--card-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  position: sticky; top: 0; z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  background: var(--primary-light); border: 2px solid var(--primary-light);
}
.header-name { font-size: 16px; font-weight: 600; }
.header-meta { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.sync-icon {
  width: 28px; height: 28px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 14px;
  background: var(--bg); color: var(--success);
}
.sync-icon.syncing { color: var(--warning); animation: spin 1s linear infinite; }
.sync-icon.error { color: var(--danger); }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ========== 主内容 ========== */
.app-main { padding: 16px; }
.page { animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ========== 卡片 ========== */
.card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }

/* 喝奶大卡片 */
.milk-card {
  background: var(--primary-gradient); color: #fff; border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 14px; box-shadow: var(--shadow-lg);
}
.milk-card .card-title { color: rgba(255,255,255,0.9); margin-bottom: 16px; }
.milk-stats { display: flex; justify-content: space-around; text-align: center; }
.milk-stat .num { font-size: 28px; font-weight: 700; }
.milk-stat .label { font-size: 12px; opacity: 0.85; margin-top: 4px; }
.milk-interval { text-align: center; margin-top: 14px; font-size: 13px; opacity: 0.9; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.2); }

/* 并排小卡片 */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.mini-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); text-align: center;
}
.mini-card .icon { font-size: 28px; }
.mini-card .num { font-size: 22px; font-weight: 700; color: var(--text); margin-top: 4px; }
.mini-card .label { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* 快捷记录 */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.quick-btn {
  background: var(--card-bg); border: none; border-radius: var(--radius);
  padding: 14px 4px; box-shadow: var(--shadow); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text); transition: transform 0.1s;
}
.quick-btn:active { transform: scale(0.95); }
.quick-btn .icon { font-size: 24px; }

/* 疫苗提醒 */
.vaccine-alert {
  background: linear-gradient(135deg, #FFF7E6 0%, #FFEFD5 100%);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-left: 4px solid var(--warning);
}
.vaccine-alert .info .name { font-weight: 600; font-size: 14px; }
.vaccine-alert .info .date { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.vaccine-alert .countdown { font-size: 13px; color: var(--warning); font-weight: 600; }

/* 时间线 */
.timeline { margin-top: 8px; }
.timeline-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-icon { font-size: 22px; width: 36px; text-align: center; }
.timeline-content { flex: 1; }
.timeline-type { font-size: 14px; font-weight: 500; }
.timeline-time { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.timeline-ml { font-size: 14px; font-weight: 600; color: var(--primary); }

/* ========== 底部导航 ========== */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 420px; background: var(--card-bg);
  display: flex; border-top: 1px solid var(--border);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
}
.nav-item {
  flex: 1; border: none; background: transparent; display: flex;
  flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: var(--text-light); cursor: pointer; padding: 4px;
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 22px; }

/* ========== 筛选Tab ========== */
.filter-tabs {
  display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto;
  padding-bottom: 4px;
}
.filter-tab {
  padding: 8px 16px; border: none; background: var(--card-bg);
  border-radius: 20px; font-size: 13px; color: var(--text-light);
  cursor: pointer; white-space: nowrap; box-shadow: var(--shadow);
}
.filter-tab.active { background: var(--primary); color: #fff; }

/* ========== 列表项 ========== */
.list-item {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between;
}
.list-item .main { flex: 1; }
.list-item .title { font-size: 14px; font-weight: 500; }
.list-item .sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.list-item .action { display: flex; gap: 8px; align-items: center; }
.del-btn {
  border: none; background: transparent; color: var(--danger);
  font-size: 18px; cursor: pointer; padding: 4px 8px;
}

/* 疫苗状态标签 */
.vaccine-status {
  font-size: 12px; padding: 3px 10px; border-radius: 10px; font-weight: 500;
}
.vaccine-status.done { background: #F6FFED; color: var(--success); }
.vaccine-status.pending { background: #F5F5F5; color: var(--text-light); }
.vaccine-status.delayed { background: #FFF7E6; color: var(--warning); }

/* ========== 表单 ========== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; outline: none; background: var(--card-bg);
  color: var(--text);
}
.form-group input:focus, .form-group select:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* 数字步进 */
.stepper { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 16px 0; }
.stepper button {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--bg); font-size: 20px; cursor: pointer; color: var(--primary);
  font-weight: 700;
}
.stepper .value { font-size: 32px; font-weight: 700; min-width: 80px; text-align: center; color: var(--primary); }
.stepper .unit { font-size: 14px; color: var(--text-light); }
.quick-amounts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.quick-amounts button {
  padding: 8px 16px; border: 1px solid var(--border); background: var(--card-bg);
  border-radius: 20px; font-size: 13px; cursor: pointer; color: var(--text);
}
.quick-amounts button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ========== 弹窗 ========== */
.modal-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45); z-index: 1000;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--card-bg); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%; max-width: 420px; padding: 20px;
  animation: slideUp 0.25s ease;
  max-height: 85vh; overflow-y: auto;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-title { font-size: 17px; font-weight: 600; text-align: center; margin-bottom: 16px; }
.modal-footer { display: flex; gap: 10px; margin-top: 16px; }
.modal-footer button { flex: 1; }

/* ========== Toast ========== */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75); color: #fff; padding: 12px 24px;
  border-radius: 10px; font-size: 14px; z-index: 2000;
  animation: toastIn 0.2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -40%); } to { opacity: 1; transform: translate(-50%, -50%); } }

/* ========== 图表容器 ========== */
.chart-wrap { position: relative; height: 240px; margin: 12px 0; }
.chart-wrap-sm { position: relative; height: 200px; margin: 12px 0; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-box {
  background: var(--card-bg); border-radius: var(--radius); padding: 14px 8px;
  text-align: center; box-shadow: var(--shadow);
}
.stat-box .num { font-size: 20px; font-weight: 700; color: var(--primary); }
.stat-box .label { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* 我的页面功能入口 */
.menu-list { background: var(--card-bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 14px; }
.menu-item {
  display: flex; align-items: center; padding: 14px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.menu-item:last-child { border-bottom: none; }
.menu-item .icon { font-size: 20px; width: 32px; }
.menu-item .text { flex: 1; font-size: 14px; }
.menu-item .arrow { color: var(--text-lighter); font-size: 16px; }

/* 主题选择 */
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
.theme-item {
  aspect-ratio: 1; border-radius: 12px; cursor: pointer;
  border: 3px solid transparent; position: relative;
}
.theme-item.active { border-color: var(--primary); }
.theme-item span { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 11px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* 体温颜色 */
.temp-normal { color: var(--success); }
.temp-low { color: var(--info); }
.temp-mild { color: var(--warning); }
.temp-mid { color: #FA8C16; }
.temp-high { color: var(--danger); }

/* 空状态 */
.empty { text-align: center; padding: 40px 20px; color: var(--text-light); }
.empty .icon { font-size: 48px; margin-bottom: 12px; }
.empty .text { font-size: 14px; }

/* 只读提示条 */
.readonly-bar {
  background: linear-gradient(90deg, #FFF7E6, #FFEFD5);
  color: #D48806; padding: 8px 16px; font-size: 12px;
  text-align: center; border-bottom: 1px solid #FFE58F;
}

/* 子页面返回栏 */
.sub-header {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  margin-bottom: 8px;
}
.sub-header .back-btn {
  border: none; background: var(--card-bg); width: 36px; height: 36px;
  border-radius: 50%; font-size: 18px; cursor: pointer; box-shadow: var(--shadow);
}
.sub-header .title { font-size: 17px; font-weight: 600; flex: 1; }
.sub-header .add-btn {
  border: none; background: var(--primary); color: #fff; width: 36px; height: 36px;
  border-radius: 50%; font-size: 20px; cursor: pointer;
}
