/* ─── BTG Design System — tokens ─────────────────────────────
   Universal tokens, shared across all BTG mini apps.
   Per-app only overrides --btg-primary / --btg-primary-hover
   in :root (see top of style.css / admin.css).
   ──────────────────────────────────────────────────────────── */
:root {
  /* Brand (invite bot = mid-purple — см. стайл-гайд, разд. 8) */
  --btg-primary: #8B5CF6;
  --btg-primary-hover: #7C4DF0;
  --btg-primary-soft: rgba(139, 92, 246, 0.16);
  --btg-primary-ghost: rgba(139, 92, 246, 0.08);

  /* Semantic */
  --btg-success: #10B981;
  --btg-warning: #F59E0B;
  --btg-danger: #EF4444;
  --btg-info: #3B82F6;

  /* Icon accents */
  --btg-accent-blue: #3B82F6;
  --btg-accent-red: #EF4444;
  --btg-accent-orange: #F59E0B;
  --btg-accent-green: #10B981;
  --btg-accent-purple: #A855F7;

  /* Radii */
  --btg-r-xs: 8px;
  --btg-r-sm: 12px;
  --btg-r-md: 16px;
  --btg-r-lg: 20px;
  --btg-r-xl: 28px;
  --btg-r-pill: 999px;

  /* Spacing (4px scale) */
  --btg-s-1: 4px;
  --btg-s-2: 8px;
  --btg-s-3: 12px;
  --btg-s-4: 16px;
  --btg-s-5: 20px;
  --btg-s-6: 24px;
  --btg-s-8: 32px;
  --btg-s-10: 40px;

  /* Type */
  --btg-font-ui: 'Manrope', system-ui, -apple-system, Segoe UI, sans-serif;
  --btg-font-brand: 'Akshar', 'Manrope', sans-serif;
  --btg-font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --btg-fs-display: 32px;
  --btg-fs-h1: 28px;
  --btg-fs-h2: 22px;
  --btg-fs-h3: 17px;
  --btg-fs-body: 15px;
  --btg-fs-small: 13px;
  --btg-fs-caption: 11px;

  --btg-fw-regular: 400;
  --btg-fw-medium: 500;
  --btg-fw-semibold: 600;
  --btg-fw-bold: 700;
  --btg-fw-black: 800;

  /* Motion */
  --btg-dur-fast: 120ms;
  --btg-dur-base: 200ms;
  --btg-dur-slow: 320ms;
  --btg-ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadows */
  --btg-shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.04);
  --btg-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --btg-shadow-lg: 0 16px 40px rgba(0,0,0,0.18);
  --btg-shadow-glow: 0 0 0 4px var(--btg-primary-soft);

  /* Layout */
  --btg-screen-pad: 16px;
  --btg-maxw: 430px;
  --btg-tabbar-h: 76px;
  --btg-header-h: 48px;

  /* Safe-area (iOS notch / Android gesture bar / Telegram header) */
  --btg-safe-top: env(safe-area-inset-top, 0px);
  --btg-safe-bottom: env(safe-area-inset-bottom, 0px);
  --btg-safe-left: env(safe-area-inset-left, 0px);
  --btg-safe-right: env(safe-area-inset-right, 0px);
  --btg-tg-top: 0px;
  --btg-header-top-gap: calc(var(--btg-safe-top) + var(--btg-tg-top));
  --btg-tabbar-bottom-gap: calc(var(--btg-safe-bottom) + 16px);
}

/* ─── DARK theme (default for Telegram mini apps) ──────────── */
[data-theme="dark"] {
  --btg-bg: #0B0B14;
  --btg-bg-soft: #111120;
  --btg-surface: #1A1A2E;
  --btg-surface-2: #222238;
  --btg-surface-hover: #2A2A42;
  --btg-border: rgba(255, 255, 255, 0.08);
  --btg-border-strong: rgba(255, 255, 255, 0.14);
  --btg-text: #F5F5F7;
  --btg-text-muted: rgba(245, 245, 247, 0.62);
  --btg-text-dim: rgba(245, 245, 247, 0.38);
  --btg-overlay: rgba(0, 0, 0, 0.6);
  --btg-chip-bg: rgba(255, 255, 255, 0.06);
  --btg-tabbar-bg: rgba(22, 22, 38, 0.55);
  --btg-tabbar-hl: rgba(255, 255, 255, 0.10);
  --btg-tabbar-edge: rgba(255, 255, 255, 0.14);
}

/* ─── LIGHT theme ──────────────────────────────────────────── */
[data-theme="light"] {
  --btg-bg: #F5F5F7;
  --btg-bg-soft: #FFFFFF;
  --btg-surface: #FFFFFF;
  --btg-surface-2: #F0F0F3;
  --btg-surface-hover: #E8E8EF;
  --btg-border: rgba(0, 0, 0, 0.08);
  --btg-border-strong: rgba(0, 0, 0, 0.14);
  --btg-text: #0B0B14;
  --btg-text-muted: rgba(11, 11, 20, 0.62);
  --btg-text-dim: rgba(11, 11, 20, 0.42);
  --btg-overlay: rgba(11, 11, 20, 0.4);
  --btg-chip-bg: rgba(11, 11, 20, 0.05);
  --btg-tabbar-bg: rgba(255, 255, 255, 0.55);
  --btg-tabbar-hl: rgba(255, 255, 255, 0.85);
  --btg-tabbar-edge: rgba(255, 255, 255, 0.9);
}
