<?php require("header.php"); ?>

<?php
// Fetch user balance and ATM card info as usual
// Assume $curr, $balc, $firstname, $lastname, $acc_no, $ordrow, $userrow are already set
?>

<div class="container py-4">
    <br><br><br>

    <!-- PAGE HEADER -->
    <div class="col-12 text-center mb-4">
        <h4 class="fw-bold">Add Funds to Your Account</h4>
        <p class="text-muted">This feature is coming soon</p>
    </div>

    <!-- ATM CARD (Current Balance) -->
    <div class="col-12 mt-3">
        <div class="row gy-gs">
            <div class="col-12 col-md-8 col-lg-7 col-xl-6 mx-auto">
                <div class="atm-card-wrapper">
                    <div class="atm-card-flip">

                        <!-- FRONT -->
                        <div class="atm-card-front text-white p-4">
                            <div class="d-flex justify-content-between align-items-start">
                                <div>
                                    <small class="opacity-75">Available Balance</small>
                                    <h3 class="fw-bold mb-0">
                                        <?= $curr ?> <?= number_format($balc,2) ?>
                                    </h3>
                                </div>
                                <div>
                                    <?php if ($userrow && $userrow['photo'] == 0): ?>
                                        <img src="upload/photo/default.png" class="card-avatar">
                                    <?php else: ?>
                                        <img src="../<?= htmlspecialchars($userrow['P_location']) ?>" class="card-avatar">
                                    <?php endif; ?>
                                </div>
                            </div>

                            <div class="mt-3">
                                <?php
                                if($ordrow['CARD_TYP']==1) echo "<img src='tools/visacard.png' height='35'>";
                                elseif($ordrow['CARD_TYP']==2) echo "<img src='tools/mastercard.png' height='35'>";
                                ?>
                            </div>

                            <div class="mt-4">
                                <small class="opacity-75">Account No</small>
                                <div class="fw-bold fs-5 letter-spacing">
                                    <?= substr($acc_no,0,-5) ?>***<?= substr($acc_no,-2) ?>
                                </div>
                            </div>

                            <div class="card-name">
                                <?= strtoupper($firstname . ' ' . $lastname) ?>
                            </div>
                        </div>

                        <!-- BACK -->
                        <div class="atm-card-back text-white p-4">
                            <div class="card-strip"></div>
                            <div class="d-flex justify-content-between mt-4">
                                <div>
                                    <small>CVV</small>
                                    <div class="fw-bold"><?= str_pad(rand(100,999),3,'0',STR_PAD_LEFT); ?></div>
                                </div>
                                <div>
                                    <small>Expiry</small>
                                    <div class="fw-bold"><?= date('m/Y', strtotime('+3 years')); ?></div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>

    <hr>

    <!-- COMING SOON MESSAGE -->
    <div class="col-12 col-md-8 col-lg-7 col-xl-6 mx-auto mt-4">
        <div class="card card-bordered text-center p-4" style="background:#fff; box-shadow:0 10px 25px rgba(0,0,0,0.05); border-radius:20px;">
            <h5 class="fw-bold mb-3 text-danger">Coming Soon</h5>
            <p class="text-muted mb-4">
                The Add Funds / Top-Up feature is not yet available.<br>
                Please contact support for more information.
            </p>
            <a href="support.php" class="btn btn-primary fw-bold px-4">
                Contact Support
            </a>
        </div>
    </div>

    <hr>

    <!-- QUICK ACTIONS -->
    <div class="row text-center g-3 mb-4 mt-4">
        <div class="col-4">
            <a href="funds-transfer.php" class="action-card">
                <div class="icon bg-primary"><i class="ni ni-send"></i></div>
                <small>Send</small>
            </a>
        </div>
        <div class="col-4">
            <a href="topup.php" class="action-card">
                <div class="icon bg-success"><i class="ni ni-arrow-down"></i></div>
                <small>Receive</small>
            </a>
        </div>
        <div class="col-4">
            <a href="e_statement.php" class="action-card">
                <div class="icon bg-warning"><i class="ni ni-list"></i></div>
                <small>History</small>
            </a>
        </div>
    </div>

</div>

<!-- STYLES -->
<style>
body { background: #f5f6fa; }

/* ATM CARD & BALANCE CARD */
.atm-card-wrapper { perspective: 1000px; }
.atm-card-flip { position: relative; width: 100%; max-width: 1000px; height: 260px; margin:auto; transform-style: preserve-3d; transition: 0.7s; cursor:pointer; }
.atm-card-front, .atm-card-back { position: absolute; width:100%; height:100%; border-radius: 20px; backface-visibility: hidden; box-shadow: 0 15px 40px rgba(0,0,0,0.15); }
.atm-card-front { background: linear-gradient(135deg,#5f2c82,#49a09d); }
.atm-card-back { background: linear-gradient(135deg,#232526,#414345); transform: rotateY(180deg); }
.card-strip { height: 40px; background: #000; margin-top: 40px; border-radius: 5px; }
.card-avatar { width: 45px; height: 45px; border-radius: 20%; border: 2px solid rgba(255,255,255,0.7); object-fit: cover; }
.letter-spacing { letter-spacing: 4px; }
.card-name { position: absolute; bottom: 15px; left: 20px; font-weight: bold; letter-spacing: 1px; font-size: 14px; }

/* QUICK ACTIONS */
.action-card { display:block; background:white; padding:15px 10px; border-radius:16px; text-decoration:none; color:#111; box-shadow:0 8px 20px rgba(0,0,0,0.05); transition:0.2s ease; }
.action-card:hover { transform: translateY(-3px); }
.action-card .icon { width:45px; height:45px; margin:auto; border-radius:12px; display:flex; align-items:center; justify-content:center; margin-bottom:8px; }
.action-card .icon i { font-size:20px; color:#fff; }

/* COMING SOON CARD */
.card-bordered { border: none; }
</style>

<?php require("footer.php"); ?>