#!/usr/bin/env python3
"""
Inspect the All Courses mega menu panel HTML structure from header.php
and find the logo img tag.
"""
import re

with open('/Applications/XAMPP/xamppfiles/htdocs/aaa/header.php', 'r', encoding='utf-8') as f:
    content = f.read()

# Find the All Courses mega menu panel
# It's the hidden div after the All Courses button
# Look for "All Courses" text and extract surrounding structure
idx = content.find('All Courses')
print(f"First 'All Courses' at pos: {idx}")

# Find the logo img
logo_pattern = re.compile(r'<img[^>]*(?:logo|Logo)[^>]*>', re.IGNORECASE)
logos = logo_pattern.findall(content)
print("\nLOGO IMG TAGS:")
for l in logos[:3]:
    print(l[:300])

# Find the mega panel - look for hidden div after the All Courses trigger
# The structure is a div with multiple domains listed
domains_idx = content.find('Artificial Intelligence')
print(f"\n'Artificial Intelligence' at pos: {domains_idx}")
if domains_idx > 0:
    snippet = content[max(0, domains_idx-300):domains_idx+200]
    print("CONTEXT:")
    print(snippet[:500])
    
# Find All Courses panel class
mega_panel_pattern = re.compile(r'class="[^"]*shadow-tooltip[^"]*"')
panels = mega_panel_pattern.findall(content)
print("\nPANELS WITH shadow-tooltip:")
for p in panels[:3]:
    print(p[:200])
