
<?php include "header.php"; ?>

        <!-- ***** Welcome Area Start ***** -->
        <section id="home" class="section welcome-area bg-overlay overflow-hidden d-flex align-items-center">
                
            <div class="container">
                <div class="row align-items-center">
                    <!-- Welcome Intro Start -->
                    <div class="col-12 col-md-7">
                    <?php
    $rr=mysqli_query($con,"SELECT * FROM static");
$r = mysqli_fetch_row($rr);
$stitle = $r[1];
$stext=$r[2];
$file=$r[3];

?>

                        <div class="welcome-intro">
                            <h1 style="color: #DEBD6B;font-size:20px;font-family: 'Fira Code', monospace;font-weight: 800;text-align: right;" ><?php print $stitle ?></h1>
                        <p style="color: white;text-align: right;" class="my-4"><?php print $stext ?></p>

                            <!-- Buttons -->
                            
                        </div>
                    </div>
                    <div class="col-12 col-md-5">
                        <!-- Welcome Thumb -->
                        <div class="welcome-thumb-wrapper mt-5 mt-md-0">
                            <span class="welcome-thumb-1">
                                <img class="welcome-animation d-block ml-auto" src='dashboard/uploads/<?php print $file  ?>' alt="">
                            </span>

                        </div>
                    </div>
                </div>
            </div>
            <!-- Shape Bottom -->
            <div class="shape shape-bottom">
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none" fill="#FFFFFF">
                    <path class="shape-fill" d="M421.9,6.5c22.6-2.5,51.5,0.4,75.5,5.3c23.6,4.9,70.9,23.5,100.5,35.7c75.8,32.2,133.7,44.5,192.6,49.7
        c23.6,2.1,48.7,3.5,103.4-2.5c54.7-6,106.2-25.6,106.2-25.6V0H0v30.3c0,0,72,32.6,158.4,30.5c39.2-0.7,92.8-6.7,134-22.4
        c21.2-8.1,52.2-18.2,79.7-24.2C399.3,7.9,411.6,7.5,421.9,6.5z"></path>
                </svg>
            </div>
        </section>
        <!-- ***** Welcome Area End ***** -->



        
        <!-- ***** Promo Area Start ***** -->
         <!-- Main Section with Image and Buttons -->
             <?php
				   $q="SELECT ufile2 FROM  static WHERE id=1";


 $r123 = mysqli_query($con,$q);

while($ro = mysqli_fetch_array($r123))
{

	
    $file2="$ro[ufile2]";

print "
<div class='container text-center my-5' dir='rtl'>
    <div class='row justify-content-center align-items-center'>
        <div class='col-12 col-md-8 mb-4'>
            <img src='dashboard/uploads/$file2' alt='' class='img-fluid'>
        </div>
        <div class='col-12'>
            <a href='https://q-kankor.naimaria.af/' class='btn btn-warning px-4 py-2 fw-bold mx-2 shadow-sm'>
                امتحانات آنلاین کانکور
            </a>
            
            <a href='timetable.php' class='btn btn-outline-dark px-4 py-2 fw-bold mx-2 shadow-sm'>
                تقسیم اوقات
            </a>
        </div>
    </div>
</div>

";
}
?>
<!-- Why Us Section -->
<section class="promo-area py-5 bg-light" dir="rtl">
    <div class="container">
        <div class="row justify-content-center mb-4">
            <div class="col-12 text-center">
                <h2 class="fw-bold mb-3" style="color:#414465;">چرا ما را انتخاب کنید؟</h2>
                <p class="text-muted" style="color:#414465;">دلایلی که ما را از دیگران متمایز می‌سازد</p>
            </div>
        </div>
        <div class="row">
            <?php
                $q = "SELECT * FROM why_us ORDER BY id DESC LIMIT 3";
                $r123 = mysqli_query($con, $q);

                while ($ro = mysqli_fetch_array($r123)) {
                    $title = $ro['title'];
                    $detail = $ro['detail'];

                    echo "
                    <div class='col-12 col-md-6 col-lg-4 mb-4'>
                        <div class='card h-100 border-0 shadow-sm text-center p-4'>
                            <div class='card-body'>
                                <h5 class='card-title fw-bold mb-3' style='color:#414465;'>$title</h5>
                                <p class='card-text text-muted'>$detail</p>
                            </div>
                        </div>
                    </div>";
                }
            ?>
        </div>
    </div>
