<?php
$page_title  = "Contact & Free Consultation — CY Consultancy Centre";
$page_desc   = "Free study abroad consultation. Nahar Plaza, Hatirpool, Dhaka 1205.";
$active_page = "contact";
include 'includes/header.php';
$B = BASE_PATH;
?>

<!-- HERO -->
<div style="position:relative;min-height:320px;display:flex;align-items:center;justify-content:center;overflow:hidden;background:#050d1a">
  <div style="position:absolute;inset:0;background-image:url('<?=$B?>assets/images/bg-study3.jpg');background-size:cover;background-position:center;opacity:.25"></div>
  <div style="position:absolute;inset:0;background:linear-gradient(135deg,rgba(5,13,26,.85),rgba(26,86,219,.4))"></div>
  <div style="position:relative;z-index:2;text-align:center;padding:60px 24px 50px">
    <div style="display:inline-flex;align-items:center;gap:8px;background:rgba(231,111,81,.18);border:1px solid rgba(231,111,81,.35);color:#f4a261;font-size:11px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;padding:6px 18px;border-radius:30px;margin-bottom:18px">
      <i class="fas fa-headset"></i> Free Consultation
    </div>
    <h1 style="font-size:clamp(28px,5vw,52px);font-weight:900;color:#fff;font-family:'Montserrat',sans-serif;margin-bottom:14px;line-height:1.1">
      Contact <span style="color:#f4a261">CY Consultancy</span>
    </h1>
    <p style="color:rgba(255,255,255,.7);font-size:16px;max-width:560px;margin:0 auto">
      Get expert guidance — we're here to help you achieve your study abroad dreams
    </p>
  </div>
</div>

<!-- QUICK STRIP -->
<div style="background:#fff;border-bottom:1px solid #e5e7eb">
  <div style="max-width:1100px;margin:0 auto;padding:0 24px;display:grid;grid-template-columns:repeat(4,1fr);gap:0">
    <?php
    $strips = [
      ['fas fa-map-marker-alt','#e76f51','Address','Lift 14, Nahar Plaza, Hatirpool, Dhaka 1205'],
      ['fas fa-phone-alt','#1a56db','Phone','+88 01955-001001 / 01711-351367'],
      ['far fa-clock','#059669','Business Hours','SAT–THU: 10:00 AM – 5:30 PM'],
      ['fas fa-envelope','#7c3aed','Email','info@cyconsultancy.net'],
    ];
    foreach($strips as $s): ?>
    <div style="padding:20px 24px;display:flex;align-items:center;gap:14px;border-right:1px solid #f3f4f6">
      <div style="width:44px;height:44px;border-radius:12px;background:<?=$s[1]?>18;display:flex;align-items:center;justify-content:center;flex-shrink:0">
        <i class="<?=$s[0]?>" style="color:<?=$s[1]?>;font-size:16px"></i>
      </div>
      <div>
        <div style="font-size:10px;font-weight:700;color:#9ca3af;text-transform:uppercase;letter-spacing:.08em;margin-bottom:3px"><?=$s[1]=="<?=$s[1]?>"?$s[2]:$s[2]?></div>
        <div style="font-size:13px;font-weight:600;color:#111827;line-height:1.4"><?=$s[3]?></div>
      </div>
    </div>
    <?php endforeach; ?>
  </div>
</div>

