
 <?php
session_start();
include '../functions.php';
if (!isset($_SESSION['user_id'])) {
    header("Location: ../login");
    exit();
}
if (empty($_SESSION['pin_verified'])) {
    header("Location: pin");
    exit();
}
$_n = explode(' ', $_SESSION['fullname'] ?? '');
$_user_initials = strtoupper(($_n[0][0] ?? '') . ($_n[1][0] ?? ''));

// Always re-read currency from DB so admin changes reflect immediately
$_db_currency = getUserDetails('currency', $_SESSION['email'] ?? '');
if (!empty($_db_currency) && $_db_currency !== ($_SESSION['currency'] ?? '')) {
    $_SESSION['currency'] = $_db_currency;
}
$_curr_sym = currencySymbol($_SESSION['currency'] ?? 'USD');

// Check if transactions are allowed for this user
$_allow_tx_q = $conn->prepare("SELECT allowTransactions FROM users WHERE email = ? LIMIT 1");
$_allow_transactions = false;
if ($_allow_tx_q) {
    $_allow_tx_email = $_SESSION['email'] ?? '';
    $_allow_tx_q->bind_param('s', $_allow_tx_email);
    $_allow_tx_q->execute();
    $_allow_tx_row = $_allow_tx_q->get_result()->fetch_assoc();
    $_allow_tx_q->close();
    $_allow_transactions = (($_allow_tx_row['allowTransactions'] ?? 'No') === 'Yes');
}

// Profile picture — resolve path with fallback to default
$_profile_img_file = getUserDetails('profile_img', $_SESSION['email'] ?? '');
$_profile_img_path = '../uploads/profile_pictures/' . ($_profile_img_file ?: 'default.jpg');
$_profile_img_url  = htmlspecialchars($_profile_img_path);
$_current_page = basename($_SERVER['PHP_SELF'], '.php');

// KYC status for dropdown badge
$_kyc_status = null;
$_kyc_chk = $conn->query("SHOW TABLES LIKE 'kyc_submissions'");
if ($_kyc_chk && $_kyc_chk->num_rows > 0) {
    $_ks = $conn->prepare("SELECT status FROM kyc_submissions WHERE user_email = ? ORDER BY id DESC LIMIT 1");
    $_ks->bind_param('s', $_SESSION['email']);
    $_ks->execute();
    $_ks_row = $_ks->get_result()->fetch_assoc();
    $_ks->close();
    $_kyc_status = $_ks_row['status'] ?? null;
}

// Ensure is_read column exists on support_replies (runs once, safe on all MySQL versions)
$_col = $conn->query("SHOW COLUMNS FROM support_replies LIKE 'is_read'");
if ($_col && $_col->num_rows === 0) {
    $conn->query("ALTER TABLE support_replies ADD COLUMN is_read TINYINT(1) NOT NULL DEFAULT 0");
}

