<?php
// Debug CSS loading on event manage page

// Simulate being on the event manage page
$_SERVER['REQUEST_URI'] = '/trainer/event/manage/';

// Load WordPress
define('WP_USE_THEMES', false);
require_once('../../../wp-load.php');

// Set up the query for the event manage page
$page = get_page_by_path('trainer/event/manage');
if ($page) {
    $GLOBALS['wp_query'] = new WP_Query([
        'page_id' => $page->ID
    ]);
    $GLOBALS['post'] = $page;
    setup_postdata($page);
}

// Initialize scripts and styles
do_action('wp_enqueue_scripts');

// Check what CSS files are enqueued
global $wp_styles;
echo "=== HVAC CSS Files Enqueued ===\n";
foreach ($wp_styles->queue as $handle) {
    if (strpos($handle, 'hvac') !== false) {
        $style = $wp_styles->registered[$handle];
        echo "$handle:\n";
        echo "  Source: " . $style->src . "\n";
        echo "  Dependencies: " . implode(', ', $style->deps) . "\n";
        echo "\n";
    }
}

// Check is_event_manage_page
if (class_exists('HVAC_Scripts_Styles')) {
    $scripts = HVAC_Scripts_Styles::instance();
    $reflection = new ReflectionClass($scripts);
    $method = $reflection->getMethod('is_event_manage_page');
    $method->setAccessible(true);
    
    echo "\n=== Page Detection ===\n";
    echo "is_event_manage_page(): " . ($method->invoke($scripts) ? 'true' : 'false') . "\n";
    echo "Current page ID: " . ($page ? $page->ID : 'none') . "\n";
    echo "Page template: " . get_page_template_slug($page->ID) . "\n";
}