<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include_once 'config.php';
include_once 'classes/Security.php';
define('SITE_URL', 'https://localhost:8080/crypto-app'); // or your local URL
$defaultTitle = 'HORPEX Pro - Professional Cryptocurrency Trading Platform';
$defaultDescription = 'Professional cryptocurrency exchange platform with advanced P2P trading, secure escrow system, and comprehensive KYC verification. Trade Bitcoin, Ethereum, and other digital assets safely.';
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo isset($pageTitle) ? $pageTitle : $defaultTitle; ?></title>
    <!-- SEO Meta Tags -->
    <meta name="description" content="<?php echo isset($pageDescription) ? $pageDescription : $defaultDescription; ?>">
    <meta name="keywords" content="cryptocurrency exchange, bitcoin trading, ethereum, P2P trading, crypto exchange, blockchain, digital currency, secure trading, escrow, KYC verification, professional trading">
    <meta name="author" content="CryptoExchange Pro">
    <meta name="robots" content="index, follow">
    <link rel="canonical" href="<?php echo SITE_URL . $_SERVER['REQUEST_URI']; ?>">
    <!-- Open Graph Meta Tags -->
    <meta property="og:title" content="<?php echo isset($pageTitle) ? $pageTitle : 'CryptoExchange Pro - Professional Cryptocurrency Trading'; ?>">
    <meta property="og:description" content="<?php echo isset($pageDescription) ? $pageDescription : 'Professional cryptocurrency exchange with secure P2P trading and escrow protection.'; ?>">
    <meta property="og:type" content="website">
    <meta property="og:url" content="<?php echo SITE_URL . $_SERVER['REQUEST_URI']; ?>">
    <meta property="og:image" content="<?php echo SITE_URL; ?>/assets/images/og-image.jpg">
    <meta property="og:site_name" content="CryptoExchange Pro">
    
    <!-- Twitter Card Meta Tags -->
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content="<?php echo isset($pageTitle) ? $pageTitle : 'CryptoExchange Pro'; ?>">
    <meta name="twitter:description" content="<?php echo isset($pageDescription) ? $pageDescription : 'Professional cryptocurrency exchange with secure P2P trading.'; ?>">
    <meta name="twitter:image" content="<?php echo SITE_URL; ?>/assets/images/twitter-card.jpg">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- Favicon -->
    <link rel="icon" type="image/x-icon" href="/assets/images/favicon.ico">
    <link rel="apple-touch-icon" sizes="180x180" href="/assets/images/apple-touch-icon.png">
    
    <!-- Security Headers -->
    <!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://cdnjs.cloudflare.com; img-src 'self' data: https:; font-src 'self' https://fonts.gstatic.com https://cdnjs.cloudflare.com; connect-src 'self';"> -->
    <meta name="csrf-token" content="<?php echo Security::generateCSRFToken(); ?>">
    
    <!-- CSS -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
    
    <!-- Structured Data -->
    <?php
$schemaData = [
    "@context" => "https://schema.org",
    "@type" => "FinancialService",
    "name" => "CryptoExchange Pro",
    "description" => "Professional cryptocurrency exchange platform with P2P trading and escrow protection",
    "url" => SITE_URL,
    "logo" => SITE_URL . "/assets/images/logo.png",
    "sameAs" => [
        "https://twitter.com/cryptoexchangepro",
        "https://facebook.com/cryptoexchangepro"
    ],
    "contactPoint" => [
        "@type" => "ContactPoint",
        "telephone" => "+1-555-CRYPTO",
        "contactType" => "customer service",
        "availableLanguage" => "English"
    ],
    "address" => [
        "@type" => "PostalAddress",
        "addressCountry" => "US"
    ]
];
?>

<script type="application/ld+json">
    <?= json_encode($schemaData, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); ?>