// Fetch recent admin replies (read + unread) for notification bell
$_notif_rows  = [];
$_notif_count = 0;
$_notif_email = $_SESSION['email'] ?? '';
if ($_notif_email) {
    $_nq = $conn->prepare("
        SELECT sr.id, sr.message, sr.date_added, sr.is_read, st.subject
        FROM support_replies sr
        JOIN support_tickets st ON st.id = sr.ticket_id
        WHERE st.user_email = ? AND sr.sender = 'admin'
        ORDER BY sr.is_read ASC, sr.date_added DESC LIMIT 3
    ");
    if ($_nq) {
        $_nq->bind_param('s', $_notif_email);
        $_nq->execute();
        $_notif_rows  = $_nq->get_result()->fetch_all(MYSQLI_ASSOC);
        $_nq->close();
        $_notif_count = count(array_filter($_notif_rows, fn($r) => !$r['is_read']));
    }
}

function _navA($page) {
    global $_current_page;
    return $_current_page === $page
        ? 'group flex items-center px-4 py-3 text-sm font-medium rounded-2xl transition-all duration-200 bg-gradient-to-r from-primary-500 to-primary-600 text-white shadow-lg shadow-primary-500/25'
        : 'group flex items-center px-4 py-3 text-sm font-medium rounded-2xl transition-all duration-200 text-gray-600 dark:text-gray-300 hover:bg-primary-50 dark:hover:bg-gray-800 hover:text-primary-700 dark:hover:text-primary-400';
}
function _navIcon($page) {
    global $_current_page;
    return $_current_page === $page
        ? 'w-10 h-10 rounded-xl flex items-center justify-center mr-4 bg-white/20 transition-colors'
        : 'w-10 h-10 rounded-xl flex items-center justify-center mr-4 bg-gray-100 dark:bg-gray-800 group-hover:bg-primary-100 dark:group-hover:bg-gray-700 transition-colors';
}
function _navI($page) {
    global $_current_page;
    return $_current_page === $page
        ? 'text-white transition-colors'
        : 'text-gray-500 dark:text-gray-400 group-hover:text-primary-600 dark:group-hover:text-primary-400 transition-colors';
}
function _navDot($page) {
    global $_current_page;
    return $_current_page === $page
        ? '<div class="ml-auto w-2 h-2 bg-white dark:bg-gray-300 rounded-full"></div>'
        : '';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <?php
    if (session_status() === PHP_SESSION_NONE) { session_start(); }
    if (empty($_SESSION['csrf_token'])) { $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); }
    ?>
    <meta name="csrf-token" content="<?php echo htmlspecialchars($_SESSION['csrf_token']); ?>">
    <title><?php echo getSiteConfig('sitename'); ?> | Customer Dashboard</title>
    <meta name="description" content="Swift and Secure Money Transfer to any UK bank account will become a breeze with <?php echo getSiteConfig('sitename'); ?>." />
    <link rel="shortcut icon" href="../storage/app/public/photos/JFhHkiuNvOTfUR5bSTcRhJrlW2nXDFpq3s6DoadO.png">
    <link rel="icon" type="image/png" href="../storage/app/public/photos/JFhHkiuNvOTfUR5bSTcRhJrlW2nXDFpq3s6DoadO.png">
    
    <!-- Tailwind CSS with custom color variables -->
    <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp"></script>
    <script>
        tailwind.config = {
            darkMode: 'class',
            theme: {
                extend: {
                    colors: {
                        primary: { // Dynamic primary colors from appearance settings
                            50: '#f0f9ff',
                            100: '#e0f2fe',
                            200: '#bae6fd',
                            300: '#7dd3fc',
                            400: '#38bdf8',
                            DEFAULT: '#0ea5e9',
                            500: '#0ea5e9',
                            600: '#0284c7',
                            700: '#0369a1',
                            foreground: '#ffffff',
                        },
                        secondary: { // Dynamic secondary colors from appearance settings
                            50: '#f8fafc',
                            100: '#f1f5f9',
                            200: '#e2e8f0',
                            300: '#cbd5e1',
                            400: '#94a3b8',
                            DEFAULT: '#64748b',
                            500: '#64748b',
                            600: '#475569',
                            700: '#334155',
                            foreground: '#0f172a',
                        },
                        accent: { // Dynamic accent colors from appearance settings
                            50: '#fdf2f8',
                            100: '#fce7f3',
                            200: '#fbcfe8',
                            300: '#f9a8d4',
                            400: '#f472b6',
                            DEFAULT: '#ec4899',
                            500: '#ec4899',
                            600: '#db2777',
                            700: '#be185d',
                            foreground: '#ffffff',
                        },
                        background: '#f8fafc',
                        foreground: '#1e293b',
                        card: {
                            DEFAULT: '#ffffff',
                            foreground: '#1e293b',
                        },
                        muted: {
                            DEFAULT: '#f1f5f9',
                            foreground: '#64748b',
                        },
                        border: '#e2e8f0',
                        input: '#e2e8f0',
                        ring: '#0ea5e9',
                        
                        // Specific colors from original design for gradients/highlights
                        'gradient-pink-from': '#ec4899',
                        'gradient-purple-via': '#a855f7',
                        'gradient-indigo-to': '#4f46e5',
                        
                        'mobile-header-bg': '#1e293b', // Dark slate for mobile top section
                        'mobile-header-text': '#f1f5f9', // Light text for mobile top section
                        
                        'yellow-action': '#facc15',
                        'green-positive': '#22c55e',
                        'red-negative': '#ef4444',
                    },
                    boxShadow: {
                        'soft': '0 2px 15px -3px rgba(0, 0, 0, 0.07), 0 10px 20px -2px rgba(0, 0, 0, 0.04)',
                        'top': '0 -4px 12px -1px rgba(0,0,0,0.05), 0 -2px 8px -1px rgba(0,0,0,0.03)',
                    },
                    borderRadius: {
                        lg: '0.75rem',
                        xl: '0.75rem', 
                        '2xl': '1rem',
                        '3xl': '1.5rem',
                    },
                    keyframes: {
                        pulse: {
                          '0%, 100%': { transform: 'scale(1)', boxShadow: '0 0 0 0 rgba(14, 165, 233, 0.4)' }, // primary color
                          '50%': { transform: 'scale(1.05)', boxShadow: '0 0 0 10px rgba(14, 165, 233, 0)' },
                        },
                        shine: { 
                          '0%': { transform: 'translateX(-100%) translateY(-100%) rotate(45deg)' },
                          '100%': { transform: 'translateX(100%) translateY(100%) rotate(45deg)' },
                        }
                    },
                    animation: {
                        'pulse-slow': 'pulse 2.5s infinite',
                        'shine-once': 'shine 1.5s ease-in-out',
                    }
                }
            }
        }
    </script>
    
        
        
    <!-- SweetAlert2 -->
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <!-- Alpine.js -->
    <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
    
    <!-- jQuery CDN -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

    <!-- Chart.js CDN -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    
    <!-- Font Awesome 6 Pro -->
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/aquawolf04/font-awesome-pro@5cd1511/css/all.css">
    
    <!-- External 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=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet">
    
    <style>
        body {
            font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: theme('colors.background');
            color: theme('colors.foreground');
        }

        ::-webkit-scrollbar { width: 8px; height: 8px; }
        ::-webkit-scrollbar-track { background: #e2e8f0; } /* slate-200 */
        ::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; } /* slate-400 */
        ::-webkit-scrollbar-thumb:hover { background: #64748b; } /* slate-500 */

        .dark ::-webkit-scrollbar-track { background: #374151; } /* gray-700 */
        .dark ::-webkit-scrollbar-thumb { background: #6b7280; } /* gray-500 */
        .dark ::-webkit-scrollbar-thumb:hover { background: #9ca3af; } /* gray-400 */

        .custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
        .custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
        .custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; } /* slate-300 */
        .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; } /* slate-400 */

        .dark .custom-scrollbar::-webkit-scrollbar-thumb { background: #6b7280; } /* gray-500 */
        .dark .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #9ca3af; } /* gray-400 */

        .shine-effect-container { position: relative; overflow: hidden; }
        .shine-effect {
            position: absolute; top: -50%; left: -50%;
            width: 200%; height: 200%;
            background-image: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0) 100%);
            transform: rotate(45deg); opacity: 0; transition: opacity 0.5s;
        }
        .shine-effect-container:hover .shine-effect { opacity: 1; animation: shine-once 1.5s ease-in-out; }

        .fade-in-section { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
        .fade-in-section.is-visible { opacity: 1; transform: translateY(0); }
    </style>
    
    <!-- Ultra Modern Loading Animation -->
    <style>
        .page-loading {
            position: fixed;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 100%;
            transition: all .6s cubic-bezier(0.4, 0, 0.2, 1);
            background: radial-gradient(ellipse at center, rgba(14, 165, 233, 0.08) 0%, rgba(255, 255, 255, 0.95) 50%, rgba(255, 255, 255, 1) 100%);
            backdrop-filter: blur(2px);
            visibility: hidden;
            z-index: 9999;
        }
        
        .dark .page-loading {
            background: radial-gradient(ellipse at center, rgba(14, 165, 233, 0.12) 0%, rgba(17, 24, 39, 0.95) 50%, rgba(17, 24, 39, 1) 100%);
        }
        .page-loading.active {
            opacity: 1;
            visibility: visible;
        }
        .page-loading-inner {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            transition: all .4s cubic-bezier(0.4, 0, 0.2, 1);
            opacity: 0;
        }
        .page-loading.active>.page-loading-inner {
            opacity: 1;
        }
        
        .loading-container {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            position: relative;
        }
        
        /* Floating particles background */
        .loading-particles {
            position: absolute;
            width: 300px;
            height: 300px;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
        }
        
        .particle {
            position: absolute;
            width: 4px;
            height: 4px;
            background: linear-gradient(45deg, #0ea5e9, #4f46e5);
            border-radius: 50%;
            opacity: 0.6;
            animation: floatParticle 4s ease-in-out infinite;
        }
        
        .particle:nth-child(1) { top: 20%; left: 20%; animation-delay: 0s; }
        .particle:nth-child(2) { top: 80%; left: 80%; animation-delay: 0.5s; }
        .particle:nth-child(3) { top: 60%; left: 20%; animation-delay: 1s; }
        .particle:nth-child(4) { top: 30%; left: 70%; animation-delay: 1.5s; }
        .particle:nth-child(5) { top: 70%; left: 30%; animation-delay: 2s; }
        .particle:nth-child(6) { top: 10%; left: 60%; animation-delay: 2.5s; }
        
        .loading-animation {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 120px;
            height: 120px;
            margin-bottom: 2rem;
            position: relative;
            filter: drop-shadow(0 0 20px rgba(14, 165, 233, 0.2));
        }
        
        /* Outer orbital rings */
        .loading-animation .orbit-ring {
            position: absolute;
            border-radius: 50%;
            border: 2px solid rgba(14, 165, 233, 0.2);
            animation: rotateOrbit 8s linear infinite;
        }
        
        .orbit-ring:nth-child(1) {
            width: 100%;
            height: 100%;
            border-top: 2px solid #0ea5e9;
            border-right: 2px solid rgba(14, 165, 233, 0.3);
            animation-duration: 2s;
        }
        
        .orbit-ring:nth-child(2) {
            width: 80%;
            height: 80%;
            top: 10%;
            left: 10%;
            border-bottom: 2px solid #0ea5e9;
            border-left: 2px solid rgba(14, 165, 233, 0.3);
            animation-duration: 2.5s;
            animation-direction: reverse;
        }
        
        .orbit-ring:nth-child(3) {
            width: 60%;
            height: 60%;
            top: 20%;
            left: 20%;
            border-top: 2px solid #0ea5e9;
            border-right: 2px solid rgba(14, 165, 233, 0.3);
            animation-duration: 3s;
        }
        
        /* Inner spinning circles */
        .loading-animation .inner-circle {
            position: absolute;
            width: 15px;
            height: 15px;
            border-radius: 50%;
            background: #0ea5e9;
            box-shadow: 0 0 10px rgba(14, 165, 233, 0.6);
            animation: spinInner 2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
        }
        
        .inner-circle:nth-child(4) {
            border-top: 3px solid #0ea5e9;
            border-right: 3px solid rgba(14, 165, 233, 0.4);
            animation-delay: 0s;
        }
        
        .inner-circle:nth-child(5) {
            border-bottom: 3px solid #0ea5e9;
            border-left: 3px solid rgba(14, 165, 233, 0.4);
            animation-delay: 0.3s;
            animation-direction: reverse;
        }
        
        /* Glowing core with morphing effect */
        .loading-animation .core {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: linear-gradient(45deg, #0ea5e9, #4f46e5);
            background-size: 200% 200%;
            box-shadow: 
                0 0 20px rgba(14, 165, 233, 0.6),
                0 0 40px rgba(14, 165, 233, 0.3),
                inset 0 0 10px rgba(255, 255, 255, 0.3);
            animation: coreGlow 2s ease-in-out infinite, morphCore 4s ease-in-out infinite;
        }
        
        /* Enhanced text with multiple effects */
        .page-loading .text {
            font-weight: 700;
            letter-spacing: 0.1em;
            margin-top: 1.5rem;
            font-size: 1.1rem;
            position: relative;
            background: linear-gradient(90deg, #0ea5e9, #0ea5e9, #4f46e5, #0ea5e9, #0ea5e9);
            background-size: 300% auto;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            animation: textShimmer 3s linear infinite;
            text-shadow: 0 0 30px rgba(14, 165, 233, 0.3);
        }
        
        .page-loading .text::before {
            content: '';
            position: absolute;
            top: -2px;
            left: -2px;
            right: -2px;
            bottom: -2px;
            background: linear-gradient(45deg, transparent, rgba(14, 165, 233, 0.1), transparent);
            border-radius: 4px;
            z-index: -1;
            animation: textGlow 2s ease-in-out infinite alternate;
        }
        
        /* Subtitle with fade effect */
        .page-loading .subtitle {
            font-size: 0.75rem;
            color: #64748b;
            font-weight: 500;
            margin-top: 0.5rem;
            letter-spacing: 0.05em;
            animation: subtitleFade 2s ease-in-out infinite;
        }
        
        /* Progress indicator */
        .loading-progress {
            width: 200px;
            height: 2px;
            background: #f1f5f9;
            border-radius: 1px;
            margin-top: 1.5rem;
            overflow: hidden;
            position: relative;
        }
        
        .loading-progress::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, #0ea5e9, transparent);
            animation: progressSlide 2s ease-in-out infinite;
        }
        
        /* Keyframe animations */
        @keyframes  floatParticle {
            0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.6; }
            50% { transform: translateY(-20px) rotate(180deg); opacity: 1; }
        }
        
        @keyframes  rotateOrbit {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        @keyframes  spinInner {
            0% { transform: rotate(0deg) scale(1); }
            50% { transform: rotate(180deg) scale(1.1); }
            100% { transform: rotate(360deg) scale(1); }
        }
        
        @keyframes  coreGlow {
            0% { 
                transform: translate(-50%, -50%) scale(0.8); 
                box-shadow: 
                    0 0 20px rgba(14, 165, 233, 0.6),
                    0 0 40px rgba(14, 165, 233, 0.3),
                    inset 0 0 10px rgba(255, 255, 255, 0.3);
            }
            100% {
                transform: translate(-50%, -50%) scale(1.2); 
                box-shadow: 
                    0 0 30px rgba(14, 165, 233, 0.8),
                    0 0 60px rgba(14, 165, 233, 0.4),
                    inset 0 0 15px rgba(255, 255, 255, 0.5);
            }
        }
        
        @keyframes  morphCore {
            0%, 100% { border-radius: 50%; background-position: 0% 50%; }
            25% { border-radius: 40%; background-position: 100% 50%; }
            50% { border-radius: 30%; background-position: 0% 50%; }
            75% { border-radius: 40%; background-position: 100% 50%; }
        }
        
        @keyframes  textShimmer {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }
        
        @keyframes  textGlow {
            0% { opacity: 0.3; }
            100% { opacity: 0.7; }
        }
        
        @keyframes  subtitleFade {
            0%, 100% { opacity: 0.5; transform: translateY(0px); }
            50% { opacity: 1; transform: translateY(-2px); }
        }
        
        @keyframes  progressSlide {
            0% { left: -100%; }
            50% { left: 0%; }
            100% { left: 100%; }
        }
        
        /* Custom scrollbar */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        
        ::-webkit-scrollbar-track {
            background: #f1f5f9;
        }
        
        .dark ::-webkit-scrollbar-track {
            background: #374151;
        }
        
        ::-webkit-scrollbar-thumb {
            background: #cbd5e1;
            border-radius: 4px;
        }
        
        .dark ::-webkit-scrollbar-thumb {
            background: #6b7280;
        }
        
        ::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
        }
        
        .dark ::-webkit-scrollbar-thumb:hover {
            background: #9ca3af;
        }
    </style>

    <script>
        const allowTransactions = <?php echo $_allow_transactions ? 'true' : 'false'; ?>;
        const _txFullname  = <?php echo json_encode($_SESSION['fullname'] ?? 'Customer'); ?>;
        const _txSiteMail  = <?php echo json_encode(getSiteConfig('sitemail') ?? ''); ?>;

        function requireTransactionAccess() {
            if (allowTransactions) return true;
            Swal.fire({
                icon: 'error',
                title: 'Account Restricted',
                html: `Dear <strong>${_txFullname}</strong>,<br><br>
Your account has been temporarily restricted due to unusual activities detected from an unrecognised location.
For your security, all outgoing transfers have been suspended.<br><br>
Please contact Support via <a href="mailto:${_txSiteMail}" style="color:#0ea5e9;text-decoration:underline;">${_txSiteMail}</a>
or <a href="support" style="color:#0ea5e9;text-decoration:underline;">send a Support Ticket</a>.`,
                confirmButtonText: 'OK',
                confirmButtonColor: '#0ea5e9',
                allowOutsideClick: false,
                width: '480px',
            }).then(() => {
                window.location.href = 'index';
            });
            return false;
        }
    </script>

    <!-- Google Translate Widget -->
    <script>
        function googleTranslateElementInit() {
            try {
                new google.translate.TranslateElement({
                    pageLanguage: 'en',
                    includedLanguages: 'en,es,fr,de,it,pt,ru,zh-CN,ja,ko,ar',
                    layout: google.translate.TranslateElement.SIMPLE
                }, 'google_translate_element');
            } catch(e) {}
        }
    </script>
    <script src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    <style>
        .goog-te-banner-frame { display: none !important; }
        body { top: 0 !important; }
        #google_translate_element { display: none !important; }
.language-bar-container {
            position: fixed;
            right: 0;
            top: 0;
            bottom: 0;
            width: 120px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            padding: 12px 10px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            box-shadow: -4px 0 15px rgba(0, 0, 0, 0.2);
            z-index: 9999999;
            transform: translateX(100%);
            transition: transform 0.4s ease;
        }
        .language-bar-container.show { transform: translateX(0); }
        .language-bar-scroll {
            display: flex;
            flex-direction: column;
            gap: 6px;
            flex: 1;
            overflow-y: auto;
            padding: 10px 0;
            scroll-behavior: smooth;
            width: 100%;
        }
        .language-bar-scroll::-webkit-scrollbar { width: 4px; }
        .language-bar-scroll::-webkit-scrollbar-track { background: rgba(255,255,255,0.1); border-radius: 10px; }
        .language-bar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 10px; }
        .language-bar-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.5); }
        .lang-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 4px;
            padding: 8px 6px;
            background: rgba(255,255,255,0.15);
            color: white;
            text-decoration: none;
            border-radius: 6px;
            font-size: 11px;
            font-weight: 600;
            white-space: nowrap;
            transition: all 0.2s ease;
            border: 2px solid transparent;
            width: 100%;
            text-align: center;
            cursor: pointer;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .lang-btn:hover { background: rgba(255,255,255,0.3); transform: translateX(-3px); }
        .lang-btn.active { background: rgba(255,255,255,0.25); border-color: white; box-shadow: 0 0 8px rgba(255,255,255,0.5); }
.lang-close {
            background: rgba(255,255,255,0.2);
            color: white;
            border: none;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            margin-top: auto;
        }
        .lang-close:hover { background: rgba(255,255,255,0.3); }
    </style>
    </head>

<body class="bg-background text-foreground">
    <div id="google_translate_element" style="display:none;"></div>

    <!-- Language Selection Bar -->
    <div class="language-bar-container" id="languageBar">
        <div class="language-bar-scroll">
            <a href="javascript:void(0)" onclick="selectLanguage('en');" class="lang-btn active"><span>🇬🇧</span> English</a>
            <a href="javascript:void(0)" onclick="selectLanguage('es');" class="lang-btn"><span>🇪🇸</span> Spanish</a>
            <a href="javascript:void(0)" onclick="selectLanguage('fr');" class="lang-btn"><span>🇫🇷</span> French</a>
            <a href="javascript:void(0)" onclick="selectLanguage('de');" class="lang-btn"><span>🇩🇪</span> German</a>
            <a href="javascript:void(0)" onclick="selectLanguage('it');" class="lang-btn"><span>🇮🇹</span> Italian</a>
            <a href="javascript:void(0)" onclick="selectLanguage('pt');" class="lang-btn"><span>🇵🇹</span> Portuguese</a>
            <a href="javascript:void(0)" onclick="selectLanguage('ru');" class="lang-btn"><span>🇷🇺</span> Russian</a>
            <a href="javascript:void(0)" onclick="selectLanguage('zh-CN');" class="lang-btn"><span>🇨🇳</span> Chinese</a>
            <a href="javascript:void(0)" onclick="selectLanguage('ja');" class="lang-btn"><span>🇯🇵</span> Japanese</a>
            <a href="javascript:void(0)" onclick="selectLanguage('ko');" class="lang-btn"><span>🇰🇷</span> Korean</a>
            <a href="javascript:void(0)" onclick="selectLanguage('ar');" class="lang-btn"><span>🇸🇦</span> Arabic</a>
        </div>
        <button class="lang-close" onclick="closeLanguageBar();">✕</button>
    </div>

    <!-- Ultra Modern Page Loader -->
    <div class="page-loading active">
        <div class="page-loading-inner">
            <div class="loading-container">
                <!-- Floating particles background -->
                <div class="loading-particles">
                    <div class="particle"></div>
                    <div class="particle"></div>
                    <div class="particle"></div>
                    <div class="particle"></div>
                    <div class="particle"></div>
                    <div class="particle"></div>
                </div>
                
                <!-- Main loading animation -->
                <div class="loading-animation">
                    <!-- Outer orbital rings -->
                    <div class="orbit-ring"></div>
                    <div class="orbit-ring"></div>
                    <div class="orbit-ring"></div>
                    
                    <!-- Inner spinning circles -->
                    <div class="inner-circle"></div>
                    <div class="inner-circle"></div>
                    
                    <!-- Morphing glowing core -->
                    <div class="core"></div>
                </div>
                
                <!-- Enhanced text with effects -->
                <div class="text"><?php echo getSiteConfig('sitename'); ?></div>
                <div class="subtitle">Secure Banking Platform</div>
            </div>
        </div>
    </div>
    
    
    <div x-data="{ 
        sidebarOpen: false,
        mobileMenuOpen: false,
        notificationOpen: false,
        userDropdownOpen: false,
        currentRoute: 'dashboard',
        darkMode: localStorage.getItem('darkMode') === 'true' || false,
        toggleSidebar() { this.sidebarOpen = !this.sidebarOpen; },
        closeSidebar() { this.sidebarOpen = false; },
        isActiveRoute(route) { return this.currentRoute === route; },
        toggleNotifications() { this.notificationOpen = !this.notificationOpen; this.userDropdownOpen = false; },
        toggleUserDropdown() { this.userDropdownOpen = !this.userDropdownOpen; this.notificationOpen = false; },
        closeDropdowns() { this.notificationOpen = false; this.userDropdownOpen = false; },
        toggleDarkMode() { 
            this.darkMode = !this.darkMode; 
            localStorage.setItem('darkMode', this.darkMode);
            if (this.darkMode) {
                document.documentElement.classList.add('dark');
            } else {
                document.documentElement.classList.remove('dark');
            }
        },
        initDarkMode() {
            if (this.darkMode) {
                document.documentElement.classList.add('dark');
            } else {
                document.documentElement.classList.remove('dark');
            }
        }
    }" 
    x-init="initDarkMode()"
    @click.away="closeDropdowns()"
    class="min-h-screen bg-gray-50 dark:bg-gray-900">

    <!-- Mobile sidebar backdrop -->
    <div class="lg:hidden fixed inset-0 bg-black/50 z-40"
         x-show="sidebarOpen" @click="sidebarOpen = false" style="display:none"></div>

                <!-- Desktop Layout -->
        <div class="flex h-screen">
            <!-- Sidebar (drawer on mobile, static on desktop) -->
            <div class="fixed lg:static inset-y-0 left-0 z-50 w-72 flex flex-col bg-white dark:bg-gray-900 border-r border-gray-200/50 dark:border-gray-700/50 shadow-xl transition-transform duration-300 lg:translate-x-0"
                 :class="sidebarOpen ? 'translate-x-0' : '-translate-x-full'">
                <!-- Logo Section -->
                <div class="p-6 border-b border-gray-200/50 dark:border-gray-700/50">
                    <div class="flex items-center space-x-3">
                        <div class="w-full">
                            <img src="../storage/app/public/photos/ll6Rkij7mMXTskezBsaz1LTT1rIvUOc63TqzmuC6.png" alt="<?php echo getSiteConfig('sitename'); ?>" class="h-12 w-auto">
                        </div>
                    </div>
                </div>

                <!-- Navigation -->
                <nav class="flex-1 px-4 py-6 space-y-6 overflow-y-auto custom-scrollbar">
                                                        
                                            <div class="mb-8">
                            <h3 class="text-xs font-bold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-4 px-4">Main</h3>
                            <div class="space-y-2">
                                <a href="index"
                                   class="<?php echo _navA('index'); ?>">
                                    <div class="<?php echo _navIcon('index'); ?>">
                                        <i class="fa-solid fa-house <?php echo _navI('index'); ?>"></i>
                                    </div>
                                    <span class="font-semibold">Dashboard</span>
                                    <?php echo _navDot('index'); ?>
                                </a>
                                <a href="accounthistory"
                                   class="<?php echo _navA('accounthistory'); ?>">
                                    <div class="<?php echo _navIcon('accounthistory'); ?>">
                                        <i class="fa-solid fa-chart-line <?php echo _navI('accounthistory'); ?>"></i>
                                    </div>
                                    <span class="font-semibold">Transactions</span>
                                    <?php echo _navDot('accounthistory'); ?>
                                </a>
                                <a href="cards"
                                   class="<?php echo _navA('cards'); ?>">
                                    <div class="<?php echo _navIcon('cards'); ?>">
                                        <i class="fa-solid fa-credit-card <?php echo _navI('cards'); ?>"></i>
                                    </div>
                                    <span class="font-semibold">Cards</span>
                                    <?php echo _navDot('cards'); ?>
                                </a>
                                                        </div>
                    </div>
                                            <div class="mb-8">
                            <h3 class="text-xs font-bold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-4 px-4">Transfers</h3>
                            <div class="space-y-2">
                                <a href="localtransfer"
                                   class="<?php echo _navA('localtransfer'); ?>">
                                    <div class="<?php echo _navIcon('localtransfer'); ?>">
                                        <i class="fa-solid fa-paper-plane <?php echo _navI('localtransfer'); ?>"></i>
                                    </div>
                                    <span class="font-semibold">Local Transfer</span>
                                    <?php echo _navDot('localtransfer'); ?>
                                </a>
                                <a href="internationaltransfer"
                                   class="<?php echo _navA('internationaltransfer'); ?>">
                                    <div class="<?php echo _navIcon('internationaltransfer'); ?>">
                                        <i class="fa-solid fa-globe <?php echo _navI('internationaltransfer'); ?>"></i>
                                    </div>
                                    <span class="font-semibold">International</span>
                                    <?php echo _navDot('internationaltransfer'); ?>
                                </a>
                                <a href="deposits"
                                   class="<?php echo _navA('deposits'); ?>">
                                    <div class="<?php echo _navIcon('deposits'); ?>">
                                        <i class="fa-solid fa-plus <?php echo _navI('deposits'); ?>"></i>
                                    </div>
                                    <span class="font-semibold">Deposit</span>
                                    <?php echo _navDot('deposits'); ?>
                                </a>
                                <a href="swap"
                                   class="<?php echo _navA('swap'); ?>">
                                    <div class="<?php echo _navIcon('swap'); ?>">
                                        <i class="fa-solid fa-arrows-rotate <?php echo _navI('swap'); ?>"></i>
                                    </div>
                                    <span class="font-semibold">Currency Swap</span>
                                    <?php echo _navDot('swap'); ?>
                                </a>
                                                        </div>
                    </div>
                                            <div class="mb-8">
                            <h3 class="text-xs font-bold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-4 px-4">Services</h3>
                            <div class="space-y-2">
                                <a href="loan"
                                   class="<?php echo _navA('loan'); ?>">
                                    <div class="<?php echo _navIcon('loan'); ?>">
                                        <i class="fa-solid fa-landmark <?php echo _navI('loan'); ?>"></i>
                                    </div>
                                    <span class="font-semibold">Loans</span>
                                    <?php echo _navDot('loan'); ?>
                                </a>
                                <a href="track"
                                   class="<?php echo _navA('irs-refund'); ?>">
                                    <div class="<?php echo _navIcon('irs-refund'); ?>">
                                        <i class="fa-solid fa-receipt <?php echo _navI('irs-refund'); ?>"></i>
                                    </div>
                                    <span class="font-semibold">Tax Refund</span>
                                    <?php echo _navDot('irs-refund'); ?>
                                </a>
                                <a href="grant-application"
                                   class="<?php echo _navA('grant-application'); ?>">
                                    <div class="<?php echo _navIcon('grant-application'); ?>">
                                        <i class="fa-solid fa-hand-holding-dollar <?php echo _navI('grant-application'); ?>"></i>
                                    </div>
                                    <span class="font-semibold">Grants</span>
                                    <?php echo _navDot('grant-application'); ?>
                                </a> 
                                                        </div>
                    </div>
                                            <div class="mb-8">
                            <h3 class="text-xs font-bold text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-4 px-4">Account</h3>
                            <div class="space-y-2">
                                <a href="account-settings"
                                   class="<?php echo _navA('account-settings'); ?>">
                                    <div class="<?php echo _navIcon('account-settings'); ?>">
                                        <i class="fa-solid fa-gear <?php echo _navI('account-settings'); ?>"></i>
                                    </div>
                                    <span class="font-semibold">Settings</span>
                                    <?php echo _navDot('account-settings'); ?>
                                </a>
                                <a href="support"
                                   class="<?php echo _navA('support'); ?>">
                                    <div class="<?php echo _navIcon('support'); ?>">
                                        <i class="fa-solid fa-headset <?php echo _navI('support'); ?>"></i>
                                    </div>
                                    <span class="font-semibold">Support</span>
                                    <?php echo _navDot('support'); ?>
                                </a>
                                                        </div>
                    </div>
                                    </nav>

     
                    
                <!-- User Profile Section -->
                <div class="p-4 border-t border-gray-200/50 dark:border-gray-700/50">
                    <div class="flex items-center space-x-4 p-4 rounded-2xl bg-gradient-to-r from-gray-50 to-gray-100 dark:from-gray-800 dark:to-gray-700 border border-gray-200/50 dark:border-gray-700/50">
                        <div class="relative">
                                                     <div class="h-10 w-10 rounded-full bg-primary-500 flex items-center justify-center text-white font-bold border-2 border-primary-100">
                <?php echo $_user_initials; ?>
            </div>
                                    <div class="absolute -bottom-1 -right-1 w-4 h-4 bg-green-500 rounded-full border-2 border-white dark:border-gray-600"></div>
                    </div>
                        <div class="flex-1 min-w-0">
                            <p class="text-sm font-bold text-gray-900 dark:text-white truncate"><?php echo htmlspecialchars(getUserDetails('username', $_SESSION['email']) ?: ''); ?> </p>
                            <p class="text-xs text-gray-500 dark:text-gray-400 truncate"><?php echo htmlspecialchars($_SESSION['email'] ?? ''); ?></p>
                </div>
                        <form method="POST" action="logout">
                            <input type="hidden" name="_token" value="7Y8Vjj7Q0b4avHu1m1nlxIaJ65D9nEHYo7NLXHO9">                            <button type="submit" class="w-8 h-8 rounded-xl bg-red-50 dark:bg-red-900/30 hover:bg-red-100 dark:hover:bg-red-900/50 text-red-500 dark:text-red-400 hover:text-red-600 dark:hover:text-red-300 transition-colors flex items-center justify-center">
                                <i class="fa-solid fa-right-from-bracket text-sm"></i>
                        </button>
                        </form>
            </div>
        </div>
                    </div>
                    
            <!-- Desktop Main Content -->
            <div class="flex-1 flex flex-col min-h-0 overflow-hidden">

                <!-- Header -->
                <header class="bg-white/80 dark:bg-gray-900/80 backdrop-blur-xl border-b border-gray-200/50 dark:border-gray-700/50 px-4 lg:px-6 py-4 shadow-sm relative z-50 flex-shrink-0">
                    <div class="flex items-center justify-between">
                        <!-- Left: hamburger (mobile only) + page title -->
                    <div class="flex items-center space-x-3 lg:space-x-4">
                            <button @click="sidebarOpen = true"
                                    class="lg:hidden w-10 h-10 flex items-center justify-center rounded-xl bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-300 flex-shrink-0">
                                <i class="fa-solid fa-bars"></i>
                            </button>
                            <div class="hidden lg:block">
                                <h1 class="text-2xl font-bold text-gray-900 dark:text-white">
                                    Dashboard                                </h1>
                                <p class="text-sm text-gray-500 dark:text-gray-400 mt-1">
                                    Welcome back, <?php echo htmlspecialchars(getUserDetails('username', $_SESSION['email']) ?: ''); ?>                                </p>
                        </div>
                    </div>
                                        <!-- Header Actions -->
                    <div class="flex items-center space-x-4">
                            <!-- Language Translate -->
                            <button onclick="toggleLanguageBar()"
                                    class="w-11 h-11 bg-gray-50 hover:bg-primary-50 dark:bg-gray-800 dark:hover:bg-gray-700 rounded-2xl flex items-center justify-center transition-colors group">
                                <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-gray-600 group-hover:text-primary-600 dark:text-gray-300 dark:group-hover:text-primary-400 transition-colors"><circle cx="12" cy="12" r="10"></circle><path d="M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>
                            </button>

                            <!-- Dark Mode Toggle -->
                            <button @click="toggleDarkMode()"
                                    class="w-11 h-11 bg-gray-50 hover:bg-primary-50 dark:bg-gray-800 dark:hover:bg-gray-700 rounded-2xl flex items-center justify-center transition-colors group">
                                <i x-show="!darkMode" class="fa-solid fa-moon text-gray-600 group-hover:text-primary-600 dark:text-gray-300 transition-colors"></i>
                                <i x-show="darkMode" class="fa-solid fa-sun text-yellow-500 group-hover:text-yellow-400 transition-colors"></i>
                            </button>
                            
                            <!-- Notifications -->
                            <div class="relative">
                                <button @click="toggleNotifications()"
                                        class="relative w-11 h-11 bg-gray-50 hover:bg-primary-50 dark:bg-gray-800 dark:hover:bg-gray-700 rounded-2xl flex items-center justify-center transition-colors group">
                                    <i class="fa-solid fa-bell text-gray-600 group-hover:text-primary-600 dark:text-gray-300 dark:group-hover:text-primary-400 transition-colors"></i>
                                    <?php if ($_notif_count > 0): ?>
                                    <span class="absolute -top-1 -right-1 w-5 h-5 bg-red-500 text-white text-xs font-bold rounded-full flex items-center justify-center leading-none"><?php echo $_notif_count; ?></span>
                                    <?php endif; ?>
                                </button>
                            
                                <!-- Notifications Dropdown -->
                                <div x-show="notificationOpen" 
                                     x-transition:enter="transition ease-out duration-200"
                                     x-transition:enter-start="opacity-0 scale-95"
                                     x-transition:enter-end="opacity-1 scale-100"
                                     x-transition:leave="transition ease-in duration-150"
                                     x-transition:leave-start="opacity-1 scale-100"
                                     x-transition:leave-end="opacity-0 scale-95"
                                     class="absolute right-0 mt-2 w-80 bg-white dark:bg-gray-800 rounded-2xl shadow-2xl border border-gray-200/50 dark:border-gray-700/50 z-[99999]">
                                    <div class="p-4 border-b border-gray-100 dark:border-gray-700">
                                        <div class="flex items-center justify-between">
                                            <h3 class="text-lg font-bold text-gray-900 dark:text-white">Notifications</h3>
                                            <?php if ($_notif_count > 0): ?>
                                            <span class="text-xs bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-300 font-bold px-2 py-0.5 rounded-full"><?php echo $_notif_count; ?> unread</span>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                    <div class="max-h-96 overflow-y-auto custom-scrollbar">
                                        <?php if (empty($_notif_rows)): ?>
                                            <div class="p-6 text-center">
                                                <div class="w-16 h-16 bg-gray-100 dark:bg-gray-700 rounded-full flex items-center justify-center mx-auto mb-3">
                                                    <i class="fa-solid fa-bell-slash text-gray-400 dark:text-gray-500 text-xl"></i>
                                                </div>
                                                <p class="text-sm text-gray-500 dark:text-gray-400 font-medium">No messages yet</p>
                                                <p class="text-xs text-gray-400 dark:text-gray-500 mt-1">Support replies will appear here</p>
                                            </div>
                                        <?php else: ?>
                                            <?php foreach ($_notif_rows as $_nr):
                                                $_is_unread = !$_nr['is_read'];
                                            ?>
                                            <a href="support" class="flex items-start gap-3 px-4 py-3 transition-colors border-b border-gray-50 dark:border-gray-700/50 last:border-0 <?php echo $_is_unread ? 'bg-primary-50/60 dark:bg-primary-900/10 hover:bg-primary-50 dark:hover:bg-primary-900/20' : 'hover:bg-gray-50 dark:hover:bg-gray-700/50'; ?>">
                                                <div class="relative flex-shrink-0 mt-0.5">
                                                    <div class="w-9 h-9 rounded-xl <?php echo $_is_unread ? 'bg-primary-500 text-white' : 'bg-gray-100 dark:bg-gray-700 text-gray-400 dark:text-gray-500'; ?> flex items-center justify-center">
                                                        <i class="fa-solid fa-headset text-sm"></i>
                                                    </div>
                                                    <?php if ($_is_unread): ?>
                                                    <span class="absolute -top-1 -right-1 w-3 h-3 bg-red-500 border-2 border-white dark:border-gray-800 rounded-full"></span>
                                                    <?php endif; ?>
                                                </div>
                                                <div class="flex-1 min-w-0">
                                                    <p class="text-sm truncate <?php echo $_is_unread ? 'font-bold text-gray-900 dark:text-white' : 'font-medium text-gray-500 dark:text-gray-400'; ?>"><?php echo htmlspecialchars($_nr['subject']); ?></p>
                                                    <p class="text-xs mt-0.5 line-clamp-2 <?php echo $_is_unread ? 'text-gray-600 dark:text-gray-300' : 'text-gray-400 dark:text-gray-500'; ?>"><?php echo htmlspecialchars(substr($_nr['message'], 0, 80)) . (strlen($_nr['message']) > 80 ? '…' : ''); ?></p>
                                                    <p class="text-xs mt-1 <?php echo $_is_unread ? 'text-primary-500 dark:text-primary-400 font-medium' : 'text-gray-400 dark:text-gray-500'; ?>"><?php echo date('M j, g:ia', strtotime($_nr['date_added'])); ?></p>
                                                </div>
                                            </a>
                                            <?php endforeach; ?>
                                        <?php endif; ?>
                                    </div>
                                    <div class="p-4 border-t border-gray-100 dark:border-gray-700">
                                        <div class="flex items-center justify-between">
                                            <button class="text-sm font-semibold text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors">
                                                Mark all as read
