<?php
// ============================================================================
// FILE: client/index.php
// ============================================================================
?>
<?php
require_once '../config/config.php';
require_once '../config/security.php';

start_secure_session();

// If already logged in to vault, redirect to vault dashboard
if (is_client_logged_in()) {
    redirect('/client/vault/dashboard.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Client Portal - Bepex Consult</title>
    
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    
    <!-- Custom CSS -->
    <link rel="stylesheet" href="/assets/css/style.css">
    
    <style>
        .client-portal-container {
            min-height: 100vh;
            background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 50%, #66BB6A 100%);
            display: flex;
            align-items: center;
            padding: 40px 0;
        }
        
        .portal-card {
            transition: all 0.3s ease;
            border: none;
            border-radius: 15px;
            overflow: hidden;
            height: 100%;
            cursor: pointer;
            background: white;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        
        .portal-card:hover {
            transform: translateY(-10px);
            box-shadow: 0 15px 30px rgba(0,0,0,0.25);
        }
        
        .portal-card.disabled {
            opacity: 0.7;
            cursor: not-allowed;
        }
        
        .portal-card.disabled:hover {
            transform: none;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        
        .card-header-custom {
            padding: 30px 20px;
            text-align: center;
            color: white;
            border: none;
        }
        
        .card-header-custom.vault {
            background: linear-gradient(135deg, #2E7D32 0%, #66BB6A 100%);
        }
        
        .card-header-custom.shipping {
            background: linear-gradient(135deg, #1565C0 0%, #42A5F5 100%);
        }
        
        .card-header-custom.escrow {
            background: linear-gradient(135deg, #F57C00 0%, #FFB74D 100%);
        }
        
        .portal-icon {
            font-size: 50px;
            margin-bottom: 15px;
            animation: float 3s ease-in-out infinite;
        }
        
        @keyframes float {
            0%, 100% {
                transform: translateY(0px);
            }
            50% {
                transform: translateY(-10px);
            }
        }
        
        .card-body-custom {
            padding: 25px 20px;
            background: white;
            text-align: center;
        }
        
        .service-title {
            font-size: 20px;
            font-weight: 600;
            color: #333;
            margin-bottom: 10px;
        }
        
        .service-description {
            font-size: 13px;
            color: #666;
            margin-bottom: 20px;
            line-height: 1.5;
        }
        
        .btn-access {
            padding: 10px 25px;
            border-radius: 25px;
            font-weight: 600;
            transition: all 0.3s ease;
            border: none;
        }
        
        .btn-access:hover {
            transform: scale(1.05);
        }
        
        .btn-vault {
            background: #2E7D32;
            color: white;
        }
        
        .btn-vault:hover {
            background: #1B5E20;
            color: white;
        }
        
        .btn-shipping {
            background: #1565C0;
            color: white;
        }
        
        .btn-shipping:hover {
            background: #0D47A1;
            color: white;
        }
        
        .btn-escrow {
            background: #F57C00;
            color: white;
        }
        
        .btn-escrow:hover {
            background: #E65100;
            color: white;
        }
        
        .logo-container {
            text-align: center;
            margin-bottom: 40px;
        }
        
        .logo-container h1 {
            color: white;
            font-weight: 700;
            margin-top: 20px;
            font-size: 2.5rem;
        }
        
        .logo-container p {
            color: rgba(255,255,255,0.9);
            font-size: 1.1rem;
        }
        
        .back-link {
            position: absolute;
            top: 20px;
            left: 20px;
            color: white;
            text-decoration: none;
            font-size: 16px;
            transition: all 0.3s ease;
            background: rgba(255,255,255,0.1);
            padding: 8px 15px;
            border-radius: 20px;
        }
        
        .back-link:hover {
            background: rgba(255,255,255,0.2);
            color: #FFB300;
        }
        
        .coming-soon-badge {
            position: absolute;
            top: 15px;
            right: 15px;
            background: #FF5722;
            color: white;
            padding: 5px 12px;
            border-radius: 15px;
            font-size: 11px;
            font-weight: 600;
        }
        
        @media (max-width: 768px) {
            .logo-container h1 {
                font-size: 2rem;
            }
            
            .portal-icon {
                font-size: 40px;
            }
            
            .service-title {
                font-size: 18px;
            }
        }
    </style>
</head>
<body>
    <div class="client-portal-container">
        <a href="/" class="back-link">
            <i class="fas fa-arrow-left me-2"></i>Back to Website
        </a>
        
        <div class="container">
            <!-- Logo and Title -->
            <div class="logo-container">
                <i class="fas fa-user-shield" style="font-size: 60px; color: white;"></i>
                <h1>Client Portal</h1>
                <p>Access Your Services</p>
            </div>
            
            <!-- Service Cards -->
            <div class="row justify-content-center g-4">
                <!-- Vault Card -->
                <div class="col-lg-4 col-md-6">
                    <div class="portal-card" onclick="window.location.href='/client/vault/login.php'">
                        <div class="card-header-custom vault">
                            <div class="portal-icon">
                                <i class="fas fa-vault"></i>
                            </div>
                            <h3 class="mb-0">Safe Deposit</h3>
                        </div>
                        <div class="card-body-custom">
                            <h4 class="service-title">Vault Access</h4>
                            <p class="service-description">
                                View your safe deposit details, billing statements, payment history, and account balance.
                            </p>
                            <a href="/client/vault/" class="btn btn-vault btn-access">
                                <i class="fas fa-sign-in-alt me-2"></i>Access Vault
                            </a>
                        </div>
                    </div>
                </div>
                
                <!-- Shipping Card -->
                <div class="col-lg-4 col-md-6">
                    <div class="portal-card" onclick="window.location.href='/track-shipment.php'">
                        <div class="card-header-custom shipping">
                            <div class="portal-icon">
                                <i class="fas fa-shipping-fast"></i>
                            </div>
                            <h3 class="mb-0">Shipping</h3>
                        </div>
                        <div class="card-body-custom">
                            <h4 class="service-title">Track Shipment</h4>
                            <p class="service-description">
                                Track your packages in real-time, view shipping history, and get delivery updates.
                            </p>
                            <a href="/track-shipment.php" class="btn btn-shipping btn-access">
                                <i class="fas fa-search-location me-2"></i>Track Now
                            </a>
                        </div>
                    </div>
                </div>
                
                <!-- Escrow Card -->
                <div class="col-lg-4 col-md-6">
                    <div class="portal-card" onclick="/client/escrow/access.php">
                        <div class="card-header-custom escrow">
                            <div class="portal-icon">
                                <i class="fas fa-handshake"></i>
                            </div>
                            <h3 class="mb-0">Escrow</h3>
                        </div>
                        <div class="card-body-custom">
                            <h4 class="service-title">Escrow Portal</h4>
                            <p class="service-description">
                                Manage your escrow transactions, view agreement status, and track fund releases.
                            </p>
                              <a href="/client/escrow/access.php" class="btn btn-escrow btn-access">
                                     <i class="fas fa-sign-in-alt me-2"></i>Access Escrow
                              </a>
                        </div>
                    </div>
                </div>
            </div>
            
            
            <!-- Footer -->
            <div class="row justify-content-center mt-4">
                <div class="col-lg-8 text-center">
                    <p class="text-white-50 mb-0">
                        &copy; <?php echo date('Y'); ?> Bepex Consult. All Rights Reserved.
                    </p>
                </div>
            </div>
        </div>
    </div>
    
    <!-- Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // Show coming soon message for escrow
        function showComingSoon() {
            alert('Escrow Portal\n\nThis feature is currently under development and will be available soon.\n\nFor escrow inquiries, please contact our office at:\nPhone: +1 (555) 123-4567\nEmail: escrow@bepexconsult.com');
        }
        
        // Add hover effect animations
        document.addEventListener('DOMContentLoaded', function() {
            const cards = document.querySelectorAll('.portal-card:not(.disabled)');
            
            cards.forEach(card => {
                card.addEventListener('mouseenter', function() {
                    this.style.transform = 'translateY(-10px)';
                });
                
                card.addEventListener('mouseleave', function() {
                    this.style.transform = 'translateY(0)';
                });
            });
        });
    </script>
</body>
</html>