<?php $__env->startSection('title', 'Add Account - Social Scheduler'); ?>

<?php $__env->startSection('content'); ?>
<div class="topbar">
    <h4 class="mb-0 fw-bold"><i class="bi bi-plus-circle me-2 text-primary"></i>Add Social Account</h4>
    <a href="<?php echo e(route('accounts.index')); ?>" class="btn btn-outline-secondary">
        <i class="bi bi-arrow-left me-1"></i> Back
    </a>
</div>

<div class="row justify-content-center">
    <div class="col-lg-6">
        <div class="card">
            <div class="card-body p-4">
                <form method="POST" action="<?php echo e(route('accounts.store')); ?>">
                    <?php echo csrf_field(); ?>

                    <div class="mb-4">
                        <label class="form-label fw-semibold">
                            <i class="bi bi-grid-3x3-gap me-1"></i>Platform
                        </label>
                        <div class="row g-3">
                            <?php $__currentLoopData = ['facebook', 'instagram', 'twitter', 'linkedin']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $platform): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php
                                $colors = ['facebook' => '#1877F2', 'instagram' => '#E4405F', 'twitter' => '#000000', 'linkedin' => '#0A66C2'];
                                $icons = ['facebook' => 'bi-facebook', 'instagram' => 'bi-instagram', 'twitter' => 'bi-twitter-x', 'linkedin' => 'bi-linkedin'];
                            ?>
                            <div class="col-6">
                                <div class="form-check card p-3 text-center">
                                    <input class="form-check-input d-none" type="radio" name="platform_name"
                                           value="<?php echo e($platform); ?>" id="platform_<?php echo e($platform); ?>"
                                           <?php echo e(old('platform_name') === $platform ? 'checked' : ''); ?> required>
                                    <label class="form-check-label" for="platform_<?php echo e($platform); ?>">
                                        <span class="platform-icon d-inline-flex mb-2" style="background-color: <?php echo e($colors[$platform]); ?>; width:48px;height:48px;font-size:1.5rem;">
                                            <i class="bi <?php echo e($icons[$platform]); ?>"></i>
                                        </span>
                                        <div class="fw-semibold"><?php echo e(ucfirst($platform)); ?></div>
                                    </label>
                                </div>
                            </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                        <?php $__errorArgs = ['platform_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="invalid-feedback d-block"><?php echo e($message); ?></div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="mb-4">
                        <label for="account_name" class="form-label fw-semibold">
                            <i class="bi bi-person-badge me-1"></i>Account Name / Handle
                        </label>
                        <input type="text" class="form-control <?php $__errorArgs = ['account_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                               id="account_name" name="account_name" value="<?php echo e(old('account_name')); ?>"
                               placeholder="e.g., @MyBrand or MyBrandPage" required>
                        <?php $__errorArgs = ['account_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="invalid-feedback"><?php echo e($message); ?></div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="mb-4">
                        <label for="access_token" class="form-label fw-semibold">
                            <i class="bi bi-key me-1"></i>Access Token (Mock)
                        </label>
                        <input type="text" class="form-control <?php $__errorArgs = ['access_token'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                               id="access_token" name="access_token" value="<?php echo e(old('access_token')); ?>"
                               placeholder="Enter mock access token (optional)">
                        <div class="form-text">This is a placeholder for real API integration. Any value works.</div>
                        <?php $__errorArgs = ['access_token'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="invalid-feedback"><?php echo e($message); ?></div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="mb-4">
                        <label class="form-label fw-semibold">
                            <i class="bi bi-toggle-on me-1"></i>Status
                        </label>
                        <div class="row g-3">
                            <div class="col-6">
                                <div class="form-check card p-3">
                                    <input class="form-check-input" type="radio" name="status" value="active"
                                           id="status_active" <?php echo e(old('status', 'active') === 'active' ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="status_active">
                                        <i class="bi bi-check-circle-fill text-success me-1"></i> Active
                                    </label>
                                </div>
                            </div>
                            <div class="col-6">
                                <div class="form-check card p-3">
                                    <input class="form-check-input" type="radio" name="status" value="inactive"
                                           id="status_inactive" <?php echo e(old('status') === 'inactive' ? 'checked' : ''); ?>>
                                    <label class="form-check-label" for="status_inactive">
                                        <i class="bi bi-x-circle-fill text-secondary me-1"></i> Inactive
                                    </label>
                                </div>
                            </div>
                        </div>
                        <?php $__errorArgs = ['status'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <div class="invalid-feedback d-block"><?php echo e($message); ?></div>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="d-grid">
                        <button type="submit" class="btn btn-primary btn-lg">
                            <i class="bi bi-check-lg me-2"></i>Add Account
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<?php $__env->startPush('scripts'); ?>
<script>
    // Platform card selection visual feedback
    document.querySelectorAll('input[name="platform_name"]').forEach(radio => {
        radio.addEventListener('change', function() {
            document.querySelectorAll('input[name="platform_name"]').forEach(r => {
                r.closest('.card').style.border = 'none';
            });
            this.closest('.card').style.border = '2px solid #4f46e5';
        });
    });
    // Pre-select if old value exists
    const checked = document.querySelector('input[name="platform_name"]:checked');
    if (checked) checked.closest('.card').style.border = '2px solid #4f46e5';
</script>
<?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/polyttfr/public_html/resources/views/accounts/create.blade.php ENDPATH**/ ?>