/* 指阅同城 - 全局样式 */
:root {
  --primary: #4A6CF7;
  --primary-light: #6B8AFF;
  --primary-dark: #3451D1;
  --accent: #FF6B35;
  --success: #22C55E;
  --danger: #EF4444;
  --warning: #F59E0B;
  --bg: #F5F6FA;
  --card-bg: #FFFFFF;
  --text: #1A1A2E;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;
  --border: #E5E7EB;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
img { display: block; max-width: 100%; }

/* 页面容器 */
#app { max-width: 500px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; padding-bottom: 60px; }

/* 顶部导航 */
.navbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(74,108,247,0.3);
}
.navbar .nav-title { font-size: 18px; font-weight: 700; }
.navbar .nav-back { font-size: 24px; cursor: pointer; padding: 4px 8px; }
.navbar .nav-right { font-size: 13px; opacity: 0.9; cursor: pointer; }

/* 横幅 */
.banner {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 20px 16px 16px;
  text-align: center;
}
.banner h1 { font-size: 22px; margin-bottom: 6px; }
.banner p { font-size: 12px; opacity: 0.9; }

/* 公告条 */
.notice-bar {
  background: #FFF9E6;
  border-bottom: 1px solid #FFE89E;
  padding: 8px 16px;
  font-size: 12px;
  color: #92700B;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
}
.notice-bar .icon { flex-shrink: 0; }

