<?php
ob_start();
include 'master.php';

// Create tables if not exist
$conn->query("CREATE TABLE IF NOT EXISTS `support_tickets` (
    `id`         INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    `user_email` VARCHAR(255) NOT NULL,
    `user_name`  VARCHAR(255) NOT NULL DEFAULT '',
    `subject`    VARCHAR(255) NOT NULL,
    `priority`   VARCHAR(20)  NOT NULL DEFAULT 'low',
    `message`    TEXT         NOT NULL,
    `status`     VARCHAR(20)  NOT NULL DEFAULT 'Open',
    `date_added` DATETIME     NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

$conn->query("CREATE TABLE IF NOT EXISTS `support_replies` (
    `id`        INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    `ticket_id` INT(11) NOT NULL,
    `sender`    VARCHAR(10) NOT NULL DEFAULT 'user',
    `message`   TEXT NOT NULL,
    `date_added` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    KEY `ticket_id` (`ticket_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");

$_sp_err = '';
$_sp_ok  = '';

if ($_SERVER['REQUEST_METHOD'] === 'POST' && ($_POST['action'] ?? '') === 'submit_ticket') {
    $email    = $_SESSION['email'] ?? '';
    $name     = trim((string)(getUserDetails('fullname', $email) ?: $email));
    $subject  = trim($_POST['subject'] ?? '');
    $priority = trim($_POST['selectPriority'] ?? 'low');
    $message  = trim($_POST['message'] ?? '');

    if (empty($subject) || empty($message)) {
        $_sp_err = 'Subject and message are required.';
    } else {
        $stmt = $conn->prepare("INSERT INTO support_tickets (user_email, user_name, subject, priority, message, admin_read) VALUES (?,?,?,?,?,0)");
        $stmt->bind_param('sssss', $email, $name, $subject, $priority, $message);
        $stmt->execute();
        $stmt->close();
        ob_end_clean();
        header('Location: support?submitted=1');
        exit;
    }
}

// Load user's tickets
$_email   = $_SESSION['email'] ?? '';

// Mark all unread admin replies on this user's tickets as read
$conn->query("UPDATE support_replies sr
    JOIN support_tickets st ON st.id = sr.ticket_id
    SET sr.is_read = 1
    WHERE st.user_email = '" . $conn->real_escape_string($_email) . "'
      AND sr.sender = 'admin' AND sr.is_read = 0");

$_tickets = $conn->query("SELECT * FROM support_tickets WHERE user_email = '" . $conn->real_escape_string($_email) . "' ORDER BY id DESC");
?>

     
                    
    

                <!-- Main Content -->
                <main class="flex-1 overflow-y-auto bg-gray-50 dark:bg-gray-900 min-h-0">
                    <div class="h-full overflow-y-auto">
                        
<div class="p-4 space-y-4">
    <!-- Alerts -->
    <?php if (!empty($_GET['submitted'])): ?>
        <div class="p-3 bg-green-100 dark:bg-green-900/30 border border-green-300 dark:border-green-700 rounded-xl text-sm text-green-700 dark:text-green-300 flex items-center space-x-2">
            <i class="fa-solid fa-check-circle text-green-500"></i>
            <span>Your ticket has been submitted successfully. We'll get back to you soon.</span>
        </div>
    <?php endif; ?>
    <?php if (!empty($_sp_err)): ?>
        <div class="p-3 bg-red-100 dark:bg-red-900/30 border border-red-300 dark:border-red-700 rounded-xl text-sm text-red-700 dark:text-red-300 flex items-center space-x-2">
            <i class="fa-solid fa-circle-exclamation text-red-500"></i>
            <span><?php echo htmlspecialchars($_sp_err); ?></span>
        </div>
    <?php endif; ?>

    <!-- Mobile Header -->
    <div class="lg:hidden mb-2">
        <div class="lg:hidden" x-data="{ showMobileNotifications: false }">
    <!-- Header Section -->
    <div class="flex items-center justify-between mb-6">
        <div class="flex items-center space-x-2">
                            <!-- Back Button -->
                <a href="../dashboard" class="w-10 h-10 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center backdrop-blur-sm transition-all duration-200 hover:bg-gray-200 dark:hover:bg-gray-700 mr-2">
                    <i class="fa-solid fa-arrow-left text-gray-700 dark:text-gray-300 text-base"></i>
                </a>
                        
            <div>
                                    <!-- Custom Title -->
                    <p class="text-gray-900 dark:text-white font-semibold text-base">Support Center</p>
                            </div>
        </div>
        
        <div class="flex items-center space-x-2">
              <!-- Dark Mode Toggle -->
             <!--   <button @click="toggleDarkMode()" 
                        class="w-10 h-10 bg-white/10 dark:bg-white/20 rounded-full flex items-center justify-center backdrop-blur-sm transition-all duration-200 hover:bg-white/20 dark:hover:bg-white/30">
                    <i x-show="!darkMode" class="fa-solid fa-moon text-white text-base"></i>
                    <i x-show="darkMode" class="fa-solid fa-sun text-yellow-400 text-base"></i>
                </button> 

                <!-- Notifications -->
             <!--   <div class="relative">
                    <button @click="showMobileNotifications = !showMobileNotifications" class="w-10 h-10 bg-white/10 dark:bg-white/20 rounded-full flex items-center justify-center backdrop-blur-sm transition-all duration-200 hover:bg-white/20 dark:hover:bg-white/30">
                        <i class="fa-solid fa-bell text-white text-base"></i>
                    </button>
                                                        </div>-->
                    </div>
    </div>

            <!-- Mobile Notifications Panel -->
        <div x-show="showMobileNotifications" 
             x-transition:enter="transition ease-out duration-300" 
             x-transition:enter-start="opacity-0 -translate-y-4" 
             x-transition:enter-end="opacity-100 translate-y-0"
             x-transition:leave="transition ease-in duration-200" 
             x-transition:leave-start="opacity-100 translate-y-0" 
             x-transition:leave-end="opacity-0 -translate-y-4"
             class="fixed inset-0 z-50 bg-black/20 backdrop-blur-sm" 
             @click="showMobileNotifications = false">
            
            <div @click.stop class="absolute top-0 left-0 right-0 bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 dark:from-slate-950 dark:via-slate-900 dark:to-slate-950 text-white rounded-b-3xl shadow-2xl dark:shadow-slate-900/50 max-h-[80vh] overflow-hidden">
                <!-- Header -->
                <div class="flex items-center justify-between p-4 border-b border-white/10 dark:border-white/20">
                    <div class="flex items-center space-x-3">
                        <div class="w-10 h-10 bg-white/10 dark:bg-white/20 rounded-2xl flex items-center justify-center">
                            <i class="fa-solid fa-bell text-white text-sm"></i>
                        </div>
                        <div>
                            <h3 class="text-lg font-bold text-white">Notifications</h3>
                                                                                        <p class="text-xs text-white/60">All caught up!</p>
                                                    </div>
                    </div>
                    <button @click="showMobileNotifications = false" class="w-8 h-8 bg-white/10 dark:bg-white/20 rounded-xl flex items-center justify-center hover:bg-white/20 dark:hover:bg-white/30 transition-colors">
                        <i class="fa-solid fa-times text-white text-sm"></i>
                    </button>
                </div>

                <!-- Notifications List -->
                <div class="overflow-y-auto max-h-96 custom-scrollbar">
                                        
                                        <div class="p-8 text-center">
                        <div class="w-16 h-16 bg-white/10 dark:bg-white/20 rounded-3xl flex items-center justify-center mx-auto mb-4">
                            <i class="fa-solid fa-bell-slash text-white/40 dark:text-white/60 text-2xl"></i>
                        </div>
                        <p class="text-white font-semibold mb-1">No notifications yet</p>
                        <p class="text-xs text-white/60 dark:text-white/70">We'll notify you when something happens</p>
                    </div>
                                    </div>
                
                <!-- Footer Actions -->
                            </div>
        </div>
    </div>     </div>

    <!-- Desktop Header -->
    <div class="hidden lg:block">
        <div class="bg-white/80 dark:bg-gray-800/80 backdrop-blur-xl rounded-2xl shadow-lg dark:shadow-gray-900/50 border border-white/20 dark:border-gray-700/50 p-4">
            <div class="flex items-center justify-between">
                <div class="flex items-center space-x-3">
                    <div class="w-10 h-10 bg-gradient-to-r from-primary-500 to-primary-600 rounded-2xl flex items-center justify-center">
                        <i class="fa-solid fa-life-ring text-white text-lg"></i>
                    </div>
                    <div>
                        <h1 class="text-xl font-bold text-gray-900 dark:text-white">Support Center</h1>
                        <p class="text-sm text-gray-600 dark:text-gray-400">Get help with your account and services</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="bg-white/80 dark:bg-gray-800/80 backdrop-blur-xl rounded-2xl shadow-lg dark:shadow-gray-900/50 border border-white/20 dark:border-gray-700/50 overflow-hidden">
        <!-- Content Header -->
        <div class="border-b border-gray-200 dark:border-gray-700 p-4">
            <h2 class="text-lg font-semibold text-gray-900 dark:text-white flex items-center">
                <i class="fa-solid fa-ticket text-primary-600 dark:text-primary-400 text-sm mr-2"></i>
                Submit a Support Ticket
            </h2>
            <p class="text-xs text-gray-500 dark:text-gray-400 mt-1">
                We're here to help. Tell us about your issue and we'll find a solution.
            </p>
        </div>
        
        <!-- Support Icon -->
        <div class="flex justify-center py-6">
            <div class="h-16 w-16 rounded-full bg-primary-50 dark:bg-primary-900/30 flex items-center justify-center">
                <i class="fa-solid fa-circle-question text-2xl text-primary-600 dark:text-primary-400"></i>
            </div>
        </div>
        
        <!-- Form Content -->
        <div class="p-4">
            <form action="support" method="post" class="space-y-4">
                <input type="hidden" name="action" value="submit_ticket">
                
                <!-- Ticket Title -->
                <div>
                    <label for="subject" class="block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1">
                        Ticket Title
                    </label>
                    <div class="relative">
                        <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                            <i class="fa-solid fa-bookmark text-gray-400 text-sm"></i>
                        </div>
                        <input 
                            type="text" 
                            id="subject" 
                            name="subject"
                            class="block w-full pl-10 py-2.5 border border-gray-200 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 dark:text-white focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-all text-sm"
                            placeholder="Briefly describe your issue"
                            required
                        />
                    </div>
                    <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">Be specific to help us understand your issue</p>
                </div>
                
                <!-- Priority Selection -->
                <div>
                    <label for="selectPriority" class="block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1">
                        Priority Level
                    </label>
                    <div class="relative">
                        <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                            <i class="fa-solid fa-flag text-gray-400 text-sm"></i>
                        </div>
                        <select 
                            id="selectPriority" 
                            name="selectPriority"
                            class="block w-full pl-10 py-2.5 border border-gray-200 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 dark:text-white focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-all appearance-none text-sm"
                            required
                        >
                            <option value="low">Low Priority</option>
                            <option value="medium">Medium Priority</option>
                            <option value="high">High Priority</option>
                        </select>
                        <div class="absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none">
                            <i class="fa-solid fa-chevron-down text-gray-400 text-sm"></i>
                        </div>
                    </div>
                    <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">Select based on urgency of your request</p>
                </div>
                
                <!-- Message Content -->
                <div>
                    <label for="message" class="block text-xs font-medium text-gray-700 dark:text-gray-300 mb-1">
                        Describe Your Issue
                    </label>
                    <div class="relative">
                        <div class="absolute top-3 left-3 flex items-start pointer-events-none">
                            <i class="fa-solid fa-message text-gray-400 text-sm"></i>
                        </div>
                        <textarea 
                            id="message" 
                            name="message"
                            rows="5"
                            class="block w-full pl-10 py-2.5 border border-gray-200 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 dark:text-white focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-all preserveLines text-sm"
                            placeholder="Please provide all relevant details about your issue so we can help you better"
                            required
                        ></textarea>
                    </div>
                    <p class="mt-1 text-xs text-gray-500 dark:text-gray-400">Include any relevant details that might help us resolve your issue</p>
                </div>
                
                <!-- Support Info Card -->
                <div class="bg-blue-50 dark:bg-blue-900/30 rounded-lg p-3 border border-blue-100 dark:border-blue-800">
                    <div class="flex">
                        <div class="flex-shrink-0">
                            <i class="fa-solid fa-info-circle text-blue-500 dark:text-blue-400 text-sm"></i>
                        </div>
                        <div class="ml-3">
                            <h3 class="text-xs font-medium text-blue-800 dark:text-blue-300">Support Information</h3>
                            <div class="mt-1 text-xs text-blue-700 dark:text-blue-400">
                                <p>
                                    Our support team typically responds within 24 hours. For urgent matters, 
                                    please select "High Priority" and we'll do our best to assist you sooner.
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- Submit Button -->
                <div class="pt-2">
                    <button 
                        type="submit"
                        class="w-full bg-primary-600 hover:bg-primary-700 dark:bg-primary-500 dark:hover:bg-primary-600 text-white font-medium py-2.5 px-4 rounded-lg transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800 flex items-center justify-center text-sm"
                    >
                        <i class="fa-solid fa-paper-plane text-xs mr-2"></i>
                        Submit Ticket
                    </button>
                </div>
            </form>
        </div>
    </div>

    <!-- My Tickets -->
    <?php if ($_tickets && $_tickets->num_rows > 0): ?>
    <div class="bg-white/80 dark:bg-gray-800/80 backdrop-blur-xl rounded-2xl shadow-lg dark:shadow-gray-900/50 border border-white/20 dark:border-gray-700/50 overflow-hidden">
        <div class="border-b border-gray-200 dark:border-gray-700 p-4">
            <h2 class="text-lg font-semibold text-gray-900 dark:text-white flex items-center">
                <i class="fa-solid fa-list-check text-primary-600 dark:text-primary-400 text-sm mr-2"></i>
                My Tickets
            </h2>
        </div>
        <div class="divide-y divide-gray-100 dark:divide-gray-700">
        <?php foreach ($_tickets as $_t):
            $tid = $_t['id'];
            $replies = $conn->query("SELECT * FROM support_replies WHERE ticket_id = $tid ORDER BY id ASC");
            $priorityColor = ['low'=>'green','medium'=>'yellow','high'=>'red'][$_t['priority']] ?? 'gray';
            $statusColor   = ['Open'=>'blue','In Progress'=>'yellow','Resolved'=>'green','Closed'=>'gray'][$_t['status']] ?? 'gray';
        ?>
            <div class="p-4" x-data="{ open: false }">
                <button @click="open = !open" class="w-full flex items-start justify-between text-left">
                    <div class="flex-1">
                        <div class="flex items-center space-x-2 mb-1 flex-wrap gap-1">
                            <span class="text-sm font-semibold text-gray-900 dark:text-white"><?php echo htmlspecialchars($_t['subject']); ?></span>
                            <span class="text-xs px-2 py-0.5 rounded-full bg-<?php echo $priorityColor; ?>-100 dark:bg-<?php echo $priorityColor; ?>-900/30 text-<?php echo $priorityColor; ?>-700 dark:text-<?php echo $priorityColor; ?>-300 capitalize"><?php echo htmlspecialchars($_t['priority']); ?></span>
                            <span class="text-xs px-2 py-0.5 rounded-full bg-<?php echo $statusColor; ?>-100 dark:bg-<?php echo $statusColor; ?>-900/30 text-<?php echo $statusColor; ?>-700 dark:text-<?php echo $statusColor; ?>-300"><?php echo htmlspecialchars($_t['status']); ?></span>
                        </div>
                        <p class="text-xs text-gray-500 dark:text-gray-400"><?php echo $t['date_added'] ?? $_t['date_added']; ?></p>
                    </div>
                    <i x-show="!open" class="fa-solid fa-chevron-down text-gray-400 text-xs ml-2 mt-1"></i>
                    <i x-show="open"  class="fa-solid fa-chevron-up text-gray-400 text-xs ml-2 mt-1"></i>
                </button>
                <div x-show="open" x-transition class="mt-3 space-y-3">
                    <!-- Original message -->
                    <div class="bg-gray-50 dark:bg-gray-700/50 rounded-xl p-3">
                        <p class="text-xs font-semibold text-gray-600 dark:text-gray-400 mb-1">Your message</p>
                        <p class="text-sm text-gray-800 dark:text-gray-200 whitespace-pre-line"><?php echo htmlspecialchars($_t['message']); ?></p>
                    </div>
                    <!-- Replies -->
                    <?php if ($replies && $replies->num_rows > 0): ?>
                        <?php foreach ($replies as $rep): ?>
                        <div class="<?php echo $rep['sender'] === 'admin' ? 'bg-primary-50 dark:bg-primary-900/20 border border-primary-200 dark:border-primary-700' : 'bg-gray-50 dark:bg-gray-700/50'; ?> rounded-xl p-3">
                            <p class="text-xs font-semibold <?php echo $rep['sender'] === 'admin' ? 'text-primary-600 dark:text-primary-400' : 'text-gray-600 dark:text-gray-400'; ?> mb-1">
                                <?php echo $rep['sender'] === 'admin' ? 'Support Team' : 'You'; ?> &middot; <span class="font-normal"><?php echo $rep['date_added']; ?></span>
                            </p>
                            <p class="text-sm text-gray-800 dark:text-gray-200 whitespace-pre-line"><?php echo htmlspecialchars($rep['message']); ?></p>
                        </div>
                        <?php endforeach; ?>
                    <?php else: ?>
                        <p class="text-xs text-gray-400 italic">No reply yet. We'll respond soon.</p>
                    <?php endif; ?>
                </div>
            </div>
        <?php endforeach; ?>
        </div>
    </div>
    <?php endif; ?>

    <!-- Quick Help Section -->
    <div class="bg-white/80 dark:bg-gray-800/80 backdrop-blur-xl rounded-2xl shadow-lg dark:shadow-gray-900/50 border border-white/20 dark:border-gray-700/50 overflow-hidden">
        <!-- Header -->
        <div class="px-4 py-3 bg-gradient-to-r from-primary-50/80 to-blue-50/50 dark:from-gray-900/80 dark:to-gray-800/50 border-b border-primary-100/50 dark:border-gray-700/50">
            <div class="flex items-center">
                <div class="w-8 h-8 bg-primary-500 rounded-xl flex items-center justify-center mr-3">
                    <i class="fa-solid fa-question text-white text-sm"></i>
                </div>
                <div>
                    <h3 class="text-lg font-bold text-primary-900 dark:text-primary-100">Quick Help</h3>
                    <p class="text-xs text-primary-700 dark:text-primary-300">Find answers to common questions</p>
                </div>
            </div>
        </div>
        
        <!-- FAQ Items -->
        <div class="divide-y divide-gray-100 dark:divide-gray-700" x-data="{ expandedItem: null }">
                        
                        <div class="p-4">
                <button @click="expandedItem = expandedItem === 0 ? null : 0" class="w-full flex items-start justify-between text-left">
                    <div class="flex items-start space-x-3 flex-1">
                        <div class="w-10 h-10 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center flex-shrink-0 mt-0.5">
                            <i class="fa-solid fa-paper-plane text-gray-600 dark:text-gray-400 text-sm"></i>
                        </div>
                        <div class="flex-1">
                            <p class="text-sm font-medium text-gray-900 dark:text-white">How to make a transfer?</p>
                            <div x-show="expandedItem === 0" 
                                 x-transition:enter="transition ease-out duration-200" 
                                 x-transition:enter-start="opacity-0 -translate-y-1" 
                                 x-transition:enter-end="opacity-100 translate-y-0" 
                                 class="mt-2">
                                <p class="text-xs text-gray-600 dark:text-gray-300 leading-relaxed">Go to Transfer section and select Local or International transfer. Enter recipient details, amount, and confirm with your PIN.</p>
                            </div>
                        </div>
                    </div>
                    <div class="ml-2 flex-shrink-0">
                        <i x-show="expandedItem !== 0" class="fa-solid fa-chevron-down text-gray-400 text-xs"></i>
                        <i x-show="expandedItem === 0" class="fa-solid fa-chevron-up text-gray-400 text-xs"></i>
                    </div>
                </button>
            </div>
                        <div class="p-4">
                <button @click="expandedItem = expandedItem === 1 ? null : 1" class="w-full flex items-start justify-between text-left">
                    <div class="flex items-start space-x-3 flex-1">
                        <div class="w-10 h-10 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center flex-shrink-0 mt-0.5">
                            <i class="fa-solid fa-credit-card text-gray-600 dark:text-gray-400 text-sm"></i>
                        </div>
                        <div class="flex-1">
                            <p class="text-sm font-medium text-gray-900 dark:text-white">How to apply for a card?</p>
                            <div x-show="expandedItem === 1" 
                                 x-transition:enter="transition ease-out duration-200" 
                                 x-transition:enter-start="opacity-0 -translate-y-1" 
                                 x-transition:enter-end="opacity-100 translate-y-0" 
                                 class="mt-2">
                                <p class="text-xs text-gray-600 dark:text-gray-300 leading-relaxed">Visit Cards section and click Apply for Virtual Card. Fill out the application form and wait for approval.</p>
                            </div>
                        </div>
                    </div>
                    <div class="ml-2 flex-shrink-0">
                        <i x-show="expandedItem !== 1" class="fa-solid fa-chevron-down text-gray-400 text-xs"></i>
                        <i x-show="expandedItem === 1" class="fa-solid fa-chevron-up text-gray-400 text-xs"></i>
                    </div>
                </button>
            </div>
                        <div class="p-4">
                <button @click="expandedItem = expandedItem === 2 ? null : 2" class="w-full flex items-start justify-between text-left">
                    <div class="flex items-start space-x-3 flex-1">
                        <div class="w-10 h-10 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center flex-shrink-0 mt-0.5">
                            <i class="fa-solid fa-wallet text-gray-600 dark:text-gray-400 text-sm"></i>
                        </div>
                        <div class="flex-1">
                            <p class="text-sm font-medium text-gray-900 dark:text-white">How to check my balance?</p>
                            <div x-show="expandedItem === 2" 
                                 x-transition:enter="transition ease-out duration-200" 
                                 x-transition:enter-start="opacity-0 -translate-y-1" 
                                 x-transition:enter-end="opacity-100 translate-y-0" 
                                 class="mt-2">
                                <p class="text-xs text-gray-600 dark:text-gray-300 leading-relaxed">Your balance is displayed on the main dashboard. You can toggle visibility using the eye icon.</p>
                            </div>
                        </div>
                    </div>
                    <div class="ml-2 flex-shrink-0">
                        <i x-show="expandedItem !== 2" class="fa-solid fa-chevron-down text-gray-400 text-xs"></i>
                        <i x-show="expandedItem === 2" class="fa-solid fa-chevron-up text-gray-400 text-xs"></i>
                    </div>
                </button>
            </div>
                        <div class="p-4">
                <button @click="expandedItem = expandedItem === 3 ? null : 3" class="w-full flex items-start justify-between text-left">
                    <div class="flex items-start space-x-3 flex-1">
                        <div class="w-10 h-10 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center flex-shrink-0 mt-0.5">
                            <i class="fa-solid fa-shield text-gray-600 dark:text-gray-400 text-sm"></i>
                        </div>
                        <div class="flex-1">
                            <p class="text-sm font-medium text-gray-900 dark:text-white">How to enable 2FA?</p>
                            <div x-show="expandedItem === 3" 
                                 x-transition:enter="transition ease-out duration-200" 
                                 x-transition:enter-start="opacity-0 -translate-y-1" 
                                 x-transition:enter-end="opacity-100 translate-y-0" 
                                 class="mt-2">
                                <p class="text-xs text-gray-600 dark:text-gray-300 leading-relaxed">Go to Settings &gt; Security &gt; Two-Factor Authentication and follow the setup instructions.</p>
                            </div>
                        </div>
                    </div>
                    <div class="ml-2 flex-shrink-0">
                        <i x-show="expandedItem !== 3" class="fa-solid fa-chevron-down text-gray-400 text-xs"></i>
                        <i x-show="expandedItem === 3" class="fa-solid fa-chevron-up text-gray-400 text-xs"></i>
                    </div>
                </button>
            </div>
                        <div class="p-4">
                <button @click="expandedItem = expandedItem === 4 ? null : 4" class="w-full flex items-start justify-between text-left">
                    <div class="flex items-start space-x-3 flex-1">
                        <div class="w-10 h-10 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center flex-shrink-0 mt-0.5">
                            <i class="fa-solid fa-plus text-gray-600 dark:text-gray-400 text-sm"></i>
                        </div>
                        <div class="flex-1">
                            <p class="text-sm font-medium text-gray-900 dark:text-white">How to deposit funds?</p>
                            <div x-show="expandedItem === 4" 
                                 x-transition:enter="transition ease-out duration-200" 
                                 x-transition:enter-start="opacity-0 -translate-y-1" 
                                 x-transition:enter-end="opacity-100 translate-y-0" 
                                 class="mt-2">
                                <p class="text-xs text-gray-600 dark:text-gray-300 leading-relaxed">Click on Deposit from the dashboard, select your preferred payment method, and follow the instructions.</p>
                            </div>
                        </div>
                    </div>
                    <div class="ml-2 flex-shrink-0">
                        <i x-show="expandedItem !== 4" class="fa-solid fa-chevron-down text-gray-400 text-xs"></i>
                        <i x-show="expandedItem === 4" class="fa-solid fa-chevron-up text-gray-400 text-xs"></i>
                    </div>
                </button>
            </div>
                        <div class="p-4">
                <button @click="expandedItem = expandedItem === 5 ? null : 5" class="w-full flex items-start justify-between text-left">
                    <div class="flex items-start space-x-3 flex-1">
                        <div class="w-10 h-10 bg-gray-100 dark:bg-gray-700 rounded-xl flex items-center justify-center flex-shrink-0 mt-0.5">
                            <i class="fa-solid fa-chart-line text-gray-600 dark:text-gray-400 text-sm"></i>
                        </div>
                        <div class="flex-1">
                            <p class="text-sm font-medium text-gray-900 dark:text-white">How to track transactions?</p>
                            <div x-show="expandedItem === 5" 
                                 x-transition:enter="transition ease-out duration-200" 
                                 x-transition:enter-start="opacity-0 -translate-y-1" 
                                 x-transition:enter-end="opacity-100 translate-y-0" 
                                 class="mt-2">
                                <p class="text-xs text-gray-600 dark:text-gray-300 leading-relaxed">Visit the Transactions page to view your complete transaction history with filters and search options.</p>
                            </div>
                        </div>
                    </div>
                    <div class="ml-2 flex-shrink-0">
                        <i x-show="expandedItem !== 5" class="fa-solid fa-chevron-down text-gray-400 text-xs"></i>
                        <i x-show="expandedItem === 5" class="fa-solid fa-chevron-up text-gray-400 text-xs"></i>
                    </div>
                </button>
            </div>
                    </div>
        
        <!-- Contact Footer -->
        <div class="px-4 py-4 bg-gray-50 dark:bg-gray-800/50 border-t border-gray-100 dark:border-gray-700">
            <div class="text-center">
                <p class="text-sm text-gray-600 dark:text-gray-400 mb-3">Still need help?</p>
                <div class="flex items-center justify-center space-x-6">
                    <div class="text-center">
                        <div class="w-8 h-8 bg-primary-100 dark:bg-primary-900/30 rounded-full flex items-center justify-center mx-auto mb-1">
                            <i class="fa-solid fa-clock text-primary-600 dark:text-primary-400 text-sm"></i>
                        </div>
                        <p class="text-xs text-gray-600 dark:text-gray-300 font-medium">24/7 Support</p>
                    </div>
                    <div class="text-center">
                        <div class="w-8 h-8 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center mx-auto mb-1">
                            <i class="fa-solid fa-headset text-green-600 dark:text-green-400 text-sm"></i>
                        </div>
                        <p class="text-xs text-gray-600 dark:text-gray-300 font-medium">Live Chat</p>
                    </div>
                    <div class="text-center">
                        <div class="w-8 h-8 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center mx-auto mb-1">
                            <i class="fa-solid fa-bolt text-blue-600 dark:text-blue-400 text-sm"></i>
                        </div>
                        <p class="text-xs text-gray-600 dark:text-gray-300 font-medium">Fast Response</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

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