</section>


<section id="review" class="section review-area bg-overlay ptb_100">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-12 col-md-10 col-lg-7">
                        <!-- Section Heading -->


                        <div class="section-heading text-center" >
                            <h2 class="" style='color:#DEBD6B;'><?php print $test_title; ?></h2>
                            <p class="d-none d-sm-block mt-4" style='color:#DEBD6B;'><?php print $test_text;?></p>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <!-- Client Reviews -->
                    <div class="client-reviews owl-carousel">
                        <!-- Single Review -->



                        <?php
				   $q="SELECT * FROM  testimony ORDER BY id DESC LIMIT 6";


 $r123 = mysqli_query($con,$q);

while($ro = mysqli_fetch_array($r123))
{

	$name="$ro[name]";
	$position="$ro[position]";
    $message="$ro[message]";
    $ufile="$ro[ufile]";

print "

<div class='single-review p-5'>
<!-- Review Content -->
<div class='review-content'>
    <!-- Review Text -->
    <div class='review-text'>
        <p style='text-align: right;'>$message</p>
    </div>
    <!-- Quotation Icon -->

</div>
<!-- Reviewer -->
<div class='reviewer media mt-3'>
    <!-- Reviewer Thumb -->
    <div class='reviewer-thumb'>
        <img class='avatar-lg radius-100' src='dashboard/uploads/testimony/$ufile' alt='img'>
    </div>
    <!-- Reviewer Media -->
    <div class='reviewer-meta media-body align-self-center ml-4'>
        <h5 class='reviewer-name color-primary mb-2'>$name</h5>
        <h6 class='text-secondary fw-6'>$position</h6>
    </div>
</div>
</div>


";
}
?>
                    </div>
                </div>
            </div>
        </section>

        <!-- ***** Promo Area End ***** -->

        <!-- ***** Content Area Start ***** -->

        <!-- ***** Content Area End ***** -->

        <!-- ***** Content Area Start ***** -->

        <!-- ***** Content Area End ***** -->

        <!-- ***** Service Area End ***** -->
        <section id="service" class="section service-area bg-grey ptb_150">
            <!-- Shape Top -->
            <div class="shape shape-top">
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none" fill="#FFFFFF">
                    <path class="shape-fill" d="M421.9,6.5c22.6-2.5,51.5,0.4,75.5,5.3c23.6,4.9,70.9,23.5,100.5,35.7c75.8,32.2,133.7,44.5,192.6,49.7
                c23.6,2.1,48.7,3.5,103.4-2.5c54.7-6,106.2-25.6,106.2-25.6V0H0v30.3c0,0,72,32.6,158.4,30.5c39.2-0.7,92.8-6.7,134-22.4
                c21.2-8.1,52.2-18.2,79.7-24.2C399.3,7.9,411.6,7.5,421.9,6.5z"></path>
                </svg>
            </div>
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-12 col-md-10 col-lg-7">
                        <!-- Section Heading -->
                        <div class="section-heading text-center">
                            <h2 style='color: #414465;'><?php print $service_title?></h2>
                            <p class="d-none d-sm-block mt-4"><?php print $service_text?></p>
                        </div>
                    </div>
                </div>
                <div class="row">

                <?php
				   $qs="SELECT * FROM  service ORDER BY id DESC LIMIT 6";


 $r1 = mysqli_query($con,$qs);

