<?php $__env->startSection('title', 'Category Management'); ?>

<?php $__env->startSection('content'); ?>
<div style="margin-bottom: 24px;">
    <h1 class="serif" style="font-size: 26px; margin: 0; color: #0f172a;">Store Category Management</h1>
    <p style="color: var(--text-muted); font-size: 14px; margin-top: 4px;">Organize skincare products into collections and categories.</p>
</div>

<div style="display: grid; grid-template-columns: 1fr 2fr; gap: 24px;">
    <!-- Create Category Form -->
    <div class="admin-card">
        <h2 class="serif" style="font-size: 18px; margin: 0 0 16px 0; color: #0f172a;">Add New Category</h2>
        <form action="<?php echo e(route('admin.categories.store')); ?>" method="POST">
            <?php echo csrf_field(); ?>
            <div style="margin-bottom: 16px;">
                <label style="display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-muted);">Category Name *</label>
                <input type="text" name="name" class="form-control" required placeholder="e.g. Body Lotions">
            </div>

            <div style="margin-bottom: 16px;">
                <label style="display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-muted);">Description</label>
                <textarea name="description" rows="3" class="form-control" placeholder="Short description of this product line..."></textarea>
            </div>

            <div style="margin-bottom: 20px;">
                <label style="display: flex; align-items: center; gap: 8px; cursor: pointer; color: #334155;">
                    <input type="checkbox" name="is_active" value="1" checked> Active on Storefront
                </label>
            </div>

            <button type="submit" class="btn-admin btn-primary" style="width: 100%; justify-content: center;">Create Category</button>
        </form>
    </div>

    <!-- Category List Table -->
    <div class="admin-card">
        <h2 class="serif" style="font-size: 18px; margin: 0 0 16px 0; color: #0f172a;">All Categories</h2>
        <table class="admin-table">
            <thead>
                <tr>
                    <th>Category Name</th>
                    <th>Slug</th>
                    <th>Product Count</th>
                    <th>Status</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td>
                            <strong style="color: #0f172a;"><?php echo e($cat->name); ?></strong>
                            <?php if($cat->description): ?>
                                <div style="font-size: 11px; color: var(--text-muted);"><?php echo e(Str::limit($cat->description, 40)); ?></div>
                            <?php endif; ?>
                        </td>
                        <td><code><?php echo e($cat->slug); ?></code></td>
                        <td><strong><?php echo e($cat->products_count); ?></strong> products</td>
                        <td>
                            <span class="badge <?php echo e($cat->is_active ? 'badge-active' : 'badge-inactive'); ?>">
                                <?php echo e($cat->is_active ? 'Active' : 'Disabled'); ?>

                            </span>
                        </td>
                        <td>
                            <div style="display: flex; gap: 8px;">
                                <a href="<?php echo e(route('admin.categories.edit', $cat)); ?>" class="btn-admin btn-secondary" style="padding: 6px 10px; font-size: 12px;">
                                    <i data-lucide="edit-3" style="width: 14px;"></i> Edit
                                </a>
                                <form action="<?php echo e(route('admin.categories.destroy', $cat)); ?>" method="POST" onsubmit="return confirm('Delete category?')" style="margin: 0;">
                                    <?php echo csrf_field(); ?>
                                    <?php echo method_field('DELETE'); ?>
                                    <button type="submit" class="btn-admin btn-danger" style="padding: 6px 10px; font-size: 12px;">
                                        <i data-lucide="trash-2" style="width: 14px;"></i>
                                    </button>
                                </form>
                            </div>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /Users/koushikkona/Documents/Projects/divne/resources/views/admin/categories/index.blade.php ENDPATH**/ ?>