{
  "app_name": "BMI Calculator",
  "pages": [
    {
      "page_id": "calculator",
      "page_title": "BMI Calculator",
      "route_path": "/",
      "route_params": [],
      "image_indices": [],
      "description": "Landing page and primary BMI calculator. Contains a unit toggle (metric/imperial), height input field(s) (single field for cm in metric, two fields for feet and inches in imperial), weight input field (kg or lbs), and a 'Calculate BMI' button. After calculation, displays the BMI value prominently, BMI category with color coding (Underweight: blue, Normal: green, Overweight: orange, Obese: red), health risk description, healthy BMI range indicator, general recommendations, and a visual gauge/color bar. For anonymous users, shows a prompt to register for history tracking. For logged-in users, shows a 'Calculate and Save' button and an optional notes text field. Also displays a brief comparison to last calculation if user is logged in. Includes a 'Reset' button to clear inputs.",
      "navigates_to": [
        "login",
        "register",
        "dashboard",
        "history",
        "goals"
      ]
    },
    {
      "page_id": "login",
      "page_title": "Login",
      "route_path": "/login",
      "route_params": [],
      "image_indices": [],
      "description": "Login page with email and password fields, a 'Login' submit button, a 'Remember Me' checkbox, and a 'Forgot Password' link that opens a modal with an email field to request a password reset token. Also includes a link to the registration page. Displays inline validation errors for invalid credentials and rate limiting messages after 5 failed attempts.",
      "navigates_to": [
        "calculator",
        "register",
        "dashboard"
      ]
    },
    {
      "page_id": "register",
      "page_title": "Register",
      "route_path": "/register",
      "route_params": [],
      "image_indices": [],
      "description": "Registration page with form fields: email, password, confirm password, first name, last name, date of birth (date picker), and gender (dropdown). Real-time validation for email format, password strength (min 8 chars, uppercase, lowercase, number), password match, and age requirement (13+). Submit button creates account. Link to login page for existing users.",
      "navigates_to": [
        "login",
        "dashboard"
      ]
    },
    {
      "page_id": "dashboard",
      "page_title": "Dashboard",
      "route_path": "/dashboard",
      "route_params": [],
      "image_indices": [],
      "description": "User dashboard showing summary stat cards: current BMI value and category, last calculation date, total number of calculations, and current goal progress (percentage and days remaining). Includes a mini BMI trend line chart showing recent calculations, a quick-calculate section linking to the calculator, and active goals with progress bars. Navigation sidebar/header links to Calculator, History, Goals, and Profile pages.",
      "navigates_to": [
        "calculator",
        "history",
        "goals",
        "profile"
      ]
    },
    {
      "page_id": "history",
      "page_title": "Calculation History",
      "route_path": "/history",
      "route_params": [],
      "image_indices": [],
      "description": "Paginated table of past BMI calculations with columns: Date, Height, Weight, BMI Value, Category (color-coded badge), Notes. Sortable by date and BMI value. Filter controls include date range picker and search. 10-20 records per page with pagination controls. Each row has action buttons: edit notes (opens inline edit or modal with notes text field), delete (shows confirmation modal with soft-delete). Above the table, a line chart visualization showing BMI over time with category zone bands highlighted, and a toggle to switch between BMI trend and weight trend views. Export button triggers a dropdown with CSV and PDF options.",
      "navigates_to": [
        "calculator",
        "dashboard",
        "goals",
        "profile"
      ]
    },
    {
      "page_id": "goals",
      "page_title": "Goals",
      "route_path": "/goals",
      "route_params": [],
      "image_indices": [],
      "description": "Goals management page displaying all user goals in card format showing: goal type (BMI or weight), target value, current value, progress percentage bar, days remaining, required weekly change, and status badge (active/achieved/abandoned). Overdue goals are highlighted with warning color. 'Set New Goal' button opens a modal form with fields: goal type dropdown (BMI/weight), target value input, target date picker. Validates target within healthy ranges, shows warning if weight loss exceeds 1kg/week, enforces max 3 active goals. Each goal card has Edit (opens modal to update target value/date) and Abandon buttons. Achieved goals show congratulatory message and 'Set New Goal' suggestion.",
      "navigates_to": [
        "calculator",
        "dashboard",
        "history",
        "profile"
      ]
    },
    {
      "page_id": "profile",
      "page_title": "Profile",
      "route_path": "/profile",
      "route_params": [],
      "image_indices": [],
      "description": "User profile page with editable form fields: first name, last name, date of birth, gender, preferred unit system (metric/imperial toggle), default height, and target BMI/weight. Displays computed age from date of birth. Shows profile summary: current BMI, last calculation date, total calculations count, current goal status. Save button with success/error notifications. Also includes account actions: change password (modal with current password, new password, confirm new password fields) and request account deletion.",
      "navigates_to": [
        "calculator",
        "dashboard",
        "history",
        "goals"
      ]
    },
    {
      "page_id": "admin_dashboard",
      "page_title": "Admin Dashboard",
      "route_path": "/admin",
      "route_params": [],
      "image_indices": [],
      "description": "Administrator analytics dashboard showing stat cards: total users, total calculations, calculations today/this week/this month. Charts include: calculations per day/week/month bar chart, BMI category distribution pie chart, average BMI by age group and gender grouped bar chart, user registration trend line chart. Navigation to User Management, BMI Categories, and Audit Logs sections.",
      "navigates_to": [
        "admin_users",
        "admin_categories",
        "admin_audit_logs"
      ]
    },
    {
      "page_id": "admin_users",
      "page_title": "User Management",
      "route_path": "/admin/users",
      "route_params": [],
      "image_indices": [],
      "description": "Admin user management page with paginated table of all registered users. Columns: Email, Name, Registration Date, Last Login, Status (active/inactive badge). Search bar for email/name, filter dropdown for status. Clicking a user row opens a drawer/modal showing user details (profile info, calculation history summary, activity log). Action buttons per user: Disable/Enable toggle, Delete (with confirmation modal). All actions are logged to audit trail.",
      "navigates_to": [
        "admin_dashboard",
        "admin_categories",
        "admin_audit_logs"
      ]
    },
    {
      "page_id": "admin_categories",
      "page_title": "BMI Categories",
      "route_path": "/admin/categories",
      "route_params": [],
      "image_indices": [],
      "description": "Admin BMI category management page displaying a table of BMI categories with columns: Category Name, Min BMI, Max BMI, Color Code (color swatch), Health Risk, Description. Each row has an Edit button that opens a modal form to update category thresholds (min/max BMI), description, recommendations, and color code. Validation ensures ranges don't overlap. Confirmation modal required before saving changes. Add Category button opens similar creation modal.",
      "navigates_to": [
        "admin_dashboard",
        "admin_users",
        "admin_audit_logs"
      ]
    },
    {
      "page_id": "admin_audit_logs",
      "page_title": "Audit Logs",
      "route_path": "/admin/audit-logs",
      "route_params": [],
      "image_indices": [],
      "description": "Admin audit log viewer with paginated table showing columns: Timestamp, User (email or 'System'), Action, Entity Type, Entity ID, Details (truncated with expand). Filter controls: date range picker, user search, action type dropdown. Sortable by timestamp. Export button for downloading filtered logs as CSV. Displays retention notice (minimum 90 days).",
      "navigates_to": [
        "admin_dashboard",
        "admin_users",
        "admin_categories"
      ]
    }
  ],
  "shared_state": [
    {
      "key": "currentUser",
      "type": "{ userId: string; email: string; firstName: string; lastName: string; role: 'user' | 'admin' } | null",
      "initial_value": "null",
      "description": "Currently authenticated user information, used across all pages for auth checks, personalization, and role-based access control"
    },
    {
      "key": "authToken",
      "type": "string | null",
      "initial_value": "null",
      "description": "JWT authentication token used for API requests across all pages"
    },
    {
      "key": "preferredUnit",
      "type": "'metric' | 'imperial'",
      "initial_value": "\"metric\"",
      "description": "User's preferred unit system, used in calculator and history pages for consistent display"
    },
    {
      "key": "userProfile",
      "type": "{ profileId: string; heightCm: number | null; currentWeightKg: number | null; targetBMI: number | null } | null",
      "initial_value": "null",
      "description": "User profile data used to pre-fill calculator inputs and display on dashboard/profile pages"
    }
  ],
  "default_route": "calculator",
  "design_system": {
    "theme_mode": "light",
    "density": "comfortable",
    "color_primary": "#1677ff",
    "color_success": "#52c41a",
    "color_warning": "#faad14",
    "color_error": "#ff4d4f",
    "color_bg_container": "#ffffff",
    "color_bg_layout": "#f5f5f5",
    "color_text": "#000000e0",
    "color_border": "#d9d9d9",
    "font_family": "Inter, -apple-system, sans-serif",
    "font_size_base": 14,
    "border_radius": 6,
    "component_overrides": {}
  }
}