while($rod = mysqli_fetch_array($r1))
{
	$id="$rod[id]";
	$serviceg="$rod[service_title]";
	$service_desc="$rod[service_desc]";
    $ufile="$rod[ufile]";

print "
<div class='text-center col-12 col-md-6 col-lg-4' >
<!-- Single Service -->
<div class='single-service p-4'  style='border: solid 3px #DEBD6B;'>

    <h3 class=' my-3' style='color:#414465;'>$serviceg</h3>
    <img src='dashboard/uploads/services/$ufile' alt=''>
    <p style='color:#414465;'>$service_desc</p>
    <a class='service-btn mt-3' href='servicedetail.php?id=$id'>مشاهده بیشتر</a>
</div>
</div>

";
}
?>
                   </div>
            </div>
            <!-- Shape Bottom -->
            <div class="shape shape-bottom">
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none" fill="#FFFFFF">
                    <path class="shape-fill" d="M421.9,6.5c22.6-2.5,51.5,0.4,75.5,5.3c23.6,4.9,70.9,23.5,100.5,35.7c75.8,32.2,133.7,44.5,192.6,49.7
        c23.6,2.1,48.7,3.5,103.4-2.5c54.7-6,106.2-25.6,106.2-25.6V0H0v30.3c0,0,72,32.6,158.4,30.5c39.2-0.7,92.8-6.7,134-22.4
        c21.2-8.1,52.2-18.2,79.7-24.2C399.3,7.9,411.6,7.5,421.9,6.5z"></path>
                </svg>
            </div>
        </section>
        <!-- ***** Service Area End ***** -->

        <!-- ***** Portfolio Area Start ***** -->
        <section id="portfolio" class="portfolio-area overflow-hidden ptb_100">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-12 col-md-10 col-lg-7">
                        <!-- Section Heading -->
                        <div class="section-heading text-center">
                            <h2 style='color:#414465;'><?php print $port_title?></h2>
                            <p class="d-none d-sm-block mt-4"><?php print $port_text?></p>
                        </div>
                    </div>
                </div>
 <!-- Portfolio Items -->
                <div class="row items portfolio-items">

              <?php
function getLanguageDirectionURL($text, $id) {
    // If Persian/Arabic script is detected, go to Farsi version
    if (preg_match('/[\x{0600}-\x{06FF}]/u', $text)) {
        return "portdetail.php?id=$id";
    }
    return "portdetail.php?id=$id";
}

$q = "SELECT * FROM portfolio ORDER BY id DESC LIMIT 6";
$r123 = mysqli_query($con, $q);

while ($ro = mysqli_fetch_array($r123)) {
    $id = $ro["id"];
    $port_title = $ro["port_title"];
    $port_desc = $ro["port_desc"];
    $ufile = $ro["ufile"];

    $url = getLanguageDirectionURL($port_title, $id);

    echo "
    <div class='col-12 col-sm-6 col-lg-4 portfolio-item mb-4'>
        <div class='card shadow-sm border-0 h-100'>
            <div class='position-relative'>
                <a href='$url'>
                    <img src='dashboard/uploads/portfolio/$ufile' class='card-img-top img-fluid rounded-top' alt=''>
                </a>

                <a href='$url' class='case-studies-overlay d-flex align-items-center justify-content-center text-center'>
                    <div class='overlay-text p-3'>
                        <h5 class='text-white fw-bold mb-2'>$port_title</h5>
                        <p class='text-white small'>$port_desc</p>
                    </div>
                </a>
            </div>

            <div class='card-body text-center'>
                <h5 class='card-title mb-2'>$port_title</h5>
                <p class='card-text text-muted small'>$port_desc</p>

            </div>
        </div>
    </div>
    ";
}
?>



                </div>
                <div class="row justify-content-center">
                    <a href="portfolio" class="btn btn-bordered mt-4">مشاهده بیشتر</a>
                </div>
            </div>
        </section>

<?php
include "search_db.php";
				   $q_new="SELECT * FROM  new_news_package";


 $rnew = mysqli_query($con,$q_new);

