/* ============================================
   隐私保护 App - Design System
   基准: iPhone 375×812, #F7F8FA 背景
   ============================================ */

/* ── CSS Variables ── */
:root {
  /* Primary */
  --color-primary: #1677FF;
  --color-primary-hover: #4096FF;
  --color-primary-active: #0958D9;
  --color-primary-light: #E6F4FF;
  --color-primary-bg: rgba(22, 119, 255, 0.08);

  /* Danger */
  --color-danger: #FF4D4F;
  --color-danger-hover: #FF7875;
  --color-danger-active: #D9363E;
  --color-danger-light: #FFF1F0;

  /* Success */
  --color-success: #52C41A;
  --color-success-light: #F6FFED;

  /* Warning */
  --color-warning: #FAAD14;
  --color-warning-light: #FFFBE6;

  /* Neutral */
  --color-bg-page: #F7F8FA;
  --color-bg-card: #FFFFFF;
  --color-bg-hover: #F5F5F5;
  --color-bg-active: #E8E8E8;

  /* Text */
  --color-text-primary: #1F1F1F;
  --color-text-secondary: #8C8C8C;
  --color-text-tertiary: #BFBFBF;
  --color-text-placeholder: #BFBFBF;
  --color-text-inverse: #FFFFFF;
  --color-text-link: #1677FF;

  /* Border */
  --color-border: #F0F0F0;
  --color-border-strong: #D9D9D9;
  --color-divider: #F0F0F0;

  /* Overlay */
  --color-mask: rgba(0, 0, 0, 0.45);
  --color-mask-light: rgba(0, 0, 0, 0.25);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-xxl: 24px;
  --space-xxxl: 32px;

  /* Typography */
  --font-family: -apple-system, 'SF Pro Text', 'PingFang SC', 'Helvetica Neue', 'Noto Sans SC', sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-md: 13px;
  --font-size-base: 14px;
  --font-size-lg: 15px;
  --font-size-xl: 17px;
  --font-size-xxl: 20px;
  --font-size-title: 24px;
  --font-size-jumbo: 28px;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

  /* Sizing */
  --nav-height: 44px;
  --tab-bar-height: 50px;
  --status-bar-height: 47px;
  --safe-bottom: 34px;
  --list-item-height: 52px;
  --btn-height: 48px;
  --btn-height-sm: 36px;
  --input-height: 44px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.16);
  --shadow-sheet: 0 -4px 24px rgba(0, 0, 0, 0.12);

  /* Animation */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 350ms;

  /* Z-index */
  --z-normal: 1;
  --z-sticky: 10;
  --z-dropdown: 50;
  --z-modal: 100;
  --z-sheet: 150;
  --z-toast: 200;
  --z-mask: 90;
}

/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-lg);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-page);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

a {
  color: var(--color-text-link);
  text-decoration: none;
}

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

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
  -webkit-appearance: none;
  appearance: none;
}

button {
  cursor: pointer;
  user-select: none;
}

ul, ol {
  list-style: none;
}

/* ── Page Shell ── */
.page {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--color-bg-page);
  position: relative;
  overflow-x: hidden;
}

.page-content {
  padding-top: calc(var(--status-bar-height) + var(--nav-height));
  padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom));
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.page-content--no-tabs {
  padding-bottom: var(--safe-bottom);
}

.page-content--no-nav {
  padding-top: var(--status-bar-height);
}

/* ── Status Bar (Fake) ── */
.status-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: var(--status-bar-height);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 var(--space-xl) 6px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  background: var(--color-bg-page);
  z-index: var(--z-sticky);
}

.status-bar--dark {
  background: #1A1A1A;
  color: #FFFFFF;
}

.status-bar__time {
  font-weight: var(--font-weight-bold);
}

.status-bar__icons {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Navigation Bar ── */
.nav-bar {
  position: fixed;
  top: var(--status-bar-height);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  background: var(--color-bg-page);
  z-index: var(--z-sticky);
}

.nav-bar--white {
  background: var(--color-bg-card);
  border-bottom: 0.5px solid var(--color-border);
}

.nav-bar__left,
.nav-bar__right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 60px;
}

.nav-bar__right {
  justify-content: flex-end;
}

.nav-bar__title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  text-align: center;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-bar__btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-text-primary);
  font-size: 18px;
  transition: background var(--duration-fast);
}

.nav-bar__btn:active {
  background: var(--color-bg-hover);
}

.nav-bar__text-btn {
  font-size: var(--font-size-lg);
  color: var(--color-primary);
  font-weight: var(--font-weight-medium);
  padding: 6px 4px;
}

.nav-bar__text-btn--danger {
  color: var(--color-danger);
}

/* ── Large Title (iOS style) ── */
.large-title {
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  padding: var(--space-sm) 0 var(--space-lg);
}

/* ── Utility ── */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-link { color: var(--color-text-link); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-center { text-align: center; }
.text-right { text-align: right; }

.fw-regular { font-weight: var(--font-weight-regular); }
.fw-medium { font-weight: var(--font-weight-medium); }
.fw-semibold { font-weight: var(--font-weight-semibold); }
.fw-bold { font-weight: var(--font-weight-bold); }

.fs-xs { font-size: var(--font-size-xs); }
.fs-sm { font-size: var(--font-size-sm); }
.fs-md { font-size: var(--font-size-md); }
.fs-base { font-size: var(--font-size-base); }
.fs-lg { font-size: var(--font-size-lg); }
.fs-xl { font-size: var(--font-size-xl); }
.fs-xxl { font-size: var(--font-size-xxl); }

.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-xxl { margin-top: var(--space-xxl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-xxl { margin-bottom: var(--space-xxl); }

.px-lg { padding-left: var(--space-lg); padding-right: var(--space-lg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.hidden { display: none !important; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Scrollbar (hide on mobile) ── */
::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* ── Safe Area ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  :root {
    --safe-bottom: env(safe-area-inset-bottom, 34px);
    --status-bar-height: env(safe-area-inset-top, 47px);
  }
}
