/* ============================================
   BFST Design System — Redesigned v2
   Warm, educational palette. Premium feel.
   ============================================ */

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

:root {
  /* ---- Primary: warm indigo (educational, trustworthy) ---- */
  --primary: #EEF2FF;
  --primary-dark: #E0E7FF;
  --accent: #4F46E5;
  --accent-dark: #4338CA;
  --accent-teal: #0EA5E9;

  /* ---- Surfaces ---- */
  --background: #F8FAFC;
  --surface: #FFFFFF;

  /* ---- Text ---- */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-placeholder: #94A3B8;
  --text-muted: #94A3B8;

  /* ---- Borders ---- */
  --border: #E2E8F0;

  /* ---- Shadows (tinted to accent hue) ---- */
  --shadow: rgba(79, 70, 229, 0.12);

  /* ---- Status ---- */
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --danger: #DC2626;
  --vip: #F59E0B;

  /* ---- Legacy purple compat (maps to new indigo) ---- */
  --purple-primary: #4F46E5;
  --purple-bg-start: #EEF2FF;
  --purple-bg-end: #E0E7FF;

  --accent-green: #10B981;
  --accent-orange: #F59E0B;

  /* ---- Typography scale ---- */
  --font-size-xs: 12px;
  --font-size-sm: 13px;
  --font-size-base: 15px;
  --font-size-lg: 17px;
  --font-size-xl: 20px;
  --font-size-2xl: 26px;
  --font-size-3xl: 32px;

  /* ---- Spacing ---- */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-base: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 24px;
  --spacing-2xl: 32px;

  /* ---- Radius ---- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 2px 0 rgba(79, 70, 229, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(79, 70, 229, 0.08), 0 2px 4px -1px rgba(79, 70, 229, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(79, 70, 229, 0.08), 0 4px 6px -2px rgba(79, 70, 229, 0.04);
}

/* ---- Base ---- */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--background);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  line-height: 1.5;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* ---- Reduce motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Common container ---- */
.app-container {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

/* ---- Bottom navigation ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  background: var(--surface);
  max-width: 430px;
  margin: 0 auto;
  z-index: 100;
  box-shadow: 0 -1px 3px rgba(0,0,0,0.04);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 16px;
  cursor: pointer;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:hover {
  color: var(--text-secondary);
}

.bottom-nav-item.active {
  color: var(--accent);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
  transition: transform 0.2s;
}

.bottom-nav-item.active svg {
  transform: translateY(-1px);
}

.bottom-nav-center {
  position: relative;
}

.center-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  margin-top: -24px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.center-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.center-btn:active {
  transform: scale(0.95);
}

/* ---- NavBar ---- */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: 430px;
  margin: 0 auto;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 99;
}

.nav-bar-back {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 20px;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s;
}

.nav-bar-back:hover {
  background: var(--background);
}

.nav-bar-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.nav-bar-right {
  width: 60px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

/* ---- Section header ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.section-more {
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
}

.section-more:hover {
  color: var(--accent);
}

/* ---- Page header bar ---- */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-btn {
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  color: var(--text-primary);
  text-decoration: none;
  border: none;
  background: none;
  border-radius: 6px;
  transition: background 0.15s;
}

.back-btn:hover {
  background: var(--background);
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-ghost:hover {
  background: var(--primary);
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.fade-in {
  animation: fadeInUp 0.35s ease both;
}

/* ---- Subtle background grain texture ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  pointer-events: none;
  z-index: 9999;
}