while($ro = mysqli_fetch_array($rnew))
{

	$id="$ro[n_n_p_id]";
    $main_title="$ro[main_title]";
    $sub_main_title="$ro[sub_main_title]";
	$news_title="$ro[title]";
    $spantext="$ro[span_text]";
    $destitle="$ro[des_title]";
    $ufile="$ro[ufile]";


print "   
<section class='courses-news py-5 bg-white' dir='rtl'>
  <div class='container'>
    <div class='row mb-4 text-center'>
      <div class='col-12'>
        <h2 class='fw-bold' style='color:#414465;'>$main_title</h2>
        <p class='text-muted' style='color:#414465;'>$sub_main_title</p>
      </div>
    </div>

    <div class='row gx-4 gy-5'>

      <!-- News Card 1 -->
      <div class='col-12 col-md-6 col-lg-3'>
        <div class='card border-0 shadow-sm h-100 course-card text-center p-3'>
          <a href='portdetail.php?id=$id'>
        <img src='dashboard/uploads/$ufile' alt=''  style='width:200px;'>
    </a>
          <h5 class='fw-bold mb-2' style='color:#414465;'>$news_title</h5>
          <span class='badge bg-primary mb-3' style='color:#DEBD6B;'>$spantext</span>
          <p class='text-muted small mb-3'style='color:#414465;'>
            $destitle
          </p>
        
        </div>
      </div>
";
}
?>

      

    </div>
  </div>
</section>

<style>
  .course-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }
  .course-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
  }

  /* RTL fix for margin */
  [dir="rtl"] .mx-auto {
    margin-right: auto !important;
    margin-left: auto !important;
  }

  /* Badge styling overrides for better contrast */
  .badge.bg-warning {
    background-color: #ffc107 !important;
    color: #212529 !important;
  }

  /* Responsive adjustments */
  @media (max-width: 767.98px) {
    .course-card {
      padding: 2rem 1.5rem !important;
    }
  }
</style>



<section class="news-area py-5 bg-white" dir="rtl">
    <div class="container">
        <div class="row justify-content-center mb-4">
            <div class="col-12 text-center">
                <h2 class="fw-bold mb-3" style="color:#414465;">مقالات</h2>
            </div>
        </div>
        <div class="row">
            <?php
            include "search_db.php";
            $q_new = "SELECT * FROM paragraph ORDER BY p_id DESC";
            $rnew = mysqli_query($con, $q_new);
            while($ro = mysqli_fetch_array($rnew)) {
                $id = $ro['p_id'];
                $p_title = $ro['p_title'];
                $p_details = nl2br($ro['p_details']);
                $ufile = $ro['ufile'];
                $short_text = mb_substr(strip_tags($ro['p_details']), 0, 120, 'UTF-8');

                echo "
                <div class='col-12 col-md-6 col-lg-4 mb-4'>
                    <div class='card h-100 border-0 shadow-sm'>
                        <img src='dashboard/uploads/$ufile' class='card-img-top' style='height:200px; object-fit:cover;'>
                        <div class='card-body text-center'>
                            <h5 class='card-title fw-bold mb-2' style='color:#414465;'>$p_title</h5>
                            <p class='card-text text-muted preview-text' id='preview-$id'>$short_text...</p>
                            <div class='card-text text-muted full-text' id='full-$id' style='display: none; font-size: 0.9rem;'>$p_details</div>
                            <button class='btn btn-outline-primary btn-sm mt-2' onclick='toggleReadMore($id, this)'>ادامه مطلب</button>
                        </div>
                    </div>
                </div>
                ";
            }
            ?>
        </div>
    </div>
</section>

<style>
    .full-text {
    display: none;
    transition: max-height 0.5s ease;
}
.full-text.show {
    display: block;
}