</script>
</head>
<body class="bg-light text-dark">
    <!-- Navigation -->
    <nav class="navbar">
        <div class="container-fluid">
            <div class="d-flex justify-content-between align-items-center" style="width: 100%; padding: 0 20px;">
                <a href="index.php" class="navbar-brand">
                    <i class="fas fa-coins"></i>
                    <span>HOPRPEX Pro</span>
                </a>
                
                <!-- Mobile menu button -->
                <button class="d-block d-md-none btn btn-outline-primary" onclick="toggleMobileMenu()" style="border: none; padding: 8px;">
                    <i class="fas fa-bars"></i>
                </button>
                
                <!-- Desktop menu -->
                <div class="navbar-nav d-none d-md-flex" style="flex-direction: row;">
                    <a href="index.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'index.php' ? 'active' : ''; ?>">
                        <i class="fas fa-home"></i> Home
                    </a>
                    <?php if (Security::isAuthenticated()): ?>
                    <a href="dashboard.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'dashboard.php' ? 'active' : ''; ?>">
                        <i class="fas fa-tachometer-alt"></i> Dashboard
                    </a>
                    <a href="wallet.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'wallet.php' ? 'active' : ''; ?>">
                        <i class="fas fa-wallet"></i> Wallet
                    </a>
                    <a href="trading.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'trading.php' ? 'active' : ''; ?>">
                        <i class="fas fa-exchange-alt"></i> Trading
                    </a>
                    <a href="markets.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'markets.php' ? 'active' : ''; ?>">
                        <i class="fas fa-chart-line"></i> Markets
                    </a>
                    <a href="kyc.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'kyc.php' ? 'active' : ''; ?>">
                        <i class="fas fa-id-card"></i> Verification
                    </a>
                    <?php endif; ?>
                    <a href="support.php" class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'support.php' ? 'active' : ''; ?>">
                        <i class="fas fa-headset"></i> Support
                    </a>
                </div>
                
                <!-- User menu -->
                <div class="d-none d-md-flex align-items-center gap-2">
                    <?php if (Security::isAuthenticated()): ?>
                        <?php if (Security::isAdmin()): ?>
                        <a href="admin/index.php" class="btn btn-outline-primary btn-sm">
                            <i class="fas fa-cog"></i> Admin
                        </a>
                        <?php endif; ?>
                        <div class="dropdown" style="position: relative;">
                            <button class="btn btn-outline-primary dropdown-toggle" onclick="toggleUserMenu()">
                                <i class="fas fa-user"></i>
                                <span><?php echo $_SESSION['username']; ?></span>
                                <i class="fas fa-chevron-down" style="font-size: 10px;"></i>
                            </button>
                            <div id="userDropdown" class="dropdown-menu" style="display: none; position: absolute; right: 0; top: 100%; background: white; border: 1px solid var(--border-color); border-radius: var(--border-radius); box-shadow: var(--shadow-lg); min-width: 200px; z-index: 1000;">
                                <a href="profile.php" class="dropdown-item" style="display: block; padding: 12px 16px; color: var(--text-primary); text-decoration: none; border-bottom: 1px solid var(--border-color);">
                                    <i class="fas fa-user-edit"></i> Profile Settings
                                </a>
                                <a href="security.php" class="dropdown-item" style="display: block; padding: 12px 16px; color: var(--text-primary); text-decoration: none; border-bottom: 1px solid var(--border-color);">
                                    <i class="fas fa-shield-alt"></i> Security
                                </a>
                                <a href="transactions.php" class="dropdown-item" style="display: block; padding: 12px 16px; color: var(--text-primary); text-decoration: none; border-bottom: 1px solid var(--border-color);">
                                    <i class="fas fa-history"></i> Transaction History
                                </a>
                                <a href="logout.php" class="dropdown-item" style="display: block; padding: 12px 16px; color: var(--danger-color); text-decoration: none;">
                                    <i class="fas fa-sign-out-alt"></i> Logout
                                </a>
                            </div>
                        </div>
                    <?php else: ?>
                        <a href="login.php" class="btn btn-outline-primary">
                            <i class="fas fa-sign-in-alt"></i> Login
                        </a>
                        <a href="register.php" class="btn btn-primary">
                            <i class="fas fa-user-plus"></i> Register
                        </a>
                    <?php endif; ?>
                </div>
            </div>
            
            <!-- Mobile menu -->
            <div id="mobileMenu" class="d-md-none" style="display: none; border-top: 1px solid var(--border-color); padding: 20px 0;">
                <div style="display: flex; flex-direction: column; gap: 0;">
                    <a href="index.php" class="nav-link">
                        <i class="fas fa-home"></i> Home
                    </a>
                    <?php if (Security::isAuthenticated()): ?>
                    <a href="dashboard.php" class="nav-link">
                        <i class="fas fa-tachometer-alt"></i> Dashboard
                    </a>
                    <a href="wallet.php" class="nav-link">
                        <i class="fas fa-wallet"></i> Wallet
                    </a>
                    <a href="trading.php" class="nav-link">
                        <i class="fas fa-exchange-alt"></i> Trading
                    </a>
                    <a href="markets.php" class="nav-link">
                        <i class="fas fa-chart-line"></i> Markets
                    </a>
                    <a href="kyc.php" class="nav-link">
                        <i class="fas fa-id-card"></i> Verification
                    </a>
                    <?php if (Security::isAdmin()): ?>
                    <a href="admin/index.php" class="nav-link">
                        <i class="fas fa-cog"></i> Admin
                    </a>
                    <?php endif; ?>
                    <div style="border-top: 1px solid var(--border-color); margin: 10px 0;"></div>
                    <a href="profile.php" class="nav-link">
                        <i class="fas fa-user-edit"></i> Profile
                    </a>
                    <a href="security.php" class="nav-link">
                        <i class="fas fa-shield-alt"></i> Security
                    </a>
                    <a href="logout.php" class="nav-link" style="color: var(--danger-color) !important;">
                        <i class="fas fa-sign-out-alt"></i> Logout
                    </a>
                    <?php else: ?>
                    <a href="login.php" class="nav-link">
                        <i class="fas fa-sign-in-alt"></i> Login
                    </a>
                    <a href="register.php" class="nav-link">
                        <i class="fas fa-user-plus"></i> Register
                    </a>
                    <?php endif; ?>
                    <a href="support.php" class="nav-link">
                        <i class="fas fa-headset"></i> Support
                    </a>
                </div>
            </div>
        </div>
    </nav>








