<div class="row justify-content-center">
<div class="col-12">
<div class="card-box">

    <div class="card-box-header">
        <h5><i class="fa-solid fa-box text-warning"></i> Product Details</h5>
        <div class="d-flex gap-2">
            <a href="<?= site_url('product/edit/'.$row->id) ?>" class="btn btn-sm btn-edit"><i class="fa-solid fa-pen-to-square me-1"></i>Edit</a>
            <a href="<?= site_url('product') ?>" class="btn btn-sm" style="background:#f1f5f9;color:#374151;"><i class="fa-solid fa-arrow-left me-1"></i>Back</a>
        </div>
    </div>

    <div class="row g-0">
        <div class="col-md-6">
            <table class="table table-sm mb-0">
                <tr><td class="fw-bold text-muted" width="140">Product Code</td><td><code><?= htmlspecialchars($row->product_code) ?></code></td></tr>
                <tr><td class="fw-bold text-muted">Product Name</td><td><strong><?= htmlspecialchars($row->product_name) ?></strong></td></tr>
                <tr><td class="fw-bold text-muted">Category</td><td><?= htmlspecialchars($row->category_name ?? '—') ?></td></tr>
                <tr><td class="fw-bold text-muted">Unit</td><td><?= htmlspecialchars($row->unit_name ?? '—') ?></td></tr>
                <tr><td class="fw-bold text-muted">Status</td><td>
                    <?= $row->status==1
                        ? '<span class="badge-active"><i class="fa-solid fa-circle-check me-1"></i>Active</span>'
                        : '<span class="badge-inactive"><i class="fa-solid fa-circle-xmark me-1"></i>Inactive</span>' ?>
                </td></tr>
            </table>
        </div>
        <div class="col-md-6">
            <table class="table table-sm mb-0">
                <tr><td class="fw-bold text-muted" width="140">Purchase Rate</td><td class="text-primary fw-bold">₹ <?= (int)($row->purchase_rate) ?></td></tr>
                <tr><td class="fw-bold text-muted">Sale Rate</td><td class="text-success fw-bold">₹ <?= (int)($row->sale_rate) ?></td></tr>
                <tr><td class="fw-bold text-muted">GST %</td><td><?= $row->gst_percent ?>%</td></tr>
                <tr><td class="fw-bold text-muted">Opening Stock</td><td><?= (int)($row->opening_stock) ?></td></tr>
                <tr><td class="fw-bold text-muted">Current Stock</td>
                    <td><span style="font-weight:800;color:<?= $row->current_stock < 5 ? '#dc2626' : '#16a34a' ?>;">
                        <?= (int)($row->current_stock) ?>
                    </span></td>
                </tr>
            </table>
        </div>
    </div>

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