<?php
session_start();

// Clear any existing problematic token data
if (isset($_SESSION['csrf_token']) && !is_array($_SESSION['csrf_token'])) {
    unset($_SESSION['csrf_token']);
}
require_once dirname(__DIR__) . '/../secure-config/classes/CSRFTokenManager.php';
$csrfToken = CSRFTokenManager::getToken();
?>
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
  <!-- ==================================================
       ⚡️ إعدادات أساسية
  ================================================== -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">
  <title>اتصل بنا | الأصدقاء لتركيب معدات الأمن والسلامة</title>
  
  <!-- ==================================================
       ✅ بيانات تحسين محركات البحث (SEO)
  ================================================== -->
  <meta name="description" content="الأصدقاء - شركة رائدة في أنظمة الحماية من الحرائق في الإمارات منذ 2009. خبراء في التركيب والصيانة وفحص أنظمة الإنذار والمرشات وأنظمة الإطفاء في الشارقة.">
  <meta name="keywords" content="الحماية من الحرائق الإمارات, أنظمة السلامة الشارقة, تركيب إنذار الحريق, أنظمة إطفاء الحرائق, الإضاءة الطارئة, طفايات الحريق, صيانة AMC">
  <meta name="author" content="الأصدقاء للمعدات الأمنية وأنظمة السلامة">
  <meta name="robots" content="index, follow">
  
  <!-- ==================================================
       ✅ توافق مع المتصفحات
  ================================================== -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  
  <!-- ==================================================
       📌 عنوان أساسي للموقع (Canonical)
  ================================================== -->
  <link rel="canonical" href="https://alasdqaa.com/ar/contact.php">

  <!-- ==================================================
       ⚡️ تحسين الأداء (preload - preconnect - dns-prefetch)
  ================================================== -->
  <!-- Preload للموارد المهمة -->
  <link rel="preload" href="/css/style.css" as="style">
  <link rel="preload" href="/css/rtl.css" as="style">
  <link rel="preload" href="/images/logo.png" as="image">
  <link rel="preload" href="/plugins/bootstrap/bootstrap.min.css" as="style">
  
  <!-- DNS Prefetch للموارد الخارجية -->
  <link rel="dns-prefetch" href="//cdnjs.cloudflare.com">
  <link rel="dns-prefetch" href="//fonts.googleapis.com">
  
  <!-- Preconnect لتقليل زمن الاتصال -->
  <link rel="preconnect" href="https://cdnjs.cloudflare.com">
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  
  <!-- 📌 hreflang -->
  <link rel="alternate" hreflang="en" href="https://alasdqaa.com/en/">
  <link rel="alternate" hreflang="ar" href="https://alasdqaa.com/ar/">
  <link rel="alternate" hreflang="x-default" href="https://alasdqaa.com/">

  <!-- 🌎 Local SEO -->
  <meta name="geo.region" content="AE-SH">
  <meta name="geo.placename" content="الشارقة">
  <meta name="geo.position" content="25.3463;55.4209">
  <meta name="ICBM" content="25.3463, 55.4209">
  
  <!-- ==================================================
       📱 مشاركة غنية (Open Graph & Twitter Cards)
  ================================================== -->
  <!-- Open Graph -->
  <meta property="og:title" content="الأصدقاء لتركيب معدات الأمن والسلامة">
  <meta property="og:description" content="خدمات الحماية من الحرائق المهنية في الإمارات منذ 2009. فريق خبير لتركيب وصيانة أنظمة السلامة من الحرائق.">
  <meta property="og:image" content="https://alasdqaa.com/images/og-image.jpg">
  <meta property="og:url" content="https://alasdqaa.com/ar/">
  <meta property="og:type" content="website">
  <meta property="og:site_name" content="الأصدقاء">
  
  <!-- Twitter Cards -->
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:title" content="الأصدقاء لتركيب معدات الأمن والسلامة">
  <meta name="twitter:description" content="خدمات الحماية من الحرائق الرائدة في الإمارات">
  <meta name="twitter:image" content="https://alasdqaa.com/images/twitter-image.jpg">

  <!-- ==================================================
       🌟 أيقونات الموقع
  ================================================== -->
  <link rel="icon" type="image/png" href="/images/favicon.png">
  <link rel="apple-touch-icon" href="/images/apple-touch-icon.png">
  <meta name="theme-color" content="#0a1c28"> <!-- لون شريط العنوان في الجوال -->

  <!-- ==================================================
       🎨 ملفات CSS
  ================================================== -->
  <!-- Bootstrap -->
  <link rel="stylesheet" href="/plugins/bootstrap/bootstrap.min.css">
  <!-- FontAwesome -->
  <link rel="stylesheet" href="/plugins/fontawesome/css/all.min.css">
  <!-- Animation -->
  <link rel="stylesheet" href="/plugins/animate-css/animate.css">
  <!-- Slick Carousel -->
  <link rel="stylesheet" href="/plugins/slick/slick.css">
  <link rel="stylesheet" href="/plugins/slick/slick-theme.css">
  <!-- Colorbox -->
  <link rel="stylesheet" href="/plugins/colorbox/colorbox.css">
  <!-- Template styles -->
  <link rel="stylesheet" href="/css/style.css">
  <!-- RTL styles -->
  <link rel="stylesheet" href="/css/rtl.css">
  
  <!-- Include reCAPTCHA script -->
  <script src="https://www.google.com/recaptcha/api.js" async defer></script>

  <!-- Google Fonts for Arabic -->
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap" rel="stylesheet">