/* Tab栏 */
.tab-bar {
  display: flex;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-bar .tab {
  flex-shrink: 0;
  text-align: center;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab-bar .tab.active {
  color: var(--primary);
  font-weight: 700;
}
.tab-bar .tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

/* 搜索栏 */
.search-bar {
  padding: 10px 16px;
  background: var(--card-bg);
  display: flex;
  gap: 8px;
}
.search-bar input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  outline: none;
  background: var(--bg);
}
.search-bar input:focus { border-color: var(--primary); }
.search-bar .btn-search {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0 16px;
  font-size: 13px;
  cursor: pointer;
}

/* 信息卡片 */
.post-list { padding: 10px; }
.post-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
}
.post-card:active { transform: scale(0.98); }
.post-card .post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.post-card .post-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.post-type.carpool { background: #E8F0FF; color: var(--primary); }
.post-type.housing { background: #FFF0E6; color: var(--accent); }
.post-card .featured-badge {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.post-card .post-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card .post-info {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.post-card .post-info span { display: flex; align-items: center; gap: 3px; }
.post-card .post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.post-card .post-price { color: var(--accent); font-size: 16px; font-weight: 700; }
.post-card .post-price small { font-size: 11px; font-weight: 400; }
.post-card .post-meta { font-size: 11px; color: var(--text-light); }
.post-card .post-images {
  display: flex;
  gap: 6px;
  margin: 8px 0;
  overflow-x: auto;
}
.post-card .post-images img {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-disabled { opacity: 0.5; pointer-events: none; }

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: var(--safe-bottom);
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.bottom-nav .nav-item {
  flex: 1;
  text-align: center;
  padding: 8px 0 6px;
  color: var(--text-light);
  cursor: pointer;
  transition: color 0.2s;
}
.bottom-nav .nav-item.active { color: var(--primary); }
.bottom-nav .nav-item .icon { font-size: 22px; line-height: 1; }
.bottom-nav .nav-item .label { font-size: 11px; margin-top: 2px; }
.bottom-nav .nav-item.publish-btn .icon {
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -20px auto 0;
  font-size: 28px;
  box-shadow: 0 4px 12px rgba(74,108,247,0.4);
}

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  background: var(--card-bg);
  transition: border 0.2s;
  font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; min-height: 80px; }

/* 类型选择 */
.type-selector { display: flex; gap: 10px; margin-bottom: 16px; }
.type-selector .type-item {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.type-selector .type-item.active { border-color: var(--primary); background: #F0F4FF; }
.type-selector .type-item .icon { font-size: 28px; margin-bottom: 4px; }
.type-selector .type-item .name { font-size: 14px; font-weight: 600; }

/* 考试场景快捷入口 */
.exam-entry {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--card-bg);
  margin-bottom: 8px;
}
.exam-entry-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.exam-entry-item .exam-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}
.exam-entry-item span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 场景选择器 */
.scene-selector {
  display: flex;
  gap: 10px;
}
.scene-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.scene-item.active {
  border-color: var(--primary);
  background: #F0F4FF;
}
.scene-item .scene-emoji {
  font-size: 20px;
}
.scene-item span:last-child {
  font-size: 14px;
  font-weight: 600;
}

/* VIP卡片 */
.vip-card {
  background: linear-gradient(135deg, #2C2C3E, #1A1A2E);
  border-radius: 16px;
  padding: 24px 20px;
  color: #FFD700;
  margin: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.vip-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255,215,0,0.1), transparent);
  border-radius: 50%;
}
.vip-card .crown { font-size: 40px; }
.vip-card h2 { font-size: 20px; margin: 8px 0; }
.vip-card p { font-size: 12px; color: rgba(255,215,0,0.7); }

.vip-plans { padding: 0 16px; }
.vip-plan {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.vip-plan.active { border-color: var(--primary); background: #F0F4FF; }
.vip-plan .plan-info .plan-name { font-size: 16px; font-weight: 700; }
.vip-plan .plan-info .plan-desc { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.vip-plan .plan-price { font-size: 22px; font-weight: 700; color: var(--accent); }
.vip-plan .plan-price small { font-size: 12px; color: var(--text-light); }

.vip-benefits { padding: 16px; }
.vip-benefits .benefit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.vip-benefits .benefit-item:last-child { border: none; }
.vip-benefits .benefit-item .check { color: var(--success); font-size: 18px; }

/* 详情页 */
.detail-page { padding-bottom: 80px; }
.detail-header {
  background: var(--card-bg);
  padding: 16px;
  margin-bottom: 8px;
}
.detail-header .d-title { font-size: 18px; font-weight: 700; line-height: 1.5; margin-bottom: 10px; }
.detail-header .d-tags { display: flex; gap: 6px; margin-bottom: 10px; }
.detail-header .d-tag {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.detail-info {
  background: var(--card-bg);
  padding: 16px;
  margin-bottom: 8px;
}
.detail-info .info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.detail-info .info-row:last-child { border: none; }
.detail-info .info-row .label { color: var(--text-secondary); }
.detail-info .info-row .value { font-weight: 600; }
.detail-desc {
  background: var(--card-bg);
  padding: 16px;
  margin-bottom: 8px;
}
.detail-desc .desc-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.detail-desc .desc-content { font-size: 14px; line-height: 1.8; color: var(--text-secondary); }

.detail-contact {
  background: var(--card-bg);
  padding: 16px;
  margin-bottom: 8px;
  text-align: center;
}
.detail-contact .contact-locked {
  color: var(--text-light);
  font-size: 14px;
  padding: 20px 0;
}
.detail-contact .contact-locked .lock-icon { font-size: 32px; display: block; margin-bottom: 8px; }

/* 底部操作栏 */
.bottom-action {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  z-index: 100;
  padding-bottom: calc(12px + var(--safe-bottom));
}

/* 个人中心 */
.profile-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  padding: 24px 16px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
}
.profile-header .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 2px solid rgba(255,255,255,0.3);
}
.profile-header .user-info .name { font-size: 18px; font-weight: 700; }
.profile-header .user-info .phone { font-size: 13px; opacity: 0.8; }
.profile-header .vip-tag {
  display: inline-block;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
  font-weight: 600;
}

.profile-menu {
  background: var(--card-bg);
  margin: 10px;
  border-radius: var(--radius);
  overflow: hidden;
}
.profile-menu .menu-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}
.profile-menu .menu-item:active { background: var(--bg); }
.profile-menu .menu-item:last-child { border: none; }
.profile-menu .menu-item .m-icon { font-size: 20px; margin-right: 12px; width: 24px; text-align: center; }
.profile-menu .menu-item .m-text { flex: 1; font-size: 14px; }
.profile-menu .menu-item .m-arrow { color: var(--text-light); }
.profile-menu .menu-item .m-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-right: 6px;
}

/* 统计卡片 */
.stats-row {
  display: flex;
  padding: 12px;
  gap: 10px;
}
.stats-card {
  flex: 1;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stats-card .num { font-size: 22px; font-weight: 700; color: var(--primary); }
.stats-card .label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* 弹窗 */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: var(--card-bg);
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  overflow: hidden;
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal .modal-header {
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.modal .modal-body { padding: 20px; }
.modal .modal-footer {
  display: flex;
  border-top: 1px solid var(--border);
}
.modal .modal-footer .modal-btn {
  flex: 1;
  padding: 14px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
}
.modal .modal-footer .modal-btn.cancel { color: var(--text-secondary); border-right: 1px solid var(--border); }
.modal .modal-footer .modal-btn.confirm { color: var(--primary); }

/* 支付弹窗 */
.pay-modal .pay-amount { text-align: center; padding: 20px 0; }
.pay-modal .pay-amount .amount { font-size: 36px; font-weight: 700; color: var(--accent); }
.pay-modal .pay-amount .amount::before { content: '￥'; font-size: 18px; }
.pay-modal .pay-methods { padding: 0 20px 16px; }
.pay-modal .pay-method {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.pay-modal .pay-method:last-child { border: none; }
.pay-modal .pay-method .pm-icon { font-size: 24px; margin-right: 10px; }
.pay-modal .pay-method .pm-name { flex: 1; font-size: 14px; }
.pay-modal .pay-method .pm-check { width: 20px; height: 20px; border: 2px solid var(--border); border-radius: 50%; }
.pay-modal .pay-method.selected .pm-check { border-color: var(--success); background: var(--success); position: relative; }
.pay-modal .pay-method.selected .pm-check::after { content: '✓'; color: #fff; font-size: 12px; position: absolute; top: -1px; left: 3px; }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .text { font-size: 14px; }

/* 加载状态 */
.loading-more { text-align: center; padding: 16px; color: var(--text-light); font-size: 13px; }
.no-more { text-align: center; padding: 16px; color: var(--text-light); font-size: 12px; }

/* 登录注册页 */
.auth-page { padding: 40px 24px; }
.auth-page .logo { text-align: center; margin-bottom: 30px; }
.auth-page .logo .icon { font-size: 48px; }
.auth-page .logo h2 { font-size: 22px; margin-top: 8px; color: var(--primary); }
.auth-page .auth-form { background: var(--card-bg); border-radius: 16px; padding: 24px 20px; box-shadow: var(--shadow); }
.auth-page .auth-switch { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-secondary); }

/* 图片上传 */
.image-upload { display: flex; gap: 8px; flex-wrap: wrap; }
.image-upload .upload-btn {
  width: 72px; height: 72px;
  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;
  background: var(--bg);
}
.image-upload .img-preview {
  width: 72px; height: 72px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}
.image-upload .img-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-upload .img-preview .remove {
  position: absolute; top: 0; right: 0;
  width: 20px; height: 20px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border-radius: 0 0 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
}

/* Toast */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  animation: toastIn 0.2s ease;
  max-width: 80%;
  text-align: center;
}
@keyframes toastIn { from { opacity: 0; } to { opacity: 1; } }

/* 工具类 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.p-16 { padding: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }
