import os
from pathlib import Path

print("=" * 60)
print("VÉRIFICATION DES FICHIERS - ANIMATIONS ET SECTIONS")
print("=" * 60)
print()

# Fichiers à vérifier
files_to_check = [
    ("static/css/animations.css", "Fichier CSS des animations Elementor"),
    ("static/js/animations.js", "Script JavaScript des animations au scroll"),
    ("static/videos/hero-video.mp4", "Vidéo de fond du hero (260 MB)"),
    ("templates/pages/home.html", "Nouvelle page d'accueil avec animations"),
    ("templates/pages/home_old.html", "Ancienne page d'accueil (backup)"),
    ("templates/base.html", "Template de base (modifié)"),
    ("ANIMATIONS_ET_SECTIONS.md", "Documentation des modifications"),
]

print("📁 Vérification des fichiers :")
print()

all_ok = True
total_size = 0

for file_path, description in files_to_check:
    full_path = Path(file_path)
    
    if full_path.exists():
        size = full_path.stat().st_size
        total_size += size
        
        # Formatage de la taille
        if size > 1024 * 1024:  # > 1 MB
            size_str = f"{size / (1024*1024):.2f} MB"
        elif size > 1024:  # > 1 KB
            size_str = f"{size / 1024:.2f} KB"
        else:
            size_str = f"{size} bytes"
        
        print(f"✅ {description}")
        print(f"   📄 {file_path} ({size_str})")
    else:
        print(f"❌ {description}")
        print(f"   📄 {file_path} - FICHIER MANQUANT")
        all_ok = False
    
    print()

print("=" * 60)
if all_ok:
    print(f"✅ Tous les fichiers sont présents !")
    print(f"📊 Taille totale : {total_size / (1024*1024):.2f} MB")
else:
    print("❌ Certains fichiers sont manquants")
print("=" * 60)
print()

# Vérification des animations dans le fichier CSS
print("🎨 Vérification des animations CSS :")
print()

animations_css = Path("static/css/animations.css")
if animations_css.exists():
    content = animations_css.read_text(encoding='utf-8')
    
    animations = [
        "@keyframes fadeIn",
        "@keyframes fadeInDown",
        "@keyframes fadeInUp",
        "@keyframes fadeInLeft",
        "@keyframes fadeInRight",
        ".animate-on-scroll",
        ".btn-shrink",
        ".hero-video-section",
        ".about-section",
        ".zone-section",
        ".news-section",
    ]
    
    for animation in animations:
        if animation in content:
            print(f"✅ {animation}")
        else:
            print(f"❌ {animation} - MANQUANT")
    
    print()

# Vérification des fonctions JavaScript
print("⚙️ Vérification des fonctions JavaScript :")
print()

animations_js = Path("static/js/animations.js")
if animations_js.exists():
    content = animations_js.read_text(encoding='utf-8')
    
    functions = [
        "IntersectionObserver",
        "animateCounter",
        "smooth scroll",
        "navbar",
    ]
    
    for func in functions:
        if func.lower() in content.lower():
            print(f"✅ {func}")
        else:
            print(f"❌ {func} - MANQUANT")
    
    print()

# Vérification du template home.html
print("📄 Vérification du template home.html :")
print()

home_html = Path("templates/pages/home.html")
if home_html.exists():
    content = home_html.read_text(encoding='utf-8')
    
    sections = [
        "hero-video-section",
        "services-icons-section",
        "about-section",
        "zone-section",
        "news-section",
        "animate-on-scroll",
        "fadeInDown",
        "fadeInUp",
        "fadeInLeft",
        "fadeInRight",
        "btn-shrink",
    ]
    
    for section in sections:
        if section in content:
            print(f"✅ {section}")
        else:
            print(f"❌ {section} - MANQUANT")
    
    print()

print("=" * 60)
print("🎉 Vérification terminée !")
print("=" * 60)
print()
print("Pour tester :")
print("1. python manage.py runserver")
print("2. Ouvrir http://127.0.0.1:8000/")
print("3. Scroller la page pour voir les animations")
print()