<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="/css/atlas-2026.css?v=20261121" media="all">
<link rel="stylesheet" href="/css/nova-2026.css?v=20261121-2">
</head>
<body>
<div class="body-inner" id="main-content">

  <!-- Top Bar -->
  <a class="evo-skip" href="#main-content">انتقل إلى المحتوى</a>
<div class="evo-progress" aria-hidden="true"></div>
<div class="evo-top"><div class="container"><div class="evo-top__left"><span><i class="fas fa-map-marker-alt"></i> الشارقة، الإمارات العربية المتحدة</span><span><i class="fas fa-clock"></i> السبت – الخميس · 8:00 صباحًا – 5:00 مساءً</span></div><div class="evo-top__right"><span class="evo-top__indicator">حلول السلامة في جميع أنحاء الإمارات</span><a href="tel:+97165435113" dir="ltr"><i class="fas fa-phone"></i> +971 6 543 5113</a></div></div></div>
<header class="evo-header" id="site-header">
  <div class="container evo-nav">
    <a href="/ar/" class="evo-logo" aria-label="ALASDQAA"><img src="/images/logo.png" alt="ALASDQAA" width="174" height="65" decoding="async"></a>
    <nav aria-label="التنقل الرئيسي"><ul class="evo-links" id="evo-navigation">
    <li><a href="/ar/" >الرئيسية</a></li>
    <li><a href="/ar/about.html" >من نحن</a></li>
    <li class="evo-has-drop"><button class="" type="button" aria-expanded="false" aria-haspopup="true" aria-controls="evo-services-menu">الخدمات <i class="fas fa-chevron-down" aria-hidden="true"></i></button>
      <ul class="evo-drop" id="evo-services-menu"><li><a href="/ar/services.html"><i class="fas fa-layer-group"></i>جميع الخدمات</a></li><li><a href="/ar/fire-alarm.html" ><i class="fas fa-bell"></i>أنظمة إنذار الحريق</a></li><li><a href="/ar/fire-suppression.html" ><i class="fas fa-fire-extinguisher"></i>أنظمة إطفاء الحريق</a></li><li><a href="/ar/fire-sprinklers.html" ><i class="fas fa-tint"></i>أنظمة رشاشات الحريق</a></li><li><a href="/ar/fire-pump.html" ><i class="fas fa-tachometer-alt"></i>مضخات الحريق</a></li><li><a href="/ar/fire-hose-reel.html" ><i class="fas fa-water"></i>خراطيم وبكرات الحريق</a></li><li><a href="/ar/fire-extinguishers.html" ><i class="fas fa-fire-extinguisher"></i>طفايات الحريق</a></li><li><a href="/ar/emergency-light.html" ><i class="fas fa-lightbulb"></i>إضاءة الطوارئ</a></li><li><a href="/ar/voice-evacuation.html" ><i class="fas fa-bullhorn"></i>الإخلاء الصوتي</a></li><li><a href="/ar/maintenance.html" ><i class="fas fa-tools"></i>الصيانة والعقود السنوية</a></li><li><a href="/ar/inspections.html" ><i class="fas fa-clipboard-check"></i>الفحص والاختبار</a></li><li><a href="/ar/drawing.html" ><i class="fas fa-ruler-combined"></i>التصميم والاعتمادات</a></li></ul>
    </li>
    <li><a href="/ar/products.html" >المنتجات</a></li>
    <li><a href="/ar/faq.html" >الأسئلة الشائعة</a></li>
    <li><a href="/ar/contact.php" aria-current="page">تواصل معنا</a></li>
    </ul></nav>
    <div class="evo-actions"><div class="evo-lang" aria-label="Language">
    <a href="/ar/contact.php" hreflang="ar" lang="ar" class="is-active" aria-current="true">AR</a><a href="/en/contact.php" hreflang="en" lang="en" >EN</a></div>
    <button class="evo-icon-btn evo-theme-toggle" type="button" aria-pressed="false" aria-label="تغيير المظهر"><i class="fas fa-moon"></i></button>
    <a class="evo-btn" href="/ar/contact.php">اطلب عرض سعر <i class="fas fa-external-link-alt" aria-hidden="true"></i></a>
    <button class="evo-icon-btn evo-menu-toggle" type="button" aria-label="فتح قائمة التنقل" aria-expanded="false" aria-controls="evo-navigation"><i class="fas fa-bars"></i></button>
    </div>
  </div>