<!-- MAIN CONTENT -->
<section style="background:#f8fafc;padding:64px 0">
  <div style="max-width:1120px;margin:0 auto;padding:0 24px;display:grid;grid-template-columns:1fr 520px;gap:40px;align-items:start">

    <!-- LEFT: Office Info -->
    <div data-aos="fade-right">

      <!-- Visit card -->
      <div style="background:#fff;border-radius:20px;padding:32px;border:1px solid #e5e7eb;box-shadow:0 4px 20px rgba(0,0,0,.04);margin-bottom:20px">
        <div style="display:flex;align-items:center;gap:12px;margin-bottom:22px">
          <div style="width:46px;height:46px;border-radius:13px;background:linear-gradient(135deg,#1a56db,#1e3a8a);display:flex;align-items:center;justify-content:center">
            <i class="fas fa-building" style="color:#fff;font-size:18px"></i>
          </div>
          <div>
            <div style="font-size:18px;font-weight:800;color:#111827;font-family:'Montserrat',sans-serif">Visit Our Office</div>
            <div style="font-size:12px;color:#6b7280;margin-top:1px">Walk-ins welcome — no appointment needed</div>
          </div>
        </div>

        <div style="display:flex;flex-direction:column;gap:16px">
          <div style="display:flex;gap:14px;align-items:flex-start">
            <div style="width:40px;height:40px;border-radius:11px;background:#dbeafe;display:flex;align-items:center;justify-content:center;flex-shrink:0"><i class="fas fa-map-marker-alt" style="color:#1a56db;font-size:14px"></i></div>
            <div><div style="font-size:11px;font-weight:700;color:#9ca3af;text-transform:uppercase;letter-spacing:.06em;margin-bottom:3px">Address</div><div style="font-size:14px;color:#374151;line-height:1.6">Lift 14, Nahar Plaza, Bir Uttam C.R. Dutta Road<br>Hatirpool, Dhaka 1205, Bangladesh</div></div>
          </div>
          <div style="display:flex;gap:14px;align-items:flex-start">
            <div style="width:40px;height:40px;border-radius:11px;background:#dcfce7;display:flex;align-items:center;justify-content:center;flex-shrink:0"><i class="fas fa-phone-alt" style="color:#16a34a;font-size:14px"></i></div>
            <div><div style="font-size:11px;font-weight:700;color:#9ca3af;text-transform:uppercase;letter-spacing:.06em;margin-bottom:3px">Phone</div>
              <a href="tel:+8801955001001" style="display:block;font-size:14px;color:#1a56db;font-weight:600;text-decoration:none">+88 01955-001001</a>
              <a href="tel:+8801711351367" style="display:block;font-size:14px;color:#1a56db;font-weight:600;text-decoration:none">+88 01711-351367</a>
            </div>
          </div>
          <div style="display:flex;gap:14px;align-items:flex-start">
            <div style="width:40px;height:40px;border-radius:11px;background:#fef3c7;display:flex;align-items:center;justify-content:center;flex-shrink:0"><i class="fas fa-envelope" style="color:#d97706;font-size:14px"></i></div>
            <div><div style="font-size:11px;font-weight:700;color:#9ca3af;text-transform:uppercase;letter-spacing:.06em;margin-bottom:3px">Email</div><a href="mailto:info@cyconsultancy.net" style="font-size:14px;color:#1a56db;font-weight:600;text-decoration:none">info@cyconsultancy.net</a></div>
          </div>
        </div>

        <!-- Social -->
        <div style="display:flex;gap:10px;margin-top:24px;flex-wrap:wrap">
          <a href="https://www.facebook.com/cyconsultancycentre" target="_blank" style="display:inline-flex;align-items:center;gap:7px;padding:10px 16px;border-radius:10px;background:#1877f208;border:1px solid #1877f222;color:#1877f2;font-size:13px;font-weight:700;text-decoration:none;transition:all .2s" onmouseover="this.style.background='#1877f215'" onmouseout="this.style.background='#1877f208'"><i class="fab fa-facebook-f"></i> Facebook</a>
          <a href="https://wa.me/8801711351367" target="_blank" style="display:inline-flex;align-items:center;gap:7px;padding:10px 16px;border-radius:10px;background:#25d36608;border:1px solid #25d36622;color:#25d366;font-size:13px;font-weight:700;text-decoration:none;transition:all .2s" onmouseover="this.style.background='#25d36615'" onmouseout="this.style.background='#25d36608'"><i class="fab fa-whatsapp"></i> WhatsApp</a>
          <a href="#" style="display:inline-flex;align-items:center;gap:7px;padding:10px 16px;border-radius:10px;background:#ff000008;border:1px solid #ff000022;color:#ff0000;font-size:13px;font-weight:700;text-decoration:none;transition:all .2s" onmouseover="this.style.background='#ff000015'" onmouseout="this.style.background='#ff000008'"><i class="fab fa-youtube"></i> YouTube</a>
        </div>
      </div>

      <!-- Hours card -->
      <div style="background:#fff;border-radius:20px;padding:28px;border:1px solid #e5e7eb;box-shadow:0 4px 20px rgba(0,0,0,.04);margin-bottom:20px">
        <div style="font-size:13px;font-weight:800;color:#111827;font-family:'Montserrat',sans-serif;text-transform:uppercase;letter-spacing:.06em;margin-bottom:18px;display:flex;align-items:center;gap:8px">
          <i class="far fa-clock" style="color:#e76f51"></i> Business Hours
        </div>
        <?php
        $hours = [
          ['Saturday','10:00 AM – 5:30 PM',false],['Sunday','10:00 AM – 5:30 PM',false],
          ['Monday','10:00 AM – 5:30 PM',false],['Tuesday','10:00 AM – 5:30 PM',false],
          ['Wednesday','10:00 AM – 5:30 PM',false],['Thursday','10:00 AM – 5:30 PM',false],
          ['Friday','Closed',true],
        ];
        foreach($hours as $h): ?>
        <div style="display:flex;justify-content:space-between;padding:9px 0;border-bottom:1px solid #f3f4f6;font-size:13px">
          <span style="color:#6b7280;font-weight:600"><?=$h[0]?></span>
          <span style="font-weight:700;color:<?=$h[2]?'#e76f51':'#111827'?>"><?=$h[1]?></span>
        </div>
        <?php endforeach; ?>
      </div>

      <!-- Map -->
      <div style="border-radius:20px;overflow:hidden;box-shadow:0 8px 32px rgba(0,0,0,.1)">
        <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3651.9022940894657!2d90.38349279999999!3d23.738740199999997!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3755b8b93b37de69%3A0x7c9ce9ab5e9697d4!2sNahar%20Plaza%2C%20Bir%20Uttam%20C.%20R.%20Dutta%20Rd%2C%20Dhaka%201205!5e1!3m2!1sen!2sbd!4v1710000000000!5m2!1sen!2sbd"
          width="100%" height="280" style="border:none;display:block" allowfullscreen loading="lazy"></iframe>
        <div style="display:flex;gap:10px;padding:14px 16px;background:#fff;border-top:1px solid #f3f4f6">
          <a href="https://maps.google.com/maps/dir//Nahar+Plaza+Hatirpool+Dhaka" target="_blank" style="display:inline-flex;align-items:center;gap:6px;padding:9px 16px;background:#1a56db;color:#fff;border-radius:8px;font-size:12px;font-weight:700;text-decoration:none"><i class="fas fa-directions"></i> Get Directions</a>
          <a href="https://maps.google.com/?q=Nahar+Plaza+Hatirpool+Dhaka&layer=satellite" target="_blank" style="display:inline-flex;align-items:center;gap:6px;padding:9px 16px;background:#f3f4f6;color:#374151;border-radius:8px;font-size:12px;font-weight:700;text-decoration:none"><i class="fas fa-satellite"></i> Satellite View</a>
        </div>
      </div>
    </div>

    <!-- RIGHT: Form -->
    <div data-aos="fade-left">
      <div style="background:#fff;border-radius:24px;padding:40px 36px;box-shadow:0 20px 60px rgba(0,0,0,.08);border:1px solid #e5e7eb;position:sticky;top:24px">

        <!-- Form header -->
        <div style="text-align:center;margin-bottom:28px">
          <div style="width:60px;height:60px;background:linear-gradient(135deg,#e76f51,#f4a261);border-radius:18px;display:flex;align-items:center;justify-content:center;margin:0 auto 14px;box-shadow:0 8px 24px rgba(231,111,81,.3)">
            <i class="fas fa-graduation-cap" style="color:#fff;font-size:24px"></i>
          </div>
          <h3 style="font-size:22px;font-weight:900;color:#111827;font-family:'Montserrat',sans-serif;margin-bottom:6px">Free Consultation Form</h3>
          <p style="font-size:13px;color:#6b7280;line-height:1.6">বিদেশে উচ্চশিক্ষার জন্য ফ্রি পরামর্শ পেতে রেজিস্ট্রেশন করুন — ২৪ ঘন্টার মধ্যে যোগাযোগ করব</p>
        </div>

        <form id="contactForm" method="POST" action="contact-handler.php">
          <div style="display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:14px">
            <div>
              <label style="display:block;font-size:12px;font-weight:700;color:#374151;margin-bottom:6px;text-transform:uppercase;letter-spacing:.05em">Full Name *</label>
              <input name="full_name" required placeholder="আপনার নাম" style="width:100%;padding:11px 14px;border:1.5px solid #e5e7eb;border-radius:10px;font-size:14px;font-family:inherit;outline:none;transition:border-color .2s;box-sizing:border-box" onfocus="this.style.borderColor='#1a56db'" onblur="this.style.borderColor='#e5e7eb'">
            </div>
            <div>
              <label style="display:block;font-size:12px;font-weight:700;color:#374151;margin-bottom:6px;text-transform:uppercase;letter-spacing:.05em">Phone *</label>
              <input name="phone" type="tel" required placeholder="+880 1XXX-XXXXXX" style="width:100%;padding:11px 14px;border:1.5px solid #e5e7eb;border-radius:10px;font-size:14px;font-family:inherit;outline:none;transition:border-color .2s;box-sizing:border-box" onfocus="this.style.borderColor='#1a56db'" onblur="this.style.borderColor='#e5e7eb'">
            </div>
          </div>
          <div style="margin-bottom:14px">
            <label style="display:block;font-size:12px;font-weight:700;color:#374151;margin-bottom:6px;text-transform:uppercase;letter-spacing:.05em">Email Address *</label>
            <input name="email" type="email" required placeholder="your@email.com" style="width:100%;padding:11px 14px;border:1.5px solid #e5e7eb;border-radius:10px;font-size:14px;font-family:inherit;outline:none;transition:border-color .2s;box-sizing:border-box" onfocus="this.style.borderColor='#1a56db'" onblur="this.style.borderColor='#e5e7eb'">
          </div>
          <div style="display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:14px">
            <div>
              <label style="display:block;font-size:12px;font-weight:700;color:#374151;margin-bottom:6px;text-transform:uppercase;letter-spacing:.05em">Preferred Country</label>
              <select name="preferred_country" style="width:100%;padding:11px 14px;border:1.5px solid #e5e7eb;border-radius:10px;font-size:14px;font-family:inherit;outline:none;background:#fff;box-sizing:border-box">
                <option value="">— Select —</option>
                <option>Malta</option><option>Cyprus</option><option>UK</option>
                <option>USA</option><option>Canada</option><option>Australia</option>
                <option>Malaysia</option><option>Turkey</option><option>Other</option>
              </select>
            </div>
            <div>
              <label style="display:block;font-size:12px;font-weight:700;color:#374151;margin-bottom:6px;text-transform:uppercase;letter-spacing:.05em">Subject</label>
              <input name="subject" placeholder="Student Visa" style="width:100%;padding:11px 14px;border:1.5px solid #e5e7eb;border-radius:10px;font-size:14px;font-family:inherit;outline:none;transition:border-color .2s;box-sizing:border-box" onfocus="this.style.borderColor='#1a56db'" onblur="this.style.borderColor='#e5e7eb'">
            </div>
          </div>
          <div style="margin-bottom:20px">
            <label style="display:block;font-size:12px;font-weight:700;color:#374151;margin-bottom:6px;text-transform:uppercase;letter-spacing:.05em">Message *</label>
            <textarea name="message" required rows="4" placeholder="আপনার শিক্ষাগত যোগ্যতা ও লক্ষ্য সম্পর্কে বলুন..." style="width:100%;padding:11px 14px;border:1.5px solid #e5e7eb;border-radius:10px;font-size:14px;font-family:inherit;outline:none;resize:vertical;transition:border-color .2s;box-sizing:border-box" onfocus="this.style.borderColor='#1a56db'" onblur="this.style.borderColor='#e5e7eb'"></textarea>
          </div>
          <button type="submit" id="submitBtn" style="width:100%;padding:15px;background:linear-gradient(135deg,#e76f51,#f4a261);color:#fff;border:none;border-radius:12px;font-size:16px;font-weight:800;font-family:'Montserrat',sans-serif;cursor:pointer;transition:all .25s;box-shadow:0 8px 24px rgba(231,111,81,.35);display:flex;align-items:center;justify-content:center;gap:10px" onmouseover="this.style.transform='translateY(-2px)';this.style.boxShadow='0 12px 32px rgba(231,111,81,.45)'" onmouseout="this.style.transform='none';this.style.boxShadow='0 8px 24px rgba(231,111,81,.35)'">
            <i class="fas fa-paper-plane"></i> Submit Application
          </button>
        </form>

        <!-- Trust badges -->
        <div style="display:flex;gap:16px;justify-content:center;margin-top:20px;flex-wrap:wrap">
          <div style="display:flex;align-items:center;gap:5px;font-size:11px;color:#9ca3af"><i class="fas fa-shield-alt" style="color:#059669"></i> 100% Free</div>
          <div style="display:flex;align-items:center;gap:5px;font-size:11px;color:#9ca3af"><i class="fas fa-lock" style="color:#1a56db"></i> Secure</div>
          <div style="display:flex;align-items:center;gap:5px;font-size:11px;color:#9ca3af"><i class="fas fa-clock" style="color:#e76f51"></i> 24hr Response</div>
          <div style="display:flex;align-items:center;gap:5px;font-size:11px;color:#9ca3af"><i class="fas fa-star" style="color:#f59e0b"></i> 500+ Students</div>
        </div>
      </div>
    </div>
  </div>
