/* @import 引入高质感字体 */
@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700&family=Be+Vietnam+Pro:wght@300;400;500;600&display=swap');

/* 核心变量定义 (符合 DESIGN.md) */
:root {
  --color-background: #f9f9f9;
  --color-surface: #ffffff;
  --color-surface-dim: #dadada;
  --color-surface-bright: #f9f9f9;
  --color-surface-container-lowest: #ffffff;
  --color-surface-container-low: #f3f3f4;
  --color-surface-container: #eeeeee;
  --color-surface-container-high: #e8e8e8;
  --color-surface-container-highest: #e2e2e2;
  
  --color-primary: #00132d; /* 强调 Navy */
  --color-on-primary: #ffffff;
  --color-primary-container: #0f2848;
  --color-on-primary-container: #7a90b5;
  
  --color-secondary: #456083; /* 辅助 Slate */
  --color-on-secondary: #ffffff;
  --color-secondary-container: #bbd6ff;
  --color-on-secondary-container: #425d80;
  
  --color-tertiary: #1f1000;
  --color-on-tertiary: #ffffff;
  --color-tertiary-container: #ffddb6; /* 偏草稿高亮黄 */
  --color-on-tertiary-container: #c08229; /* 偏琥珀橘 */
  --color-tertiary-highlight: #ffb95b; /* 琥珀色 */
  
  --color-error: #ba1a1a;
  --color-on-error: #ffffff;
  --color-error-container: #ffdad6;
  
  --color-surface-muted: #F7FAFE;
  --color-border-light: #E2EBF5;
  --color-divider: rgba(0, 0, 0, 0.09);
  --color-text-dim: rgba(15, 40, 72, 0.65);

  /* 字体族 */
  --font-headline: 'Hanken Grotesk', 'PingFang SC', -apple-system, sans-serif;
  --font-body: 'Be Vietnam Pro', 'PingFang SC', -apple-system, sans-serif;

  /* 间距 */
  --spacing-micro: 4px;
  --spacing-tiny: 6px;
  --spacing-small: 8px;
  --spacing-medium: 12px;
  --spacing-large: 16px;
  --spacing-xlarge: 20px;
  --spacing-section: 20px;

  /* 圆角 */
  --radius-sm: 4px;
  --radius-badge: 6px;
  --radius-card: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* 阴影 */
  --shadow-soft: 0 4px 20px rgba(0, 19, 45, 0.03);
  --shadow-hover: 0 8px 30px rgba(0, 19, 45, 0.06);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--color-background);
  color: var(--color-primary);
  font-size: 14px;
  line-height: 1.4;
  overflow-x: hidden;
  user-select: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-headline);
  font-weight: 600;
}

/* 微信小程序外层包裹 - H5模拟容器 */
.miniprogram-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-background);
  position: relative;
}

/* 微信小程序顶栏 (NavigationBar) */
.nav-bar {
  height: 88px;
  background-color: transparent;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 16px 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  font-family: var(--font-headline);
}
.nav-bar.sticky-bg {
  background-color: rgba(249, 249, 249, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-divider);
}
.nav-bar .title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
}
.nav-bar .actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-bar .back-btn {
  font-size: 16px;
  color: var(--color-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 胶囊按钮 (Capsule Button) */
.capsule-button {
  width: 87px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 0, 0, 0.08);
  background-color: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
}
.capsule-button .dots {
  display: flex;
  gap: 3px;
}
.capsule-button .dots span {
  width: 5px;
  height: 5px;
  background-color: #000;
  border-radius: 50%;
}
.capsule-button .dots span:nth-child(2) {
  opacity: 0.5;
}
.capsule-button .dots span:nth-child(3) {
  opacity: 0.3;
}
.capsule-button .line {
  width: 1px;
  height: 18px;
  background-color: rgba(0, 0, 0, 0.1);
}
.capsule-button .circle-btn {
  width: 16px;
  height: 16px;
  border: 2px solid #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.capsule-button .circle-btn::after {
  content: '';
  width: 6px;
  height: 6px;
  background-color: #000;
  border-radius: 50%;
}

/* 微信小程序底栏 (TabBar) */
.tab-bar {
  height: 76px;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--color-divider);
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding-bottom: 12px;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--color-secondary);
  font-size: 10px;
  transition: all 0.2s ease;
  position: relative;
}
.tab-item svg {
  width: 22px;
  height: 22px;
  margin-bottom: 4px;
  fill: none;
  stroke: var(--color-secondary);
  stroke-width: 1.8;
}
.tab-item.active {
  color: #d15656; /* 配合首页的粉红基调 */
}
.tab-item.active svg {
  stroke: #d15656;
}
.tab-item.active .tab-pill {
  position: absolute;
  top: 6px;
  width: 48px;
  height: 48px;
  background-color: rgba(209, 86, 86, 0.06);
  border-radius: var(--radius-xl);
  z-index: -1;
  animation: tab-bounce 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes tab-bounce {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* 小程序主滚动内容区域 */
.scroll-view {
  flex: 1;
  padding: 0 16px 90px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 卡片系统 (Card System) */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border-light);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.card:active {
  transform: scale(0.985);
}

/* 按钮组件 (Button Components) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--radius-card);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  gap: 6px;
}
.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-on-primary);
}
.btn-primary:active {
  background-color: var(--color-primary-container);
}
.btn-secondary {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-light);
  color: var(--color-secondary);
}
.btn-secondary:active {
  background-color: var(--color-surface-container-low);
}
.btn-tertiary {
  background-color: var(--color-tertiary-container);
  color: var(--color-on-tertiary-container);
}
.btn-large {
  width: 100%;
  padding: 12px 20px;
  font-size: 15px;
}

/* 状态标签 (Status Tags) */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--radius-badge);
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
}
.badge-active {
  background-color: rgba(69, 96, 131, 0.1);
  color: var(--color-secondary);
}
.badge-draft {
  background-color: rgba(255, 185, 91, 0.15);
  color: var(--color-on-tertiary-container);
  border: 1px solid rgba(255, 185, 91, 0.3);
}
.badge-disabled {
  background-color: var(--color-surface-container-highest);
  color: var(--color-secondary);
}

/* 输入框与表单 */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-secondary);
  margin-bottom: 6px;
  display: block;
}
.form-input {
  width: 100%;
  height: 44px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-card);
  padding: 0 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-primary);
  outline: none;
  transition: border-color 0.2s ease;
}
.form-input:focus {
  border-color: var(--color-secondary);
}
.form-textarea {
  width: 100%;
  min-height: 100px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-card);
  padding: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-primary);
  outline: none;
  resize: none;
  transition: border-color 0.2s ease;
}
.form-textarea:focus {
  border-color: var(--color-secondary);
}

/* 弹窗与抽屉 (Modal & Bottom Drawer) */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}
.drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 85%;
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.1, 0.76, 0.55, 0.94);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer.active {
  transform: translateY(0);
}
.drawer-header {
  padding: 16px;
  border-bottom: 1px solid var(--color-divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

/* 微信环境的提示 */
.hint-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  text-align: center;
  white-space: nowrap;
}
.hint-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