</header>
<div class="evo-backdrop" aria-hidden="true"></div>
<section class="evo-page-intro" aria-labelledby="evo-page-title" style="--intro-photo:url('/images/slider-main/bg5.jpg')"><div class="container evo-page-intro__inner" data-page-number="07">
 <nav class="evo-page-intro__breadcrumbs" aria-label="مسار التنقل"><a href="/ar/">الرئيسية</a><i class="fas fa-chevron-right" aria-hidden="true"></i><span aria-current="page">تواصل معنا</span></nav>
 <h1 id="evo-page-title">تواصل معنا</h1><p>تواصل مع فريقنا بشأن مشروعك أو احتياجاتك للخدمة.</p><i class="fas fa-envelope evo-page-intro__marker" aria-hidden="true"></i>
 </div></section>
<div class="nova-signal" aria-label="خدماتنا"><div class="nova-signal__track" aria-hidden="true"><div class="nova-signal__group"><span>هندسة أنظمة الحريق</span><span>تصميم وتركيب</span><span>فحص واختبار</span><span>عقود صيانة</span><span>حماية المنشآت</span><span>حلول السلامة</span></div><div class="nova-signal__group"><span>هندسة أنظمة الحريق</span><span>تصميم وتركيب</span><span>فحص واختبار</span><span>عقود صيانة</span><span>حماية المنشآت</span><span>حلول السلامة</span></div></div></div>

    <!-- END HEADER -->

  <!-- Contact Section -->
  <section id="main-container" class="main-container py-5">
    <div class="container">
      <div class="row">
        <div class="col-lg-8">
          <div class="contact-content">
            <h3 class="contact-title mb-4">نحن نحب أن نسمع منك</h3>
            <p class="mb-4">هل أنت مستعد لحماية منشأتك بحلول السلامة من الحرائق المهنية؟ فريقنا الخبير هنا لمساعدتك في جميع احتياجات الحماية من الحرائق. اتصل بنا اليوم للحصول على استشارة واكتشف كيف يمكننا تعزيز أنظمة السلامة لديك.</p>
            
            <!-- Contact Form -->
            <form id="contact-form" class="contact-form" action="send_email.php?confirm=true" method="post" role="form">
             <input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($csrfToken, ENT_QUOTES, 'UTF-8'); ?>">
              <div class="error-container"></div>
              <div class="success-message" style="display: none;">تم إرسال الرسالة بنجاح.</div>
              
              <div class="row">
                <div class="col-md-6">
                  <div class="form-group">
                    <label for="name">الاسم الكامل *</label>
                    <input class="form-control" name="name" id="name" type="text" required autocomplete="name">
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group">
                    <label for="email">البريد الإلكتروني *</label>
                    <input class="form-control" name="email" id="email" type="email" required autocomplete="email">
                  </div>
                </div>
              </div>
              
              <div class="row">
                <div class="col-md-6">
                  <div class="form-group">
                    <label for="phone">رقم الهاتف *</label>
                    <input class="form-control" name="phone" id="phone" type="tel" pattern="[0-9]{8,15}" maxlength="15" required autocomplete="tel">
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group">
                    <label for="subject">الموضوع *</label>
                    <input class="form-control" name="subject" id="subject" type="text" required autocomplete="off">
                  </div>
                </div>
              </div>
              
              <div class="form-group">
                <label for="service">الخدمة المطلوبة</label>
                <select class="form-control" name="service" id="service">
                  <option value="">اختر خدمة</option>
                  <option value="fire-alarm">أنظمة إنذار الحريق</option>
                  <option value="emergency-light">إنارة ومخارج الطوارئ</option>
                  <option value="fire-extinguishers">طفايات الحريق</option>
                  <option value="fire-sprinklers">مرشات الحريق</option>
                  <option value="fire-pump">أنظمة مضخات الحريق</option>
                  <option value="fire-hose-reel">خراطيم الحريق</option>
                  <option value="fire-suppression">أنظمة إطفاء الحرائق</option>
                  <option value="voice-evacuation">أنظمة الإخلاء الصوتي</option>
                  <option value="maintenance">عقد الصيانة السنوية</option>
                  <option value="inspections">الفحص والاختبار</option>
                  <option value="drawing">المخططات</option>
                  <option value="other">أخرى</option>
                </select>
              </div>
              
              <div class="form-group">
                <label for="message">الرسالة *</label>
                <textarea class="form-control" name="message" id="message" rows="6" required placeholder="أخبرنا عن متطلبات السلامة من الحرائق لديك..."></textarea>
              </div>
              
              <?php
               include dirname(__DIR__) . '/../secure-config/config.php';
               $site_key = ConfigManager::get('recaptcha.site_key');
               echo '<div class="g-recaptcha" data-sitekey="' . htmlspecialchars($site_key) . '"></div>';
              ?>
              
              <div class="form-submit mt-4">
                <button class="btn btn-primary btn-lg" type="submit">
                  <i class="fas fa-paper-plane ml-2"></i>إرسال الرسالة
                </button>
              </div>
            </form>
            
      <!-- Google Map -->
      <div class="row mt-5">
        <div class="col-12">
          <h3 class="section-title text-center mb-4">موقعنا</h3>
          <div class="map-container">
            <iframe 
              src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d14428.955239855242!2d55.4222764!3d25.2961794!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3e5f5f3e9ce67d23%3A0xcddc7505af1c53f5!2sALASDQAA%20SECURITY%20AND%20SAFETY%20EQUIP.%20FIX.!5e0!3m2!1sar!2sae!4v1706990527356!5m2!1sar!2sae" 
              width="100%" 
              height="400" 
              style="border:0; border-radius: 10px;" 
              allowfullscreen="" 
              loading="lazy" 
              referrerpolicy="no-referrer-when-downgrade">
            </iframe>
          </div>
        </div>
      </div>

          </div>
        </div>

        <div class="col-lg-4">
          <div class="sidebar">
            <!-- Contact Info Widget -->
            <div class="widget widget-contact-info">
              <div class="widget-title">
                <h4>معلومات الاتصال</h4>
              </div>
              <div class="contact-info-list">
                <div class="contact-item">
                  <i class="fas fa-map-marker-alt"></i>
                  <div>
                    <h5>&nbsp; زر مكتبنا</h5>
                    <p>شارع الصناعي الرابع، المنطقة الصناعية 10، الشارقة، الإمارات العربية المتحدة</p>
                  </div>
                </div>
                <div class="contact-item">
                  <i class="fas fa-phone"></i>
                  <div>
                    <h5>&nbsp; اتصل بنا</h5>
                    <p class="phone-number ltr-text">(+971) 6 543 5113</p>
                    <p class="phone-number ltr-text">(+971) 55 848 4363</p>
                  </div>
                </div>
                <div class="contact-item">
                  <i class="fas fa-envelope"></i>
                  <div>
                    <h5>&nbsp; راسلنا</h5>
                    <p>info@alasdqaa.com</p>
                  </div>
                </div>
                <div class="contact-item">
                  <i class="fas fa-clock"></i>
                  <div>
                    <h5>&nbsp; ساعات العمل</h5>
                    <p>السبت - الخميس: 8:00 ص - 5:00 م</p>
                    <p>الجمعة: مغلق</p>
                  </div>
                </div>
              </div>
            </div>

            <!-- Services Widget -->
            <div class="widget widget-services">
              <div class="widget-title">
                <h4>خدماتنا</h4>
              </div>
              <ul class="services-list">
                <li><a href="/ar/drawing.html">المخططات</a></li>                            
                <li><a href="/ar/inspections.html">الفحص والاختبار</a></li>
                <li><a href="/ar/maintenance.html">عقد الصيانة السنوية</a></li>                            
                <li><a href="/ar/fire-alarm.html">أنظمة إنذار الحريق</a></li>
                <li><a href="/ar/voice-evacuation.html">أنظمة الإخلاء الصوتي</a></li>
                <li><a href="/ar/emergency-light.html">إنارة ومخارج الطوارئ</a></li>
                <li><a href="/ar/fire-suppression.html">أنظمة إطفاء الحرائق</a></li>
                <li><a href="/ar/fire-pump.html">مضخات الحريق</a></li> 
                <li><a href="/ar/fire-hose-reel.html">خراطيم الحريق</a></li>
                <li><a href="/ar/fire-sprinklers.html">مرشات الحريق</a></li>
                <li><a href="/ar/fire-extinguishers.html">طفايات الحريق</a></li>
              </ul>
            </div>
          </div>
        </div>
      </div>

      <!-- Contact Features -->
      <div class="row mt-5">
        <div class="col-12">
          <h3 class="section-title text-center mb-5">لماذا تختار الأصدقاء؟</h3>
        </div>
        
        <div class="col-md-3 col-sm-6 mb-4">
          <div class="feature-box">
            <i class="fas fa-award fa-3x text-primary mb-3"></i>
            <h5>خبرة +15 سنة</h5>
            <p>نخدم فى الإمارات منذ 2009 بحلو وانظمة السلامة من الحرائق</p>
          </div>
        </div>
        
        <div class="col-md-3 col-sm-6 mb-4">
          <div class="feature-box">
            <i class="fas fa-certificate fa-3x text-primary mb-3"></i>
            <h5>مهندسون معتمدون</h5>
            <p>محترفون مرخصون مع شهادات الدفاع المدني</p>
          </div>
        </div>
        
        <div class="col-md-3 col-sm-6 mb-4">
          <div class="feature-box">
            <i class="fas fa-clock fa-3x text-primary mb-3"></i>
            <h5>دعم 24/7</h5>
            <p>دعم الطوارئ على مدار الساعة للحالات الحرجة</p>
          </div>
        </div>
        
        <div class="col-md-3 col-sm-6 mb-4">
          <div class="feature-box">
            <i class="fas fa-shield-alt fa-3x text-primary mb-3"></i>
            <h5>ضمان الجودة</h5>
            <p>جميع أعمالنا تلبي المعايير الدولية واللوائح المحلية</p>
          </div>
        </div>
      </div>
    </div>
  </section>

  <!-- Call to Action -->
  <section class="call-to-action-box no-padding">
    <div class="container">
      <div class="action-style-box">
        <div class="row align-items-center">
          <div class="col-md-8 text-center text-md-right">
            <h3 class="action-title">مستعد لتعزيز أنظمة السلامة من الحرائق لديك؟</h3>
            <p class="action-subtitle">اتصل بنا اليوم للحصول على استشارة وعرض سعر مجاني</p>
          </div>
          <div class="col-md-4 text-center text-md-left mt-3 mt-md-0">
            <a class="btn btn-dark btn-lg" href="tel:+971654355113">
              <i class="fas fa-phone ml-2"></i>اتصل الآن
            </a>
          </div>
        </div>
      </div>
    </div>
  </section>

  <!-- Footer -->
  <footer class="evo-footer" id="site-footer" role="contentinfo">