</section>

<!-- SUCCESS POPUP -->
<div id="successPopup" style="display:none;position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:9999;place-items:center;backdrop-filter:blur(6px)">
  <div id="popupBox" style="background:#fff;border-radius:28px;padding:48px 40px;max-width:480px;width:90%;text-align:center;box-shadow:0 40px 100px rgba(0,0,0,.3);transform:scale(.7);opacity:0;transition:all .4s cubic-bezier(.34,1.56,.64,1)">
    <!-- Confetti canvas -->
    <canvas id="confettiCanvas" style="position:absolute;inset:0;pointer-events:none;border-radius:28px"></canvas>
    <!-- Checkmark circle -->
    <div style="width:90px;height:90px;background:linear-gradient(135deg,#10b981,#059669);border-radius:50%;display:flex;align-items:center;justify-content:center;margin:0 auto 24px;box-shadow:0 12px 32px rgba(16,185,129,.35)">
      <i class="fas fa-check" style="color:#fff;font-size:38px"></i>
    </div>
    <h2 style="font-size:26px;font-weight:900;color:#111827;font-family:'Montserrat',sans-serif;margin-bottom:10px">আবেদন সফল! 🎉</h2>
    <p style="font-size:15px;color:#6b7280;line-height:1.7;margin-bottom:8px">আপনার আবেদন সফলভাবে জমা হয়েছে।</p>
    <p style="font-size:14px;color:#374151;font-weight:600;margin-bottom:28px">আমাদের টিম <span style="color:#e76f51">২৪ ঘন্টার মধ্যে</span> আপনার সাথে যোগাযোগ করবে।</p>
    <div style="display:flex;gap:12px;justify-content:center;flex-wrap:wrap">
      <a href="https://wa.me/8801711351367" target="_blank" style="display:inline-flex;align-items:center;gap:8px;padding:12px 24px;background:#25d366;color:#fff;border-radius:12px;font-weight:700;font-size:14px;text-decoration:none"><i class="fab fa-whatsapp"></i> WhatsApp করুন</a>
      <button onclick="closePopup()" style="padding:12px 24px;background:#f3f4f6;color:#374151;border:none;border-radius:12px;font-weight:700;font-size:14px;cursor:pointer;font-family:inherit">বন্ধ করুন</button>
    </div>
  </div>
