<?= $this->extend('admin/layout') ?>

<?= $this->section('content') ?>

<div class="d-flex justify-content-between align-items-center mb-4">
    <h2 class="h3 text-gray-800 mb-0">Site Settings</h2>
</div>

<div class="card shadow mb-4">
    <div class="card-header py-3">
        <h6 class="m-0 font-weight-bold" style="color: var(--primary-green);">Manage Global Settings</h6>
    </div>
    <div class="card-body">
        <form action="<?= base_url('admin/settings') ?>" method="post">
            <?= csrf_field() ?>
            
            <h5 class="mb-3 border-bottom pb-2">General Information</h5>
            <div class="row mb-3">
                <div class="col-md-6 mb-3">
                    <label class="form-label">Site Name</label>
                    <input type="text" class="form-control" name="site_name" value="<?= esc($settings['site_name'] ?? '') ?>">
                </div>
            </div>

            <h5 class="mb-3 border-bottom pb-2 mt-4">Contact Details</h5>
            <div class="row mb-3">
                <div class="col-md-6 mb-3">
                    <label class="form-label">Contact Email</label>
                    <input type="email" class="form-control" name="contact_email" value="<?= esc($settings['contact_email'] ?? '') ?>">
                </div>
                <div class="col-md-6 mb-3">
                    <label class="form-label">Phone Number</label>
                    <input type="text" class="form-control" name="phone" value="<?= esc($settings['phone'] ?? '') ?>">
                </div>
                <div class="col-md-6 mb-3">
                    <label class="form-label">WhatsApp Number</label>
                    <input type="text" class="form-control" name="whatsapp" value="<?= esc($settings['whatsapp'] ?? '') ?>">
                </div>
                <div class="col-md-6 mb-3">
                    <label class="form-label">Address</label>
                    <textarea class="form-control" name="address" rows="2"><?= esc($settings['address'] ?? '') ?></textarea>
                </div>
            </div>

            <h5 class="mb-3 border-bottom pb-2 mt-4">SEO & Social Links</h5>
            <div class="row mb-3">
                <div class="col-md-6 mb-3">
                    <label class="form-label">SEO Meta Title</label>
                    <input type="text" class="form-control" name="seo_meta_title" value="<?= esc($settings['seo_meta_title'] ?? '') ?>">
                </div>
                <div class="col-md-6 mb-3">
                    <label class="form-label">SEO Meta Description</label>
                    <textarea class="form-control" name="seo_meta_description" rows="3"><?= esc($settings['seo_meta_description'] ?? '') ?></textarea>
                </div>
                <div class="col-md-4 mb-3">
                    <label class="form-label">Facebook Link</label>
                    <input type="text" class="form-control" name="facebook_link" value="<?= esc($settings['facebook_link'] ?? '') ?>">
                </div>
                <div class="col-md-4 mb-3">
                    <label class="form-label">Instagram Link</label>
                    <input type="text" class="form-control" name="instagram_link" value="<?= esc($settings['instagram_link'] ?? '') ?>">
                </div>
                <div class="col-md-4 mb-3">
                    <label class="form-label">LinkedIn Link</label>
                    <input type="text" class="form-control" name="linkedin_link" value="<?= esc($settings['linkedin_link'] ?? '') ?>">
                </div>
            </div>

            <button type="submit" class="btn btn-primary" style="background-color: var(--primary-green); border-color: var(--primary-green);">Save Settings</button>
        </form>
    </div>
</div>

<?= $this->endSection() ?>