<div class="container evo-footer__top"><div><a class="evo-footer__logo" href="/ar/"><img src="/images/footer-logo.png" loading="lazy" alt="ALASDQAA" width="155" height="60"></a><h3>سلامة تُصمَّم لتدوم.</h3><p>تصميم وتوريد وتركيب وفحص وصيانة أنظمة الحماية من الحرائق في دولة الإمارات، بخبرة ممتدة منذ عام 2009.</p></div>
<div><h3>روابط سريعة</h3><ul><li><a href="/ar/">الرئيسية</a></li><li><a href="/ar/about.html">من نحن</a></li><li><a href="/ar/services.html">خدماتنا</a></li><li><a href="/ar/products.html">المنتجات</a></li><li><a href="/ar/faq.html">الأسئلة الشائعة</a></li><li><a href="/ar/contact.php">تواصل معنا</a></li></ul></div>
<div><h3>حلول الحماية</h3><ul><li><a href="/ar/fire-alarm.html">أنظمة إنذار الحريق</a></li><li><a href="/ar/fire-suppression.html">أنظمة إطفاء الحريق</a></li><li><a href="/ar/fire-sprinklers.html">أنظمة رشاشات الحريق</a></li><li><a href="/ar/fire-pump.html">مضخات الحريق</a></li><li><a href="/ar/maintenance.html">الصيانة والعقود السنوية</a></li><li><a href="/ar/inspections.html">الفحص والاختبار</a></li></ul></div>
<div><h3>تواصل معنا</h3><ul class="evo-footer__contact"><li><i class="fas fa-map-marker-alt"></i><span>الشارقة، الإمارات العربية المتحدة<p>الشارع الصناعي الرابع، المنطقة الصناعية 10</p></span></li><li><i class="fas fa-phone"></i><span dir="ltr"><a href="tel:+97165435113">+971 6 543 5113</a><br><a href="tel:+971558484363">+971 55 848 4363</a></span></li><li><i class="fas fa-envelope"></i><a href="mailto:info@alasdqaa.com">info@alasdqaa.com</a></li><li><i class="fas fa-clock"></i>السبت – الخميس · 8:00 صباحًا – 5:00 مساءً</li></ul></div></div>
<div class="evo-footer__bottom"><div class="container"><p>© <span data-evo-year>2026</span> ALASDQAA. جميع الحقوق محفوظة.</p><div><a href="/ar/" hreflang="ar">العربية</a><a href="/en/" hreflang="en">English</a></div></div></div>
</footer>
<div class="evo-float-actions"><a class="evo-float-call" href="tel:+97165435113" aria-label="اتصل بنا" title="اتصل بنا"><i class="fas fa-phone"></i></a><button type="button" class="evo-to-top" aria-label="العودة إلى أعلى الصفحة" title="العودة إلى أعلى الصفحة"><i class="fas fa-chevron-up"></i></button></div><!-- Footer end -->
    <!-- END FOOTER -->

  <!-- initialize jQuery Library -->
  <script src="/plugins/jQuery/jquery.min.js" defer></script>
  <!-- Bootstrap -->
  <script src="/plugins/bootstrap/bootstrap.min.js" defer></script>
  <!-- Slick Carousel -->
  <script src="/plugins/slick/slick.min.js" defer></script>
  <script src="/plugins/slick/slick-animation.min.js" defer></script>
  <!-- Color box -->
  <script src="/plugins/colorbox/jquery.colorbox.js" defer></script>
  <!-- shuffle -->
  <script src="/plugins/shuffle/shuffle.min.js" defer></script>
  <!-- Google Map Plugin-->
  <script src="/plugins/google-map/map.js" defer></script>
  <!-- Template custom -->
  <script src="/js/script.js" defer></script>
  