</div>

<style>
@media(max-width:900px){
  div[style*="grid-template-columns:1fr 520px"]{grid-template-columns:1fr!important}
  div[style*="grid-template-columns:repeat(4,1fr)"]{grid-template-columns:1fr 1fr!important}
  div[style*="grid-template-columns:1fr 1fr"]{grid-template-columns:1fr!important}
}
</style>

<script>
// AJAX form submit
document.getElementById('contactForm').addEventListener('submit', function(e) {
  e.preventDefault();
  var btn = document.getElementById('submitBtn');
  btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Sending...';
  btn.disabled = true;
  btn.style.opacity = '.7';

  var fd = new FormData(this);
  fetch('contact-handler.php', { method:'POST', body: fd })
    .then(function(r) {
      showPopup();
      document.getElementById('contactForm').reset();
    })
    .catch(function() { showPopup(); })
    .finally(function() {
      btn.innerHTML = '<i class="fas fa-paper-plane"></i> Submit Application';
      btn.disabled = false;
      btn.style.opacity = '1';
    });
});

function showPopup() {
  var overlay = document.getElementById('successPopup');
  var box     = document.getElementById('popupBox');
  overlay.style.display = 'grid';
  setTimeout(function() {
    box.style.transform = 'scale(1)';
    box.style.opacity   = '1';
  }, 50);
  launchConfetti();
}

