/* ========================================
   形勒生活 — 统一设计系统 (暖色版)
   ======================================== */

:root {
  /* ===== 颜色 - 暖色调 ===== */
  --bg: #FFF8F0;
  --bg-secondary: #FFF3E6;
  --bg-card: #FFFFFF;
  --bg-inset: #F5EDE4;
  --bg-hover: rgba(232,115,74,0.06);
  --bg-active: rgba(232,115,74,0.12);
  --bg-overlay: rgba(60,40,20,0.5);

  /* 文字 */
  --text: #2D1F14;
  --text-secondary: #8B7355;
  --text-tertiary: #B8A58A;
  --text-quaternary: #D4C8B8;
  --text-inverse: #FFFAF5;

  /* 品牌色 — 暖橙（提振食欲的健康感） */
  --accent: #E8734A;
  --accent-hover: #D4643C;
  --accent-active: #C95A32;
  --accent-dim: rgba(232,115,74,0.12);
  --accent-glow: rgba(232,115,74,0.25);

  /* 辅助暖色 */
  --warm-gold: #E8A84A;
  --warm-rose: #E8738A;
  --warm-green: #6BA85A;
  --warm-mint: #7AC4A0;
  --warm-teal: #4AA8B8;

  /* 语义色（调暖） */
  --success: #5AB84A;
  --success-dim: rgba(90,184,74,0.12);
  --warning: #E8A030;
  --warning-dim: rgba(232,160,48,0.12);
  --error: #E85540;
  --error-dim: rgba(232,85,64,0.12);

  /* 边框 */
  --border: rgba(180,150,120,0.12);
  --border-light: rgba(180,150,120,0.06);
  --border-heavy: rgba(180,150,120,0.2);

  /* 阴影 — 暖色影 */
  --shadow-sm: 0 2px 8px rgba(180,120,60,0.08);
  --shadow-md: 0 8px 24px rgba(180,120,60,0.1);
  --shadow-lg: 0 16px 40px rgba(180,120,60,0.14);

  /* 圆角 */
  --radius-sm: 10px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* 排版 */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', 'PingFang SC', sans-serif;
  --font-mono: 'SF Mono', 'Menlo', monospace;

  /* 导航 */
  --nav-height: 44px;
  --tab-height: 50px;
  --container-max: 680px;

  /* 过渡 */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
  --bounce: cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* ===== 全局重置 ===== */
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  padding-bottom: calc(var(--tab-height) + 30px);
  overflow-x: hidden;
}

/* ===== 导航栏 ===== */
.nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: rgba(255,248,240,0.85);
  border-bottom: 0.5px solid var(--border);
  padding: 0 20px;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--accent);
}
.nav-btn {
  background: var(--accent);
  color: var(--text-inverse);
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--spring);
}
.nav-btn:hover { background: var(--accent-hover); }
.nav-btn:active { transform: scale(0.95); opacity: 0.8; }

/* ===== 内容容器 ===== */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 16px 20px;
}

/* ===== 底部 Tab 导航 ===== */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: rgba(255,248,240,0.92);
  border-top: 0.5px solid var(--border);
  padding: 6px 0;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
}
.tabbar-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
}
.tabbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-tertiary);
  transition: all 0.25s var(--smooth);
  -webkit-user-select: none;
  user-select: none;
  padding: 2px 0;
  position: relative;
}
.tabbar-item::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 20px; height: 3px;
  background: var(--accent);
  border-radius: 2px;
  transition: transform 0.3s var(--spring);
}
.tabbar-item.active {
  color: var(--accent);
}
.tabbar-item.active::after {
  transform: translateX(-50%) scaleX(1);
}
.tabbar-item:active {
  transform: scale(0.92);
}
.tabbar-icon {
  font-size: 22px;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tabbar-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  transition: all 0.3s var(--smooth);
  animation: fadeUp 0.5s var(--spring) both;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.card:active {
  transform: scale(0.99);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.card-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* stagger card entrance */
.card:nth-child(1) { animation-delay: 0s; }
.card:nth-child(2) { animation-delay: 0.08s; }
.card:nth-child(3) { animation-delay: 0.16s; }
.card:nth-child(4) { animation-delay: 0.24s; }
.card:nth-child(5) { animation-delay: 0.32s; }
.card:nth-child(6) { animation-delay: 0.40s; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--spring);
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s;
  pointer-events: none;
}
.btn:active::after {
  background: rgba(255,255,255,0.2);
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  padding: 12px 24px;
  font-size: 15px;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 16px var(--accent-glow);
}
.btn-primary:active {
  box-shadow: 0 2px 6px var(--accent-glow);
}
.btn-secondary {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 10px 20px;
  font-size: 14px;
}
.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 8px 16px;
  font-size: 14px;
}

/* ===== 表单 ===== */
.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  font-family: var(--font);
  outline: none;
  transition: all 0.25s var(--smooth);
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}
.input:hover {
  border-color: var(--border-heavy);
}
.input::placeholder { color: var(--text-tertiary); }
.label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ===== 徽章 ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
}
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-error { background: var(--error-dim); color: var(--error); }
.badge-accent { background: var(--accent-dim); color: var(--accent); }

/* ===== 分隔线 ===== */
.separator {
  height: 0.5px;
  background: var(--border);
  margin: 16px 0;
}

/* ===== 动画 ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ===== 微交互工具类 ===== */
.hover-lift {
  transition: transform 0.2s var(--spring), box-shadow 0.2s var(--smooth);
}
.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.scale-press:active {
  transform: scale(0.96);
}
.fade-in {
  animation: fadeIn 0.3s var(--smooth);
}

/* ===== 暗色模式 ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1612;
    --bg-secondary: #2A2420;
    --bg-card: #2A2420;
    --bg-inset: #1A1612;
    --bg-hover: rgba(232,115,74,0.1);
    --bg-active: rgba(232,115,74,0.15);

    --text: #EDE0D4;
    --text-secondary: #A09080;
    --text-tertiary: #706050;
    --text-quaternary: #504540;
    --text-inverse: #2D1F14;

    --border: rgba(200,170,140,0.12);
    --border-light: rgba(200,170,140,0.06);
    --border-heavy: rgba(200,170,140,0.2);

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 16px 40px rgba(0,0,0,0.5);

    --accent-dim: rgba(232,115,74,0.2);
    --success-dim: rgba(90,184,74,0.2);
    --warning-dim: rgba(232,160,48,0.2);
    --error-dim: rgba(232,85,64,0.2);
  }

  .nav { background: rgba(26,22,18,0.85); }
  .tabbar { background: rgba(26,22,18,0.92); }
  .card { background: var(--bg-card); }
}