</div>

<script>
// Contact Form Handler
document.addEventListener('DOMContentLoaded', function() {
    const contactForm = document.getElementById('contact-form');
    const errorContainer = document.querySelector('.error-container');
    const successMessage = document.querySelector('.success-message');
    const submitButton = contactForm.querySelector('button[type="submit"]');
    const originalButtonText = submitButton.innerHTML;

    // إضافة حماية إضافية للنموذج
    contactForm.addEventListener('submit', function(e) {
        e.preventDefault();
        
        // Clear previous messages
        errorContainer.innerHTML = '';
        errorContainer.style.display = 'none';
        successMessage.style.display = 'none';
        
        // التحقق من الحقول المطلوبة
        const requiredFields = ['name', 'email', 'phone', 'subject', 'message'];
        let hasErrors = false;
        
        requiredFields.forEach(field => {
            const input = document.getElementById(field);
            if (!input.value.trim()) {
                input.style.borderColor = '#dc3545';
                hasErrors = true;
            } else {
                input.style.borderColor = '#28a745';
            }
        });
        
        // التحقق من البريد الإلكتروني
        const emailInput = document.getElementById('email');
        const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
        if (emailInput.value.trim() && !emailRegex.test(emailInput.value)) {
            emailInput.style.borderColor = '#dc3545';
            hasErrors = true;
        }
        
        // التحقق من رقم الهاتف: فقط أرقام وطول من 8 إلى 15 مثلاً
        const phoneInput = document.getElementById('phone');
        const phoneRegex = /^[0-9]{8,15}$/;
        if (phoneInput.value.trim() && !phoneRegex.test(phoneInput.value.trim())) {
            phoneInput.style.borderColor = '#dc3545';
            hasErrors = true;
        }
        
        // التحقق من reCAPTCHA
        if (typeof grecaptcha !== 'undefined') {
            const recaptchaResponse = grecaptcha.getResponse();
            if (!recaptchaResponse) {
                showError('يرجى إكمال التحقق من reCAPTCHA.');
                return;
            }
        }
        
        if (hasErrors) {
            showError('يرجى ملء جميع الحقول المطلوبة بشكل صحيح.');
            return;
        }
        
        // Show loading state
        submitButton.disabled = true;
        submitButton.innerHTML = '<i class="fas fa-spinner fa-spin ml-2"></i>جاري الإرسال...';
        
        // Prepare form data
        const formData = new FormData(contactForm);
        
        // إضافة معلومات إضافية للأمان
        formData.append('timestamp', Date.now());
        formData.append('timezone', Intl.DateTimeFormat().resolvedOptions().timeZone);
        
        // Send AJAX request
        fetch('send_email.php', {
            method: 'POST',
            body: formData,
            headers: {
                'X-Requested-With': 'XMLHttpRequest'
            }
        })
        .then(response => {
            if (!response.ok) {
                throw new Error('Network response was not ok');
            }
            return response.json();
        })
        .then(data => {
            if (data.success) {
                showSuccess(data.message);
                contactForm.reset();
                resetFormStyles();
                
                // Reset reCAPTCHA
                if (typeof grecaptcha !== 'undefined') {
                    grecaptcha.reset();
                }
                
                // Auto-hide success message after 10 seconds
                setTimeout(() => {
                    successMessage.style.display = 'none';
                }, 10000);
                
            } else {
                showError(data.message);
                
                // Reset reCAPTCHA
                if (typeof grecaptcha !== 'undefined') {
                    grecaptcha.reset();
                }
            }
        })
        .catch(error => {
            console.error('Error:', error);
            showError('حدث خطأ. يرجى المحاولة مرة أخرى لاحقاً.');
            
            // Reset reCAPTCHA
            if (typeof grecaptcha !== 'undefined') {
                grecaptcha.reset();
            }
        })
        .finally(() => {
            // Reset button state
            submitButton.disabled = false;
            submitButton.innerHTML = originalButtonText;
        });
    });
    
    // دوال مساعدة
    function showError(message) {
        errorContainer.innerHTML = '<i class="fas fa-exclamation-triangle ml-2"></i>' + message;
        errorContainer.style.display = 'block';
        errorContainer.style.color = '#721c24';
        errorContainer.style.backgroundColor = '#f8d7da';
        errorContainer.style.border = '1px solid #f5c6cb';
        errorContainer.style.borderRadius = '4px';
        errorContainer.style.padding = '10px 15px';
        errorContainer.style.marginBottom = '20px';
        
        errorContainer.scrollIntoView({ behavior: 'smooth', block: 'center' });
    }
    
    function showSuccess(message) {
        successMessage.innerHTML = '<i class="fas fa-check-circle ml-2"></i>' + message;
        successMessage.style.display = 'block';
        successMessage.style.color = '#155724';
        successMessage.style.backgroundColor = '#d4edda';
        successMessage.style.border = '1px solid #c3e6cb';
        successMessage.style.borderRadius = '4px';
        successMessage.style.padding = '10px 15px';
        successMessage.style.marginBottom = '20px';
        
        successMessage.scrollIntoView({ behavior: 'smooth', block: 'center' });
    }
    
    function resetFormStyles() {
        const inputs = contactForm.querySelectorAll('input, textarea, select');
        inputs.forEach(input => {
            input.style.borderColor = '';
        });
    }
    
    // التحقق من الحقول في الوقت الفعلي
    const inputs = contactForm.querySelectorAll('input[required], textarea[required]');
    inputs.forEach(input => {
        input.addEventListener('blur', function() {
            if (this.value.trim() === '') {
                this.style.borderColor = '#dc3545';
            } else {
                this.style.borderColor = '#28a745';
            }
        });
        
        input.addEventListener('input', function() {
            if (this.value.trim() !== '') {
                this.style.borderColor = '#28a745';
            }
        });
    });
    
    // التحقق من البريد الإلكتروني
    const emailField = document.getElementById('email');
    if (emailField) {
        emailField.addEventListener('blur', function() {
            const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
            if (this.value.trim() !== '' && !emailRegex.test(this.value)) {
                this.style.borderColor = '#dc3545';
            } else if (this.value.trim() !== '') {
                this.style.borderColor = '#28a745';
            }
        });
    }
    
    // منع إرسال النموذج عند الضغط على Enter في الحقول
    contactForm.addEventListener('keypress', function(e) {
        if (e.key === 'Enter' && e.target.tagName !== 'TEXTAREA') {
            e.preventDefault();
        }
    });
});