function closePopup() {
  var overlay = document.getElementById('successPopup');
  var box     = document.getElementById('popupBox');
  box.style.transform = 'scale(.8)';
  box.style.opacity   = '0';
  setTimeout(function() { overlay.style.display = 'none'; }, 300);
}

document.getElementById('successPopup').addEventListener('click', function(e) {
  if (e.target === this) closePopup();
});

// Mini confetti
function launchConfetti() {
  var canvas = document.getElementById('confettiCanvas');
  var box    = document.getElementById('popupBox');
  canvas.width  = box.offsetWidth;
  canvas.height = box.offsetHeight;
  var ctx    = canvas.getContext('2d');
  var colors = ['#e76f51','#1a56db','#10b981','#f59e0b','#7c3aed','#f4a261'];
  var pieces = [];
  for (var i=0;i<80;i++) {
    pieces.push({
      x: Math.random()*canvas.width,
      y: -20,
      r: Math.random()*6+3,
      color: colors[Math.floor(Math.random()*colors.length)],
      speed: Math.random()*3+1.5,
      drift: (Math.random()-.5)*2,
      rot: Math.random()*360,
      rotSpeed: (Math.random()-.5)*6
    });
  }
  var frame;
  function draw() {
    ctx.clearRect(0,0,canvas.width,canvas.height);
    var alive = false;
    pieces.forEach(function(p) {
      if (p.y < canvas.height+20) { alive=true; }
      p.y += p.speed;
      p.x += p.drift;
      p.rot += p.rotSpeed;
      ctx.save();
      ctx.translate(p.x, p.y);
      ctx.rotate(p.rot*Math.PI/180);
      ctx.fillStyle = p.color;
      ctx.fillRect(-p.r,-p.r/2,p.r*2,p.r);
      ctx.restore();
    });
    if (alive) frame = requestAnimationFrame(draw);
  }
  draw();
  setTimeout(function() { cancelAnimationFrame(frame); ctx.clearRect(0,0,canvas.width,canvas.height); }, 4000);
}
</script>

<?php include 'includes/footer.php'; ?>