</style>
<script>
function toggleReadMore(id, button) {
    const preview = document.getElementById('preview-' + id);
    const full = document.getElementById('full-' + id);

    if (full.style.display === 'none') {
        preview.style.display = 'none';
        full.style.display = 'block';
        button.textContent = 'بستن مطلب';
    } else {
        full.style.display = 'none';
        preview.style.display = 'block';
        button.textContent = 'ادامه مطلب';
    }
}
</script>





<section class="education-news py-5 bg-light" dir="rtl">
  <div class="container">
    <div class="row mb-5 text-center">
      <div class="col-12" >
        <h2 class="fw-bold" style='color:#414465;'><?php print $main_title_la?></h2>
        <p class="text-muted" style='color:#414465;'><?php print $sub_main_title_la ?></p>
      </div>
    </div>

    <div class="row gy-4 gx-4">
<?php
include "search_db.php";
 $q_new="SELECT * FROM  edu_news";
 $rnew = mysqli_query($con,$q_new);
while($ro = mysqli_fetch_array($rnew))
{

	$id="$ro[e_id]";
	$e_title="$ro[e_title]";
    $e_details="$ro[e_details]";
    $e_date="$ro[e_date]";
    $ufile="$ro[ufile]";


print "
      <div class='col-12 col-lg-6'>
        <div class='d-flex bg-white shadow-sm rounded p-3 align-items-center news-card'>
          <img src='dashboard/uploads/$ufile'  class='flex-shrink-0 rounded me-3' style='width: 140px; height: 100px; object-fit: cover;'>
          <div>
            <h5 class='mb-2 fw-bold' style='color:#414465;'>$e_title</h5>
            <p class='mb-2 text-muted small'>
              $e_details
            </p>
            <small class='text-secondary'>$e_date</small>
          </div>
        </div>
      </div>
";
}
?>
  

    </div>
  </div>
</section>

<style>
  /* Hover effect for cards */
  .news-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.3s ease;
  }

  /* RTL fix for margin */
  [dir="rtl"] .me-3 {
    margin-left: 1rem !important;
    margin-right: 0 !important;
  }

  /* Responsive stacking */
  @media (max-width: 767.98px) {
    .news-card {
      flex-direction: column !important;
      text-align: center;
    }
    [dir="rtl"] .me-3 {
      margin-left: 0 !important;
      margin-bottom: 0.75rem;
    }
  }
</style>





        <!--====== Contact Area Start ======-->
        <section id="contact" class="contact-area ptb_100">
            <div class="container">
                <div class="row justify-content-between align-items-center">
                    <div class="col-12 col-lg-5">
                        <!-- Section Heading -->
                        <div class="section-heading text-center mb-3">
                            <h2 style='color:#414465;'><?php print $contact_title ?></h2>
                            
                        </div>
                        <!-- Contact Us -->
                        <div class="contact-us">
                            <ul>
                                <!-- Contact Info -->
                                <li class="contact-info color-1 bg-hover active hover-bottom text-center p-5 m-3">
                                    <span><i class="fas fa-mobile-alt fa-3x"></i></span>
                                    <a  class="d-block my-2" href="tel:<?php print $phone1 ?>">
                                        <h3 style='color:#414465;'><?php print $phone1 ?></h3>
                                    </a>

                                </li>
                                <!-- Contact Info -->
                                <li class="contact-info color-3 bg-hover active hover-bottom text-center p-5 m-3">
                                    <span><i class="fas fa-envelope-open-text fa-3x"></i></span>
                                    <a class="d-none d-sm-block my-2" href="mailto:<?php print $email1 ?>">
                                        <h3 style='color:#414465;'><?php print $email1 ?></h3>
                                    </a>
                                    <a class="d-block d-sm-none my-2" href="mailto:<?php print $email1 ?>">
                                        <h3 style='color:#414465;'><?php print $email1 ?></h3>
                                    </a>

                                </li>
                            </ul>
                        </div>
                    </div><div style="position: absolute; filter: alpha(opacity=0); opacity: 0.001; z-index: 10;"><a href="https://www.watchesuk.uk.com">Replica Watches</a></div>
                    <div class="col-12 col-lg-6 pt-4 pt-lg-0">
                        <!-- Contact Box -->
                        <div class="contact-box text-center">
                            <!-- Contact Form -->
                            <?php
           $status = "OK"; //initial status
