<?php
require_once __DIR__ . '/lang.php';

// Also fetch contact info if $pdo is available
$_topbar_phone   = $t['topbar_phone'];
$_topbar_email   = $t['topbar_email'];
$_topbar_address = $t['topbar_address'];

$isRTL = ($t['dir'] === 'rtl');

$bootstrapCSS = $isRTL
    ? 'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.rtl.min.css'
    : 'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css';
// Note: integrity attributes removed to avoid SRI mismatch on local dev.

// Preserve current lang in nav links
$langParam = '?lang=' . $t['lang'];
?>
<!DOCTYPE html>
<html lang="<?php echo $t['lang']; ?>" dir="<?php echo $t['dir']; ?>">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>VAULTIXAI – <?php echo $isRTL ? 'خدمات إتلاف البيانات الآمنة' : 'Secure Data Destruction Services'; ?></title>
    <meta name="description" content="<?php echo $isRTL ? 'VAULTIXAI – خدمات إتلاف البيانات الآمنة في العراق والأردن والشرق الأوسط.' : 'VAULTIXAI – Secure data destruction services in Iraq, Jordan & the Middle East.'; ?>">
    <!-- Favicon -->
    <link rel="icon" type="image/png" href="assets/img/vous.png">
    <!-- Bootstrap 5 CSS (RTL/LTR auto-switch) -->
    <link rel="stylesheet" href="<?php echo $bootstrapCSS; ?>" crossorigin="anonymous">
    <!-- Google Fonts -->
    <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=Cairo:wght@300;400;600;800&family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
    <!-- Bootstrap Icons -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
    <!-- Lightbox2 CSS -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.4/css/lightbox.min.css" rel="stylesheet" />
    <!-- Custom Style -->
    <link rel="stylesheet" href="assets/css/style.css">
    <script>
        // Apply theme ASAP to prevent FOUC (Flash of Unstyled Content)
        const storedTheme = localStorage.getItem('theme') || 'light';
        document.documentElement.setAttribute('data-theme', storedTheme);
    </script>
</head>
<body>

<!-- Page Loader -->
<div id="page-loader">
    <div class="spinner-logo-container">
        <img src="assets/img/vous.png" alt="VAULTIXAI Logo" class="spinner-logo">
    </div>
</div>

<!-- Top Info Bar -->
<div class="topinfo-bar">
    <div class="container">
        <div class="d-flex justify-content-between align-items-center flex-wrap gap-2">
            <!-- Right Item -->
            <span class="text-white-50 small" dir="ltr">
                <?php echo $t['topbar_address']; ?>
            </span>
            <!-- Center Item -->
            <a href="tel:+9647773517004" class="text-white-50 text-decoration-none small" dir="ltr">
                <?php echo $t['topbar_phone']; ?>
            </a>
            <!-- Left Item -->
            <a href="mailto:info@vaultixai.com" class="text-white-50 text-decoration-none small">
                <?php echo $t['topbar_email']; ?>
            </a>
        </div>
    </div>
</div>

<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-light sticky-top navbar-custom">
    <div class="container">
        <a class="navbar-brand" href="index.php<?php echo $langParam; ?>">
            <img src="assets/img/vous.png" alt="VAULTIXAI">
        </a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                <li class="nav-item">
                    <a class="nav-link" href="index.php<?php echo $langParam; ?>"><?php echo $t['nav_home']; ?></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="about.php<?php echo $langParam; ?>"><?php echo $t['nav_about']; ?></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="services.php<?php echo $langParam; ?>"><?php echo $t['nav_services']; ?></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="certifications.php<?php echo $langParam; ?>"><?php echo $t['nav_certifications']; ?></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="contact.php<?php echo $langParam; ?>"><?php echo $t['nav_contact']; ?></a>
                </li>
            </ul>
            <div class="d-flex align-items-center ms-lg-3 gap-2">
                <button id="theme-toggle" class="theme-toggle-btn" title="Toggle dark/light mode" aria-label="Toggle theme">
                    <span class="theme-icon">🌙</span>
                </button>
                <a href="<?php echo lang_switch_url($t['lang_switch_code']); ?>" class="lang-switcher-btn text-decoration-none">
                    🌐 <?php echo $t['lang_switch_label']; ?>
                </a>
            </div>
        </div>
    </div>
</nav>