// حماية إضافية ضد البوتات
(function() {
    // إضافة حقل خفي للكشف عن البوتات
    const form = document.getElementById('contact-form');
    if (form) {
        const honeypot = document.createElement('input');
        honeypot.type = 'text';
        honeypot.name = 'website';
        honeypot.style.display = 'none';
        honeypot.setAttribute('tabindex', '-1');
        honeypot.setAttribute('autocomplete', 'off');
        form.appendChild(honeypot);
    }
})();

// تحديث التوكن كل 45 دقيقة
setInterval(function() {
    fetch('refresh_csrf_token.php', {
        method: 'POST',
        headers: {
            'X-Requested-With': 'XMLHttpRequest'
        }
    })
    .then(response => response.json())
    .then(data => {
        if (data.success) {
            document.querySelector('input[name="csrf_token"]').value = data.token;
        }
    });
}, 45 * 60 * 1000);

// تأكيد وجود التوكن قبل الإرسال
document.getElementById('contact-form').addEventListener('submit', function(e) {
    const token = document.querySelector('input[name="csrf_token"]').value;
    if (!token) {
        e.preventDefault();
        alert('انتهت صلاحية الرمز الأمني. يرجى تحديث الصفحة والمحاولة مرة أخرى.');
    }
});
</script>

<script src="/js/atlas-2026.js?v=20261121" defer></script>
<script src="/js/nova-2026.js?v=20261121-2" defer></script>
</body>
</html>