<?php
// Incluir configurações
require_once 'config.php';

// Verificar se veio do formulário (proteção contra acesso direto)
$referer = $_SERVER['HTTP_REFERER'] ?? '';
$is_from_form = !empty($referer) || isset($_GET['success']);

// Se não veio do formulário, redirecionar para a página principal
if (!$is_from_form && !isset($_GET['success'])) {
    header('Location: index.php');
    exit;
}
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <!-- 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-523HNRKK');</script>
    <!-- End Google Tag Manager -->
    
    <!-- Facebook Pixel Code -->
    <script>
    !function(f,b,e,v,n,t,s)
    {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
    n.callMethod.apply(n,arguments):n.queue.push(arguments)};
    if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
    n.queue=[];t=b.createElement(e);t.async=!0;
    t.src=v;s=b.getElementsByTagName(e)[0];
    s.parentNode.insertBefore(t,s)}(window, document,'script',
    'https://connect.facebook.net/en_US/fbevents.js');
    fbq('init', '854449800105975');
    fbq('track', 'PageView');
    fbq('track', 'Lead', {
        content_name: 'Solicitação de Orçamento GK2100',
        content_category: 'Formulário de Contato'
    });
    </script>
    <noscript><img height="1" width="1" style="display:none"
    src="https://www.facebook.com/tr?id=854449800105975&ev=PageView&noscript=1"
    /></noscript>
    <!-- End Facebook Pixel Code -->
    
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes, viewport-fit=cover">
    <meta name="description" content="Obrigado por solicitar um orçamento da GK2100 GIMAK">
    <title>Obrigado! - GK2100 GIMAK</title>
    <link rel="stylesheet" href="styles.css">
    <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=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
</head>
<body>
    <!-- Google Tag Manager (noscript) -->
    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-523HNRKK"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <!-- End Google Tag Manager (noscript) -->
    
    <!-- Header Navigation -->
    <header class="header" id="header">
        <div class="container">
            <nav class="navbar">
                <div class="logo">
                    <img src="logo2.png" alt="GIMAK" class="logo-image">
                </div>
                <ul class="nav-menu" id="navMenu">
                    <li><a href="index.php#inicio" class="nav-link">Início</a></li>
                    <li><a href="index.php#beneficios" class="nav-link">Benefícios</a></li>
                    <li><a href="index.php#recursos" class="nav-link">Recursos</a></li>
                    <li><a href="index.php#depoimentos" class="nav-link">Depoimentos</a></li>
                    <li><a href="index.php#orcamento" class="nav-link cta-nav">Solicitar Orçamento</a></li>
                </ul>
                <button class="menu-toggle" id="menuToggle" aria-label="Toggle menu">
                    <span></span>
                    <span></span>
                    <span></span>
                </button>
            </nav>
        </div>
    </header>

    <!-- Thank You Hero Section -->
    <section class="hero" id="inicio">
        <div class="hero-background">
            <div class="hero-gradient-1"></div>
            <div class="hero-gradient-2"></div>
            <div class="hero-gradient-3"></div>
            <div class="hero-grid-pattern"></div>
        </div>
        <div class="container">
            <div class="hero-content" style="grid-template-columns: 1fr; text-align: center; max-width: 800px; margin: 0 auto;">
                <div class="hero-text" style="max-width: 100%;">
                    <div class="hero-badge" style="margin: 0 auto var(--spacing-xl);">
                        <span class="badge-dot"></span>
                        <span>Solicitação enviada</span>
                    </div>
                    
                    <h1 class="hero-headline" style="margin-bottom: var(--spacing-lg);">
                        <span style="font-size: 1em; color: var(--accent);">Obrigado!</span>
                        <span style="font-size: 0.6em; color: var(--text-primary);">Sua solicitação foi recebida com sucesso</span>
                    </h1>
                    
                    <p class="hero-subheadline" style="font-size: 1.125rem; margin-bottom: var(--spacing-xl);">
                        Nossa equipe entrará em contato com você em até <strong style="color: var(--accent);">24 horas</strong>.
                    </p>
                    
                    <div class="hero-actions" style="justify-content: center; gap: var(--spacing-md);">
                        <a href="index.php" class="cta-primary-hero">
                            <span>Voltar ao início</span>
                            <svg width="20" height="20" viewBox="0 0 20 20" fill="none">
                                <path d="M7.5 15L12.5 10L7.5 5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                            </svg>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="footer">
        <div class="container">
            <div class="footer-content">
                <div class="footer-section">
                    <h3 class="footer-title">GIMAK</h3>
                    <p class="footer-text">Mais de 21 anos produzindo equipamentos de alta qualidade para indústrias de todo o Brasil.</p>
                </div>
                <div class="footer-section">
                    <h3 class="footer-title">Produto</h3>
                    <ul class="footer-links">
                        <li><a href="index.php#inicio">Início</a></li>
                        <li><a href="index.php#beneficios">Benefícios</a></li>
                        <li><a href="index.php#recursos">Recursos</a></li>
                        <li><a href="index.php#depoimentos">Depoimentos</a></li>
                    </ul>
                </div>
                <div class="footer-section">
                    <h3 class="footer-title">Contato</h3>
                    <ul class="footer-contact">
                        <li>📞 <strong>(47) 3379-2323</strong></li>
                        <li>📱 (47) 99279-7575</li>
                        <li>✉️ <strong>vendas@gimak.ind.br</strong></li>
                        <li>📍 SC-108, 7499 - Centro<br>Massaranduba - SC<br>CEP: 89108-000</li>
                    </ul>
                </div>
                <div class="footer-section">
                    <h3 class="footer-title">Solicitar Orçamento</h3>
                    <a href="index.php#orcamento" class="footer-cta">Clique aqui</a>
                </div>
            </div>
            <div class="footer-bottom">
                <p>&copy; <?php echo date('Y'); ?> GIMAK. Todos os direitos reservados.</p>
            </div>
        </div>
    </footer>

    <script src="script.js"></script>
</body>
</html>