<footer class="bg-gray-900 text-white py-12 mt-16">
    <div class="container mx-auto px-4">
        <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
            <div class="col-span-1 md:col-span-2">
                <div class="flex items-center space-x-2 text-2xl font-bold text-blue-400 mb-4">
                    <i class="fas fa-coins"></i>
                    <span>CryptoExchange Pro</span>
                </div>
                <p class="text-gray-300 mb-6 max-w-md">
                    Secure and reliable cryptocurrency exchange platform with advanced P2P trading features, 
                    escrow protection, and comprehensive KYC verification.
                </p>
                <div class="flex space-x-4">
                    <a href="#" class="text-gray-400 hover:text-blue-400 transition-colors duration-200">
                        <i class="fab fa-twitter text-xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-blue-400 transition-colors duration-200">
                        <i class="fab fa-facebook text-xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-blue-400 transition-colors duration-200">
                        <i class="fab fa-telegram text-xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-blue-400 transition-colors duration-200">
                        <i class="fab fa-discord text-xl"></i>
                    </a>
                </div>
            </div>
            
            <div>
                <h3 class="text-lg font-semibold text-white mb-4">Quick Links</h3>
                <ul class="space-y-2">
                    <li><a href="knowledge.php" class="text-gray-300 hover:text-blue-400 transition-colors duration-200">Knowledge Base</a></li>
                    <li><a href="#" class="text-gray-300 hover:text-blue-400 transition-colors duration-200">API Documentation</a></li>
                    <li><a href="#" class="text-gray-300 hover:text-blue-400 transition-colors duration-200">Terms of Service</a></li>
                    <li><a href="#" class="text-gray-300 hover:text-blue-400 transition-colors duration-200">Privacy Policy</a></li>
                    <li><a href="#" class="text-gray-300 hover:text-blue-400 transition-colors duration-200">Support Center</a></li>
                </ul>
            </div>
            
            <div>
                <h3 class="text-lg font-semibold text-white mb-4">Security Features</h3>
                <ul class="space-y-2">
                    <li class="flex items-center text-gray-300">
                        <i class="fas fa-shield-alt text-green-400 mr-2"></i>
                        SSL Encryption
                    </li>
                    <li class="flex items-center text-gray-300">
                        <i class="fas fa-lock text-green-400 mr-2"></i>
                        2FA Protection
                    </li>
                    <li class="flex items-center text-gray-300">
                        <i class="fas fa-key text-green-400 mr-2"></i>
                        Cold Storage
                    </li>
                    <li class="flex items-center text-gray-300">
                        <i class="fas fa-eye text-green-400 mr-2"></i>
                        24/7 Monitoring
                    </li>
                    <li class="flex items-center text-gray-300">
                        <i class="fas fa-handshake text-green-400 mr-2"></i>
                        Escrow Protection
                    </li>
                </ul>
            </div>
        </div>
        
        <div class="border-t border-gray-800 mt-8 pt-8">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="text-gray-400 text-sm mb-4 md:mb-0">
                    &copy; <?php echo date('Y'); ?> CryptoExchange Pro. All rights reserved.
                </div>
                <div class="flex items-center space-x-6 text-sm text-gray-400">
                    <span>🌍 Available in 50+ countries</span>
                    <span>📱 Mobile apps coming soon</span>
                    <span>🔒 Bank-level security</span>
                </div>
            </div>
        </div>
        
        <!-- Trust indicators -->
        <div class="mt-8 pt-8 border-t border-gray-800">
            <div class="text-center">
                <p class="text-gray-400 text-sm mb-4">Trusted by thousands of traders worldwide</p>
                <div class="flex justify-center items-center space-x-8 opacity-60">
                    <div class="text-center">
                        <div class="text-2xl font-bold text-blue-400">99.9%</div>
                        <div class="text-xs text-gray-500">Uptime</div>
                    </div>
                    <div class="text-center">
                        <div class="text-2xl font-bold text-green-400">$50M+</div>
                        <div class="text-xs text-gray-500">Volume</div>
                    </div>
                    <div class="text-center">
                        <div class="text-2xl font-bold text-yellow-400">10K+</div>
                        <div class="text-xs text-gray-500">Users</div>
                    </div>
                    <div class="text-center">
                        <div class="text-2xl font-bold text-purple-400">24/7</div>
                        <div class="text-xs text-gray-500">Support</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</footer>

<!-- JavaScript -->
 <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>
