/* ===== 重置与基础 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #4A90D9;
  --primary-dark: #357ABD;
  --primary-light: #EBF4FF;
  --accent: #F5A623;
  --accent-dark: #E09010;
  --success: #27AE60;
  --danger: #E74C3C;
  --warn: #F39C12;
  --text: #2C3E50;
  --text-sub: #7F8C8D;
  --border: #E8ECF0;
  --bg: #F4F7FB;
  --white: #FFFFFF;
  --shadow: 0 2px 12px rgba(74,144,217,0.10);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all .2s ease;
}
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, textarea, select { font-family: inherit; outline: none; }
img { max-width: 100%; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 3px; }

/* ===== 布局 ===== */
.app-wrap { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--white); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; transition: var(--transition); }
.main-content { margin-left: 240px; flex: 1; min-height: 100vh; display: flex; flex-direction: column; }
.top-bar { height: 60px; background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.page-content { padding: 24px; flex: 1; }

/* ===== Sidebar ===== */
.sidebar-logo { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar-logo .logo-icon { width: 38px; height: 38px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 18px; flex-shrink: 0; }
.sidebar-logo .logo-text { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.2; }
.sidebar-logo .logo-sub { font-size: 11px; color: var(--text-sub); }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section-title { font-size: 11px; color: var(--text-sub); padding: 8px 20px 4px; text-transform: uppercase; letter-spacing: .5px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 20px; font-size: 14px; color: var(--text-sub); cursor: pointer; transition: var(--transition); border-radius: var(--radius-sm); margin: 2px 8px; }
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item .nav-icon { width: 20px; text-align: center; font-size: 16px; flex-shrink: 0; }
.sidebar-bottom { padding: 16px; border-top: 1px solid var(--border); }
.user-mini { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 14px; font-weight: 700; flex-shrink: 0; }
.user-mini-info { flex: 1; min-width: 0; }
.user-mini-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mini-pts { font-size: 11px; color: var(--accent); }

/* ===== Top Bar ===== */
.page-title { font-size: 16px; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-pts { background: linear-gradient(135deg, var(--accent), #F7C052); color: var(--white); padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.hamburger { display: none; width: 36px; height: 36px; align-items: center; justify-content: center; cursor: pointer; border-radius: var(--radius-sm); color: var(--text); font-size: 18px; }

/* ===== 通用卡片 ===== */
.card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--primary); }

/* ===== 按钮 ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; transition: var(--transition); cursor: pointer; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(74,144,217,0.3); }
.btn-accent { background: var(--accent); color: var(--white); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-success { background: var(--success); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-input { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; transition: var(--transition); background: var(--white); color: var(--text); }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,144,217,0.15); }
.form-input::placeholder { color: #BDC3C7; }
textarea.form-input { resize: vertical; min-height: 80px; }

/* ===== 徽章 ===== */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #E8F8F0; color: var(--success); }
.badge-accent { background: #FEF5E7; color: var(--accent); }
.badge-danger { background: #FDEDEC; color: var(--danger); }

/* ===== Toast ===== */
#toast { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item { background: var(--white); border-radius: var(--radius-sm); padding: 12px 18px; box-shadow: 0 4px 20px rgba(0,0,0,0.12); font-size: 14px; display: flex; align-items: center; gap: 10px; min-width: 200px; max-width: 320px; animation: slideIn .3s ease; border-left: 4px solid var(--primary); }
.toast-item.success { border-left-color: var(--success); }
.toast-item.error { border-left-color: var(--danger); }
.toast-item.warning { border-left-color: var(--warn); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { to { transform: translateX(120%); opacity: 0; } }

/* ===== 模态框 ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; visibility: hidden; transition: var(--transition); }
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal { background: var(--white); border-radius: var(--radius); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; transform: scale(.95) translateY(20px); transition: var(--transition); }
.modal-overlay.show .modal { transform: scale(1) translateY(0); }
.modal-header { padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: var(--radius-sm); color: var(--text-sub); font-size: 18px; transition: var(--transition); }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ===== 登录页 ===== */
#auth-page { position: fixed; inset: 0; background: linear-gradient(135deg, #E8F4FD 0%, #FFF9F0 100%); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.auth-card { background: var(--white); border-radius: 20px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 8px 40px rgba(74,144,217,0.15); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-big { width: 60px; height: 60px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; font-size: 28px; color: var(--white); margin-bottom: 10px; }
.auth-logo h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.auth-logo p { font-size: 13px; color: var(--text-sub); margin-top: 4px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 24px; }
.auth-tab { flex: 1; text-align: center; padding: 9px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--text-sub); transition: var(--transition); }
.auth-tab.active { background: var(--white); color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

/* ===== 打卡页 ===== */
.today-hero { background: linear-gradient(135deg, var(--primary) 0%, #6AB0F5 100%); border-radius: var(--radius); padding: 24px; color: var(--white); margin-bottom: 16px; position: relative; overflow: hidden; }
.today-hero::after { content: '✝'; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 80px; opacity: .08; }
.today-date { font-size: 13px; opacity: .85; margin-bottom: 4px; }
.today-book { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.today-verses { font-size: 14px; opacity: .9; margin-bottom: 16px; }
.today-title-badge { display: inline-flex; align-items: center; background: rgba(255,255,255,0.2); padding: 4px 12px; border-radius: 20px; font-size: 13px; }
.checkin-done { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.2); padding: 10px 16px; border-radius: var(--radius-sm); margin-top: 16px; font-size: 14px; }

/* ===== 经文内容区 ===== */
.scripture-content { font-size: 15px; line-height: 2; color: var(--text); padding: 16px 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; max-height: 300px; overflow-y: auto; }
.scripture-verse { display: flex; gap: 8px; margin-bottom: 6px; }
.verse-num { color: var(--primary); font-size: 12px; font-weight: 700; min-width: 20px; padding-top: 3px; }

/* ===== 学习板块 ===== */
.learn-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.learn-tab { padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; background: var(--bg); color: var(--text-sub); transition: var(--transition); border: 1.5px solid transparent; }
.learn-tab.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.learn-panel { display: none; animation: fadeIn .3s ease; }
.learn-panel.show { display: block; }
.learn-content { font-size: 14px; line-height: 1.9; color: var(--text); }
.learn-content h4 { font-size: 15px; font-weight: 700; color: var(--primary); margin: 12px 0 6px; }
.learn-content p { margin-bottom: 10px; }
.story-card { background: linear-gradient(135deg, #FEF5E7, #FFFBF5); border-radius: var(--radius-sm); padding: 16px; border-left: 4px solid var(--accent); }
.story-title { font-size: 14px; font-weight: 700; color: var(--accent-dark); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }

/* ===== 打卡输入 ===== */
.checkin-area { background: var(--bg); border-radius: var(--radius-sm); padding: 16px; }
.checkin-area textarea { background: var(--white); }
.checkin-points-hint { font-size: 12px; color: var(--text-sub); margin-top: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pts-badge { background: var(--accent); color: var(--white); border-radius: 4px; padding: 1px 7px; font-size: 11px; font-weight: 700; }

/* ===== 排行榜 ===== */
.rank-list { }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.rank-item:last-child { border-bottom: none; }
.rank-num { width: 32px; text-align: center; font-size: 15px; font-weight: 800; flex-shrink: 0; }
.rank-num.gold { color: #F1C40F; }
.rank-num.silver { color: #95A5A6; }
.rank-num.bronze { color: #C67C3A; }
.rank-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 15px; font-weight: 700; flex-shrink: 0; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-sub { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.rank-pts { font-size: 15px; font-weight: 800; color: var(--accent); flex-shrink: 0; }
.my-rank-card { background: linear-gradient(135deg, var(--primary-light), #FFF9F0); border: 1.5px solid var(--primary); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }

/* ===== 礼品商城 ===== */
.gifts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.gift-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: var(--transition); cursor: pointer; border: 2px solid transparent; }
.gift-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(74,144,217,0.15); border-color: var(--primary); }
.gift-img { height: 120px; display: flex; align-items: center; justify-content: center; font-size: 48px; background: linear-gradient(135deg, var(--primary-light), #FFF9F0); }
.gift-body { padding: 12px 14px; }
.gift-name { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.gift-desc { font-size: 12px; color: var(--text-sub); margin-bottom: 10px; line-height: 1.5; }
.gift-pts { display: flex; align-items: center; justify-content: space-between; }
.gift-pts-val { font-size: 16px; font-weight: 800; color: var(--accent); }
.gift-pts-label { font-size: 11px; color: var(--text-sub); }

/* ===== 统计卡片 ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-align: center; }
.stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-val { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-sub); margin-top: 4px; }

/* ===== 进度条 ===== */
.progress-wrap { background: var(--bg); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 20px; transition: width .6s ease; }

/* ===== 打卡日历 ===== */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-nav-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-sub); font-size: 16px; transition: var(--transition); }
.cal-nav-btn:hover { background: var(--bg); color: var(--primary); }
.cal-title { font-size: 14px; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-head { font-size: 11px; color: var(--text-sub); padding: 4px 0; }
.cal-day { width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 13px; border-radius: 50%; cursor: pointer; transition: var(--transition); }
.cal-day.today { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.cal-day.checked { background: var(--success); color: var(--white); font-weight: 700; }
.cal-day.other { color: var(--border); }
.cal-day:hover:not(.other):not(.checked) { background: var(--bg); }

/* ===== 积分记录 ===== */
.point-log-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.point-log-item:last-child { border-bottom: none; }
.point-log-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.point-log-icon.earn { background: #E8F8F0; }
.point-log-icon.spend { background: #FDEDEC; }
.point-log-info { flex: 1; }
.point-log-desc { font-size: 14px; font-weight: 500; }
.point-log-time { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.point-log-pts { font-size: 15px; font-weight: 700; flex-shrink: 0; }
.point-log-pts.earn { color: var(--success); }
.point-log-pts.spend { color: var(--danger); }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-sub); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* ===== Loading ===== */
.loading { display: inline-flex; align-items: center; gap: 6px; color: var(--text-sub); font-size: 14px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== 连续打卡火焰 ===== */
.streak-badge { display: inline-flex; align-items: center; gap: 5px; background: linear-gradient(135deg, #FF6B35, #F7C052); color: var(--white); padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: 700; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; display: none; }
  .sidebar-overlay.show { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .gifts-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-card { padding: 28px 20px; }
  .gifts-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .gifts-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { border-radius: var(--radius) var(--radius) 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: 100%; max-height: 95vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}
