<?php
// Shared UI asset helper for AirMax/AirMax matching pages.
// Keeps migrated page CSS in one place and gives embed pages the same dark surface
// without rendering the full header/sidebar chrome.

if (!function_exists('airmax_ui_prepare_page')) {
  function airmax_ui_prepare_page(): void {
    $GLOBALS['UA_FORCE_DESIGN_V2'] = true;
    $GLOBALS['UA_PAGE_CSS'] = ['assets/css/pages/airmax_admin.css'];
  }
}

if (!function_exists('airmax_ui_print_embed_assets')) {
  function airmax_ui_print_embed_assets(): void {
    static $printed = false;
    if ($printed) return;
    $printed = true;
    require_once __DIR__ . '/app_assets.php';
    echo "\n" . ua_asset_tag_css('bootstrap_533_rtl_css') . "\n";
    echo ua_asset_tag_css('fontawesome_470_css') . "\n";
    foreach (['assets/css/ua_design_tokens.css', 'assets/css/ua_design_components.css', 'assets/css/pages/airmax_admin.css'] as $css) {
      if (is_file(__DIR__ . '/' . $css)) {
        echo '<link rel="stylesheet" href="' . htmlspecialchars(ua_asset_versioned_local($css), ENT_QUOTES, 'UTF-8') . '">' . "\n";
      }
    }
    echo '<script>document.documentElement.classList.add("ua-airmax-embed");</script>' . "\n";
  }
}
