<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>عضوية أجنبية — <?= e($member['full_name_ar']) ?><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<form method="POST" action="/members/<?= (int) $member['id'] ?>/foreign">
    <?= csrf_field() ?>
    <div class="card" style="padding:20px;margin-bottom:20px;">
        <div style="padding:15px;background:#EFF6FF;border:1px solid #BFDBFE;border-radius:8px;margin-bottom:20px;">
            <strong style="color:#0284C7;">العضوية الأجنبية:</strong> تشمل الزوج/الزوجة + 3 أبناء — نفس حقوق العضو العامل<br>
            <strong>الرسوم:</strong> <span style="font-size:18px;font-weight:700;color:#1e3a5f;"><?= number_format((float) $fee_usd, 2) ?> USD</span>
        </div>
        <div style="display:grid;grid-template-columns:1fr 1fr;gap:15px;">
            <div class="form-group"><label class="form-label">رقم جواز السفر <span style="color:#DC2626;">*</span></label><input type="text" name="passport_number" value="<?= e(old('passport_number')) ?>" class="form-input" required style="direction:ltr;text-align:left;"></div>
            <div class="form-group">
                <label class="form-label">بلد الإصدار <span style="color:#DC2626;">*</span></label>
                <select name="issuing_country_id" class="form-select" required>
                    <option value="">-- اختر --</option>
                    <?php foreach ($countries as $c): ?><option value="<?= (int) $c['id'] ?>"><?= e($c['name_ar']) ?></option><?php endforeach; ?>
                </select>
            </div>
            <div class="form-group">
                <label class="form-label">الجنسية <span style="color:#DC2626;">*</span></label>
                <select name="nationality_country_id" class="form-select" required>
                    <option value="">-- اختر --</option>
                    <?php foreach ($countries as $c): ?><option value="<?= (int) $c['id'] ?>"><?= e($c['nationality_ar']) ?></option><?php endforeach; ?>
                </select>
            </div>
            <div class="form-group"><label class="form-label">محل الميلاد</label><input type="text" name="place_of_birth" value="<?= e(old('place_of_birth')) ?>" class="form-input"></div>
            <div class="form-group"><label class="form-label">تاريخ إصدار الجواز <span style="color:#DC2626;">*</span></label><input type="date" name="passport_issue_date" value="<?= e(old('passport_issue_date')) ?>" class="form-input" required></div>
            <div class="form-group"><label class="form-label">تاريخ انتهاء الجواز <span style="color:#DC2626;">*</span></label><input type="date" name="passport_expiry_date" value="<?= e(old('passport_expiry_date')) ?>" class="form-input" required><small style="color:#6B7280;">يجب أن يكون صالحاً لمدة 6 أشهر على الأقل</small></div>
            <div class="form-group"><label class="form-label">سعر الصرف (USD → EGP)</label><input type="number" name="exchange_rate" step="0.0001" value="<?= e(old('exchange_rate')) ?>" class="form-input" style="direction:ltr;text-align:left;" placeholder="مثال: 50.00"></div>
            <div class="form-group" style="grid-column:1/-1;"><label class="form-label">ملاحظات</label><textarea name="notes" class="form-textarea" rows="2"><?= e(old('notes')) ?></textarea></div>
        </div>
    </div>
    <button type="submit" class="btn btn-primary">تسجيل العضوية الأجنبية</button>
    <a href="/members/<?= (int) $member['id'] ?>" class="btn btn-outline">إلغاء</a>
</form>
<?php $__template->endSection(); ?>