/* ═══════════════════════════════════════
   style.css — 伐轲Love Web 全局样式
   响应式：手机 <768px | 平板 768-1024px | PC >1024px
   ═══════════════════════════════════════ */

/* ─── Reset ────────────────────────────── */

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  color: #333;
  background: #f5f5f5;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: #667eea; text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ─── 品牌色 ────────────────────────────── */

:root {
  --brand-start: #667eea;
  --brand-end: #764ba2;
  --brand-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --brand-light: rgba(102, 126, 234, 0.1);
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --border-color: #e0e0e0;
  --bg-white: #fff;
  --bg-page: #f5f5f5;
  --danger: #e74c3c;
  --success: #2ecc71;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
  --max-width: 480px;
}

/* ─── 通用布局 ──────────────────────────── */

.page {
  min-height: 100vh;
  background: var(--bg-page);
}

/* 居中容器（移动优先） */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* 宽屏扩展 */
@media (min-width: 768px) {
  .container { max-width: 720px; padding: 0 24px; }
}
@media (min-width: 1024px) {
  .container { max-width: 960px; padding: 0 32px; }
}

/* ─── 顶部导航栏 ────────────────────────── */

.navbar {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .navbar-inner { max-width: 720px; padding: 0 24px; }
}

.navbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.navbar-back {
  font-size: 15px;
  color: var(--brand-start);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.navbar-right {
  font-size: 14px;
  color: var(--brand-start);
  cursor: pointer;
}

/* ─── 底部导航 Tab Bar ─────────────────── */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border-top: 1px solid var(--border-color);
  display: flex;
  z-index: 100;
  height: 50px;
}

.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  gap: 2px;
}

.tabbar-item.active { color: var(--brand-start); }
.tabbar-item svg { width: 22px; height: 22px; }

/* 有 tabbar 的页面添加底部 padding */
.has-tabbar { padding-bottom: 60px; }

/* ─── 按钮 ──────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  user-select: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--brand-start);
  border: 1.5px solid var(--brand-start);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-block { width: 100%; }

.btn-sm { padding: 8px 16px; font-size: 14px; border-radius: 20px; }
.btn-lg { padding: 14px 32px; font-size: 18px; }

/* ─── 输入框 ────────────────────────────── */

.input-group { margin-bottom: 16px; }

.input-label {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-field {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--bg-white);
}

.input-field:focus { border-color: var(--brand-start); }

textarea.input-field {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  min-height: 100px;
}

/* ─── 卡片 ──────────────────────────────── */

.card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.card-body { padding: 16px; }

/* ─── 表单卡片（登录/注册等） ──────────── */

.form-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
}

/* ─── 滑动验证码 ────────────────────────── */

.slide-track {
  position: relative;
  width: 100%;
  height: 44px;
  background: #f0f0f0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  user-select: none;
  cursor: pointer;
}

.slide-fill {
  position: absolute;
  left: 0; top: 0; height: 100%;
  background: var(--brand-gradient);
  opacity: 0.3;
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.slide-thumb {
  position: absolute;
  top: 2px;
  width: 40px;
  height: 38px;
  background: var(--brand-gradient);
  color: white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  z-index: 2;
  cursor: grab;
  touch-action: none;
  transition: box-shadow 0.2s;
}

.slide-thumb:active { box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3); }

.captcha-status {
  display: block;
  font-size: 12px;
  margin-top: 6px;
}

/* ─── 加载状态 ──────────────────────────── */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-color);
  border-top-color: var(--brand-start);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

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

/* ─── 空状态 ────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ─── 错误提示 ──────────────────────────── */

.error-bar {
  background: #fff3f3;
  color: var(--danger);
  padding: 10px 16px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  display: none;
}

.error-bar.show { display: block; }

/* ─── 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: var(--radius-sm);
  font-size: 14px;
  z-index: 1000;
  pointer-events: none;
  animation: toast-fade 2s ease forwards;
}

@keyframes toast-fade {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  10% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ─── 模态框 ────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 28px 24px 20px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  animation: modal-slide 0.25s ease;
}

@keyframes modal-slide {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-body {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .btn { flex: 1; }

/* ─── 列表项 ────────────────────────────── */

.list-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-white);
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.15s;
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--brand-light); }

.list-item .content { flex: 1; min-width: 0; }
.list-item .title { font-size: 15px; font-weight: 500; color: var(--text-primary); }
.list-item .subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.list-item .arrow { color: #ccc; font-size: 16px; margin-left: 8px; }

/* ─── 头像 ──────────────────────────────── */

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  flex-shrink: 0;
  overflow: hidden;
  object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }
.avatar-xl { width: 80px; height: 80px; font-size: 30px; }

/* ─── 状态标签 ──────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-primary { background: var(--brand-light); color: var(--brand-start); }
.badge-success { background: #e8f8f0; color: #1a8d4e; }
.badge-warning { background: #fff8e1; color: #f39c12; }
.badge-danger { background: #fdeaea; color: var(--danger); }
.badge-muted { background: #f0f0f0; color: var(--text-muted); }

/* ─── 进度条 ────────────────────────────── */

.progress-bar {
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ─── 分隔线 ────────────────────────────── */

.divider {
  height: 1px;
  background: #f0f0f0;
  margin: 12px 0;
}

/* ─── 工具类 ────────────────────────────── */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.hidden { display: none; }
