<?php
// payment_success.php - Payment Confirmation Page
// File location: /bidwheels.net/user/payment_success.php

require_once '../includes/auth.php';
require_once '../includes/header.php';

$payment_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;

if ($payment_id > 0) {
    $payment = fetchOne("
        SELECT p.*, pr.name as product_name, pr.id as product_id
        FROM payments p
        LEFT JOIN products pr ON p.product_id = pr.id
        WHERE p.id = $payment_id
    ");
}
?>

<div class="container">
    <div class="payment-success-container" style="max-width: 600px; margin: 50px auto;">
        <div class="success-card" style="background: white; padding: 40px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); text-align: center;">
            <i class="fas fa-check-circle" style="font-size: 80px; color: #28a745; margin-bottom: 20px;"></i>
            <h1 style="margin-bottom: 15px;">Payment Information Received!</h1>
            <p style="color: #666; margin-bottom: 25px;">Thank you for submitting your payment information. Our team will review it and contact you within 24-48 hours.</p>
            
            <?php if (isset($payment) && $payment): ?>
                <div class="payment-details" style="background: #f8f9fa; padding: 20px; border-radius: 10px; margin-bottom: 25px; text-align: left;">
                    <h3 style="margin-bottom: 15px;">Payment Summary</h3>
                    <p><strong>Product:</strong> <?php echo htmlspecialchars($payment['product_name']); ?></p>
                    <p><strong>Payment Method:</strong> <?php echo htmlspecialchars($payment['payment_method']); ?></p>
                    <p><strong>Submitted On:</strong> <?php echo date('F d, Y g:i A', strtotime($payment['created_at'])); ?></p>
                </div>
            <?php endif; ?>
            
            <div class="next-steps" style="margin-bottom: 25px;">
                <h3>What's Next?</h3>
                <p>1. Our team will verify your payment information</p>
                <p>2. You will receive a confirmation email</p>
                <p>3. The seller will contact you for delivery arrangements</p>
            </div>
            
            <div class="action-buttons" style="display: flex; gap: 15px; justify-content: center;">
                <a href="dashboard.php" class="btn btn-primary" style="background: #e63946; color: white; padding: 12px 25px; text-decoration: none; border-radius: 5px;">
                    <i class="fas fa-tachometer-alt"></i> Go to Dashboard
                </a>
                <a href="<?php echo SITE_URL; ?>/product/index.php" class="btn btn-secondary" style="background: #1a1a2e; color: white; padding: 12px 25px; text-decoration: none; border-radius: 5px;">
                    <i class="fas fa-gavel"></i> Continue Bidding
                </a>
            </div>
        </div>
    </div>
</div>

<style>
.next-steps p {
    margin: 10px 0;
    color: #555;
}
@media (max-width: 768px) {
    .action-buttons {
        flex-direction: column;
    }
}
</style>

<?php require_once '../includes/footer.php'; ?>