<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>تجربة Animate.css</title>

  <!-- تحميل مكتبة Animate.css الحديثة -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />

  <style>
    body {
      font-family: 'Arial', sans-serif;
      background-color: #f0f0f0;
      text-align: center;
      padding-top: 100px;
    }

    .box {
      background-color: #ffffff;
      padding: 30px;
      margin: auto;
      width: 300px;
      border-radius: 15px;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    .animate__animated {
      --animate-duration: 2s;
    }

    button {
      padding: 10px 20px;
      background-color: #0066ff;
      color: white;
      border: none;
      border-radius: 8px;
      cursor: pointer;
      font-size: 16px;
      margin-top: 20px;
    }
  </style>
</head>
<body>

  <div class="box animate__animated animate__fadeInDown">
    <h2 class="animate__animated animate__pulse animate__infinite">مرحباً بك 👋</h2>
    <p>هذا مثال باستخدام مكتبة Animate.css.</p>
    <button onclick="animateMe()">حرّكني</button>
  </div>

  <script>
    function animateMe() {
      const box = document.querySelector('.box');
      box.classList.remove('animate__fadeInDown');
      box.classList.add('animate__tada');

      // إزالة التأثير بعد الانتهاء حتى يمكن تكراره
      box.addEventListener('animationend', () => {
        box.classList.remove('animate__tada');
      }, { once: true });
    }
  </script>

</body>
</html>