</button>
                                            <a href="support" class="text-sm font-semibold text-primary-600 hover:text-primary-700 transition-colors">
                                                View All Notifications
                                            </a>
                                        </div>
                                </div>
                            </div>
                        </div>

                            <!-- User Dropdown -->
                            <div class="relative">
                                <button @click="toggleUserDropdown()" 
                                        class="flex items-center space-x-3 p-2 rounded-2xl hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors group">
                                                            <div class="h-10 w-10 rounded-full bg-primary-500 flex items-center justify-center text-white font-bold border-2 border-primary-100">
                <?php echo $_user_initials; ?>
            </div>
                                            <div class="hidden md:block text-left">
                                        <p class="text-sm font-semibold text-gray-900 dark:text-white"><?php echo htmlspecialchars(getUserDetails('username', $_SESSION['email']) ?: ''); ?></p>
                                        <p class="text-xs text-gray-500 dark:text-gray-400"><?php echo htmlspecialchars($_SESSION['email'] ?? ''); ?></p>
                                    </div>
                                    <i class="fa-solid fa-chevron-down text-gray-400 dark:text-gray-500 text-sm group-hover:text-primary-600 dark:group-hover:text-primary-400 transition-colors"></i>
                    </button>
                    
                                <!-- User Dropdown Menu -->
                                <div x-show="userDropdownOpen" 
                                     x-transition:enter="transition ease-out duration-200"
                                     x-transition:enter-start="opacity-0 scale-95"
                                     x-transition:enter-end="opacity-1 scale-100"
                                     x-transition:leave="transition ease-in duration-150"
                                     x-transition:leave-start="opacity-1 scale-100"
                                     x-transition:leave-end="opacity-0 scale-95"
                                     class="absolute right-0 mt-2 w-64 bg-white dark:bg-gray-800 rounded-2xl shadow-2xl border border-gray-200/50 dark:border-gray-700/50 z-[99998]">
                                    <div class="p-4 border-b border-gray-100 dark:border-gray-700">
                                        <div class="flex items-center space-x-3">
                                                                    <div class="h-10 w-10 rounded-full bg-primary-500 flex items-center justify-center text-white font-bold border-2 border-primary-100">
                <?php echo $_user_initials; ?>
            </div>
                                                    <div>
                                                <p class="text-sm font-bold text-gray-900 dark:text-white"><?php echo htmlspecialchars(getUserDetails('username', $_SESSION['email']) ?: ''); ?> </p>
                                                <p class="text-xs text-gray-500 dark:text-gray-400"><?php echo htmlspecialchars($_SESSION['email'] ?? ''); ?></p>
        </div>
