<?php
require_once 'csp_config.php';
require_once 'config_loader.php';
require_once 'CsrfProtection.php';

// Generate and send CSP header
send_security_headers();

// Start session for CSRF protection
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-317231418"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'AW-317231418');
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Q9ZQXB9TDH"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-Q9ZQXB9TDH');
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2LD3RECBYF"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-2LD3RECBYF');
  gtag('event', 'ads_conversion_click_1', {});
</script>
    <!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W4G4XMPD');</script>
<!-- End Google Tag Manager -->
    <script>
      function onloadCallback() {
        // reCAPTCHA enterprise explicit render callback
      }
    </script>
    <script src="https://www.google.com/recaptcha/enterprise.js?onload=onloadCallback&render=explicit"
        async defer></script>
    <meta name="google-adsense-account" content="ca-pub-9807741295373154">
    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9807741295373154"
        crossorigin="anonymous"></script>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Mark's Tech Solution offers expert computer repair, laptop repair, network setup, WiFi optimization, custom PC builds, virus removal, and on-site IT support in East Weymouth, MA. Serving South Shore, Norfolk County, and nearby areas with reliable, affordable tech services.">
    <meta name="keywords" content="computer repair East Weymouth, laptop repair, desktop repair, IT support, network setup, WiFi installation, custom PC builds, virus removal, malware removal, data recovery, on-site tech support, remote computer repair, computer technician, printer setup, printer repair, router setup, WiFi extender, mesh network, Windows repair, SSD upgrade, RAM upgrade, PC tune up, gaming PC build, business IT support, home computer repair, tech support near me, computer repair near me, same day computer repair, affordable computer repair, East Weymouth, Weymouth, South Shore MA, Norfolk County, Braintree, Quincy, Randolph, Holbrook, Mark's Tech Solution">
    <meta name="author" content="Mark's Tech Solution">
    <meta name="robots" content="index, follow, max-image-preview:large">
    <meta name="theme-color" content="#ff6600">
    <meta name="msapplication-TileColor" content="#ff6600">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="referrer" content="strict-origin-when-cross-origin">
    <meta name="format-detection" content="telephone=yes">

    <!-- Open Graph / Facebook -->
    <meta property="og:type" content="website">
    <meta property="og:url" content="https://markstechsolution.com/">
    <meta property="og:title" content="Mark's Tech Solution - Computer Repair & IT Support in East Weymouth, MA">
    <meta property="og:description" content="Professional computer repair, network setup, WiFi optimization, custom PC builds, virus removal, and on-site IT support in East Weymouth and South Shore, MA.">
    <meta property="og:image" content="https://markstechsolution.com/assets/square-white-logo-og-image.png">
    <meta property="og:image:width" content="1200">
    <meta property="og:image:height" content="630">
    <meta property="og:image:alt" content="Mark's Tech Solution logo and IT services">
    <meta property="og:site_name" content="Mark's Tech Solution">
    <meta property="og:locale" content="en_US">
    <meta property="og:phone_number" content="+1-339-746-0995">

    <!-- Twitter -->
    <meta property="twitter:card" content="summary_large_image">
    <meta property="twitter:domain" content="markstechsolution.com">
    <meta property="twitter:url" content="https://markstechsolution.com/">
    <meta property="twitter:title" content="Mark's Tech Solution - Computer Repair & IT Support in East Weymouth, MA">
    <meta property="twitter:description" content="Professional computer repair, network setup, WiFi optimization, custom PC builds, virus removal, and on-site IT support in East Weymouth, MA.">
    <meta property="twitter:image" content="https://markstechsolution.com/assets/square-white-logo-og-image.png">
    <meta property="twitter:image:alt" content="Mark's Tech Solution logo and IT services">

    <!-- Additional SEO -->
    <link rel="canonical" href="https://markstechsolution.com/">
    <link rel="apple-touch-icon" href="assets/favicon.png">
    <meta name="geo.region" content="US-MA">
    <meta name="geo.placename" content="East Weymouth">
    <meta name="geo.position" content="42.226008;-70.945108">
    <meta name="ICBM" content="42.226008, -70.945108">
    <title>Mark's Tech Solution - Computer Repair & IT Support in East Weymouth, MA</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" integrity="sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="styles.css">
</head>