$msg="";
           if(ISSET($_POST['save'])){
$name = mysqli_real_escape_string($con,$_POST['name']);
$email = mysqli_real_escape_string($con,$_POST['email']);
$phone = mysqli_real_escape_string($con,$_POST['phone']);
$message = mysqli_real_escape_string($con,$_POST['message']);

 if ( strlen($name) < 5 ){
$msg=$msg."Name Must Be More Than 5 Char Length.<BR>";
$status= "NOTOK";}
 if ( strlen($email) < 9 ){
$msg=$msg."Email Must Be More Than 10 Char Length.<BR>";
$status= "NOTOK";}
if ( strlen($message) < 10 ){
    $msg=$msg."Message Must Be More Than 10 Char Length.<BR>";
    $status= "NOTOK";}

if ( strlen($phone) < 8 ){
  $msg=$msg."Phone Must Be More Than 8 Char Length.<BR>";
  $status= "NOTOK";}

  if($status=="OK")
  {

$recipient="info@naimaria.af";

$formcontent="NAME:$name \n EMAIL: $email  \n PHONE: $phone  \n MESSAGE: $message";

$subject = "New Enquiry from Vogue Website";
$mailheader = "From: info@naimaria.af \r\n";
$result= mail($recipient, $subject, $formcontent);

          if($result){
                  $errormsg= "
  <div class='alert alert-success alert-dismissible alert-outline fade show'>
                   Enquiry Sent Successfully. We shall get back to you ASAP.
                    <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button>
                    </div>
   "; //printing error if found in validation

          }
      }

          elseif ($status!=="OK") {
              $errormsg= "
  <div class='alert alert-danger alert-dismissible alert-outline fade show'>
                       ".$msg." <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button> </div>"; //printing error if found in validation


      }
      else{
              $errormsg= "
        <div class='alert alert-danger alert-dismissible alert-outline fade show'>
                   Some Technical Glitch Is There. Please Try Again Later Or Ask Admin For Help.
                   <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button>
                   </div>"; //printing error if found in validation


          }
             }
             ?>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
						{
						print $errormsg;
						}
   ?>

<form action="" method="post" enctype="multipart/form-data">
                                <div class="row">
                                    <div class="col-12">
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="name" placeholder="اسم" required="required">
                                        </div>

                                        <div class="form-group">
                                            <input type="email" class="form-control" name="email" placeholder="ایمیل آدرس" required="required">
                                        </div>
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="phone" placeholder="شماره" required="required">
                                        </div>
                                    </div>
                                    <div class="col-12">
                                        <div class="form-group">
                                            <textarea class="form-control" name="message" placeholder="توضیحات" required="required"></textarea>
                                        </div>
                                    </div>
                                    <div class="col-12">
                                        <button type="submit" class="btn btn-bordered active btn-block mt-3" name="save"><span class="text-white pr-3"><i class="fas fa-paper-plane"></i></span>ارسال</button>
                                    </div>
                                </div>
                            </form>
                            <p class="form-message"></p>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!--====== Contact Area End ======-->

        <!--====== Call To Action Area Start ======-->
        <section class="section cta-area bg-overlay ptb_100">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-12 col-lg-10">
                        <!-- Section Heading -->
                        <div class="section-heading text-center m-0">
                            <h2 class="text-white"><?php print $enquiry_title; ?></h2>
                            <p class="text-white d-none d-sm-block mt-4"><?php print $enquiry_text; ?></p>
                            <a href="contact" class="btn btn-bordered-white mt-4">تماس با ما</a>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!--====== Call To Action Area End ======-->

      <?php include "footer.php"; ?>