</div>
                            
                            <!-- KYC Verification Status -->
                                        <div class="mt-3">
                                            <?php if ($_kyc_status === 'Approved'): ?>
                                                <div class="flex items-center justify-center py-2 rounded-xl bg-green-50 dark:bg-green-900/30 border border-green-100 dark:border-green-800">
                                                    <span class="text-xs text-green-800 dark:text-green-300 font-semibold flex items-center">
                                                        <i class="fa-solid fa-shield-check text-green-600 dark:text-green-400 mr-2"></i> KYC Verified
                                                    </span>
                                                </div>
                                            <?php elseif ($_kyc_status === 'Pending'): ?>
                                                <a href="kyc-form" class="flex items-center justify-center py-2 rounded-xl bg-yellow-50 dark:bg-yellow-900/30 border border-yellow-100 dark:border-yellow-800 hover:bg-yellow-100 dark:hover:bg-yellow-900/50 transition-colors">
                                                    <span class="text-xs text-yellow-800 dark:text-yellow-300 font-semibold flex items-center">
                                                        <i class="fa-solid fa-clock text-yellow-500 dark:text-yellow-400 mr-2"></i> KYC Pending
                                                    </span>
                                                </a>
                                            <?php else: ?>
                                                <a href="verify-account" class="flex items-center justify-center py-2 rounded-xl bg-red-50 dark:bg-red-900/30 border border-red-100 dark:border-red-800 hover:bg-red-100 dark:hover:bg-red-900/50 transition-colors">
                                                    <span class="text-xs text-red-800 dark:text-red-300 font-semibold flex items-center">
                                                        <i class="fa-solid fa-exclamation-triangle text-red-600 dark:text-red-400 mr-2"></i> Verify KYC
                                                    </span>
                                                </a>
                                            <?php endif; ?>
                                        </div>
                    </div>
                                    <div class="p-2">
                                        <a href="account-settings" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors group">
                                            <div class="w-8 h-8 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center group-hover:bg-primary-100 dark:group-hover:bg-primary-900/30 transition-colors">
                                                <i class="fa-solid fa-user text-gray-500 dark:text-gray-400 group-hover:text-primary-600 dark:group-hover:text-primary-400 transition-colors text-sm"></i>
                    </div>
                                            <span class="text-sm font-medium text-gray-700 dark:text-gray-300 group-hover:text-gray-900 dark:group-hover:text-white">Profile Settings</span>
                                        </a>
                                        <a href="support" class="flex items-center space-x-3 px-3 py-2.5 rounded-xl hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors group">
                                            <div class="w-8 h-8 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center group-hover:bg-primary-100 dark:group-hover:bg-primary-900/30 transition-colors">
                                                <i class="fa-solid fa-headset text-gray-500 dark:text-gray-400 group-hover:text-primary-600 dark:group-hover:text-primary-400 transition-colors text-sm"></i>
                                </div>
                                            <span class="text-sm font-medium text-gray-700 dark:text-gray-300 group-hover:text-gray-900 dark:group-hover:text-white">Help & Support</span>
                                        </a>
                                        <div class="border-t border-gray-100 dark:border-gray-700 my-2"></div>
                                        <form method="POST" action="logout">
                                            <input type="hidden" name="_token" value="7Y8Vjj7Q0b4avHu1m1nlxIaJ65D9nEHYo7NLXHO9">                                            <button type="submit" class="w-full flex items-center space-x-3 px-3 py-2.5 rounded-xl hover:bg-red-50 dark:hover:bg-red-900/30 transition-colors group">
                                                <div class="w-8 h-8 bg-red-100 dark:bg-red-900/30 rounded-xl flex items-center justify-center group-hover:bg-red-200 dark:group-hover:bg-red-900/50 transition-colors">
                                                    <i class="fa-solid fa-right-from-bracket text-red-500 dark:text-red-400 text-sm"></i>
                                </div>
                                                <span class="text-sm font-medium text-red-600 dark:text-red-400">Sign Out</span>
                                            </button>
                                        </form>
                            </div>
                                </div>
                            </div>
                                </div>
                            </div>
                </header>
                    
    