<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W4G4XMPD"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
    <!-- Skip Navigation -->
    <a href="#main-content" class="skip-nav visually-hidden-focusable">Skip to main content</a>

    <?php include 'components/navbar.php'; ?>

    <!-- Hero Section -->
    <main id="main-content">
        <section id="home" class="hero" role="banner">
            <div class="container">
                <div class="row align-items-center min-vh-100">
                    <div class="col-lg-8 mx-auto text-center">
                        <img class="header_image" src="assets/mts_logo.png" alt="Mark's Tech Solution logo" width="500" height="500" loading="eager">
                        <h1>Mark's Tech Solution</h1>
                        <p class="lead">Your Local Tech Experts in East Weymouth, MA</p>
                        <p>Professional on-site tech support, network setup, and computer repair services</p>
                        <a href="contact.php#contact-form" class="btn btn-primary btn-lg mt-3">Get a Quote</a>
                    </div>
                </div>
            </div>
        </section>
        <!-- About Section -->
         <section style="color:lightblue;"id="about" class="py-5">
            <div class="container">
                <div class="row align-items-center">
                    <div class="col-lg-6">
                        <h2 class="mb-4">About Mark's Tech Solution</h2>
                        <p class="lead">Your trusted local technology experts serving East Weymouth and surrounding communities.</p>
                        
                        <h4 class="mt-4 mb-3">Our Mission</h4>
                        <p>To provide professional, reliable, and affordable technology solutions that empower individuals and businesses to thrive in the digital age. We are committed to delivering exceptional service with transparent pricing and customer satisfaction at the core of everything we do.</p>
                        
                        <h4 class="mt-4 mb-3">Why Choose Us?</h4>
                        <ul class="list-unstyled">
                            <li class="mb-2"><i class="fas fa-check text-primary me-2"></i> <strong>Local Expertise:</strong> Proudly serving East Weymouth, MA with personalized service</li>
                            <li class="mb-2"><i class="fas fa-check text-primary me-2"></i> <strong>Below-Market Pricing:</strong> Competitive rates that save you money without compromising quality</li>
                            <li class="mb-2"><i class="fas fa-check text-primary me-2"></i> <strong>Professional Service:</strong> Certified technicians with years of experience</li>
                            <li class="mb-2"><i class="fas fa-check text-primary me-2"></i> <strong>Comprehensive Solutions:</strong> From computer repair to network setup, we handle it all</li>
                            <li class="mb-2"><i class="fas fa-check text-primary me-2"></i> <strong>Customer-First Approach:</strong> Your satisfaction is our top priority</li>
                        </ul>
                        
                        <div class="mt-4">
                            <a href="services.php" class="btn btn-primary btn-lg me-3">
                                <i class="fas fa-cogs me-2"></i>View All Services
                            </a>
                            <a href="contact.php#contact-form" class="btn btn-outline-primary btn-lg">
                                <i class="fas fa-phone me-2"></i>Get a Quote
                            </a>
                        </div>
                    </div>
                    <div class="col-lg-6">
                        <div class="card border-0 shadow-lg">
                            <div class="card-body p-4">
                                <h4 class="card-title text-center mb-4">Quick Service Overview</h4>
                                <div class="row g-3">
                                    <div class="col-6 text-center">
                                        <i class="fas fa-laptop-medical fa-3x text-primary mb-2"></i>
                                        <h6>Computer Repair</h6>
                                        <small class="text-muted">Hardware & Software</small>
                                    </div>
                                    <div class="col-6 text-center">
                                        <i class="fas fa-network-wired fa-3x text-primary mb-2"></i>
                                        <h6>Network Setup</h6>
                                        <small class="text-muted">Wired & Wireless</small>
                                    </div>
                                    <div class="col-6 text-center">
                                        <i class="fas fa-wifi fa-3x text-primary mb-2"></i>
                                        <h6>WiFi Solutions</h6>
                                        <small class="text-muted">Optimization & Security</small>
                                    </div>
                                    <div class="col-6 text-center">
                                        <i class="fas fa-desktop fa-3x text-primary mb-2"></i>
                                        <h6>Custom Builds</h6>
                                        <small class="text-muted">Gaming & Workstations</small>
                                    </div>
                                </div>
                                <div class="text-center mt-4">
                                    <small class="text-muted">Professional on-site and remote support available</small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Trust Badges Section -->
        <section id="trust-badges" class="py-5 bg-light">
            <div class="container">
                <h2 class="text-center mb-5">Why Choose Us?</h2>
                <div class="row text-center">
                    <div class="col-md-4">
                        <div class="card border-0">
                            <div class="card-body">
                                <i class="fas fa-shield-alt fa-3x mb-3 text-primary" aria-hidden="true"></i>
                                <h5 class="card-title">Certified Professionals</h5>
                                <p class="card-text">Our technicians are certified and experienced.</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="card border-0">
                            <div class="card-body">
                                <i class="fas fa-thumbs-up fa-3x mb-3 text-primary" aria-hidden="true"></i>
                                <h5 class="card-title">Satisfaction Guaranteed</h5>
                                <p class="card-text">We stand behind our work with a 100% satisfaction guarantee.</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="card border-0">
                            <div class="card-body">
                                <i class="fas fa-star fa-3x mb-3 text-primary" aria-hidden="true"></i>
                                <h5 class="card-title">4.6 on Google</h5>
                                <p class="card-text">Trusted by 9+ happy customers with a 4.6-star Google rating.</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <?php include 'components/reviews.php'; ?>

        <!-- SMS Newsletter Signup Section -->
        <section id="sms-signup" class="py-5 bg-light">
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-lg-8">
                        <div class="card border-0 shadow-lg">
                            <div class="card-body p-5">
                                <div class="text-center mb-4">
                                    <i class="fas fa-mobile-alt fa-3x text-primary mb-3"></i>
                                    <h2 class="mb-3">Stay Connected with SMS Updates</h2>
                                    <p class="lead">Get exclusive tech tips, special offers, and service updates delivered directly to your phone.</p>
                                </div>
                                
                                <form id="smsSignupForm" class="mt-4">
                                    <div class="row g-3">
                                        <div class="col-md-6">
                                            <label for="signupName" class="form-label">Your Name</label>
                                            <input type="text" class="form-control" id="signupName" name="name" required>
                                        </div>
                                        <div class="col-md-6">
                                            <label for="signupPhone" class="form-label">Phone Number</label>
                                            <input type="tel" class="form-control" id="signupPhone" name="phone" placeholder="(123) 456-7890" required>
                                        </div>
                                        <div class="col-12">
                                            <div class="form-check">
                                                <input class="form-check-input" type="checkbox" id="consentCheck" name="consent" required>
                                                <label class="form-check-label" for="consentCheck">
                                                    I agree to receive SMS messages from Mark's Tech Solution. Message frequency varies. Message and data rates may apply. Reply STOP to unsubscribe.
                                                </label>
                                            </div>
                                        </div>
                                        <div class="col-12 text-center">
                                            <button type="submit" class="btn btn-primary btn-lg">
                                                <i class="fas fa-bell me-2"></i>Subscribe to SMS Updates
                                            </button>
                                        </div>
                                    </div>
                                </form>
                                
                                <div id="signupAlert" class="alert d-none mt-3"></div>
                                
                                <div class="text-center mt-4">
                                    <small class="text-muted">
                                        <i class="fas fa-shield-alt me-1"></i>
                                        Your information is secure. We respect your privacy and never share your number.
                                    </small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

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

    <script>
    document.getElementById('smsSignupForm').addEventListener('submit', function(e) {
        e.preventDefault();
        
        const form = e.target;
        const submitBtn = form.querySelector('button[type="submit"]');
        const alertDiv = document.getElementById('signupAlert');
        
        // Show loading state
        submitBtn.disabled = true;
        submitBtn.innerHTML = '<i class="fas fa-spinner fa-spin me-2"></i>Processing...';
        alertDiv.className = 'alert d-none';
        
        // Get form data
        const formData = new FormData(form);
        const data = {
            name: formData.get('name'),
            phone: formData.get('phone'),
            consent: formData.get('consent') ? 'yes' : 'no'
        };
        
        // Auto-format phone number
        let numbersOnly = data.phone.replace(/\D/g, '');
        if (numbersOnly.length === 10) {
            data.phone = '+1' + numbersOnly;
        } else if (numbersOnly.length === 11 && numbersOnly.startsWith('1')) {
            data.phone = '+' + numbersOnly;
        } else {
            showAlert('Please enter a valid 10-digit phone number', 'danger');
            resetForm();
            return;
        }
        
        // Create consent request
        fetch('twilio_consent.php', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded',
            },
            body: new URLSearchParams({
                action: 'request_consent',
                phone_number: data.phone
            })
        })
        .then(response => response.json())
        .then(result => {
            if (result.success) {
                showAlert(`Thank you ${data.name}! A consent request has been sent to ${data.phone}. Please check your messages and reply YES to confirm.`, 'success');
                form.reset();
            } else {
                showAlert(result.message || 'An error occurred. Please try again.', 'danger');
            }
        })
        .catch(error => {
            console.error('Error:', error);
            showAlert('Network error. Please try again.', 'danger');
        })
        .finally(() => {
            resetForm();
        });
        
        function showAlert(message, type) {
            alertDiv.className = `alert alert-${type}`;
            alertDiv.textContent = message;
            alertDiv.classList.remove('d-none');
        }
        
        function resetForm() {
            submitBtn.disabled = false;
            submitBtn.innerHTML = '<i class="fas fa-bell me-2"></i>Subscribe to SMS Updates';
        }
    });
    </script>

</body>
</html>