@php $address = $address ?? null; @endphp
<div class="row g-3">
    <div class="col-md-6">
        <label class="form-label small">Label</label>
        <input type="text" name="label" class="form-control" value="{{ old('label', $address->label ?? 'Home') }}" placeholder="Home, Office, etc.">
    </div>
    <div class="col-md-6">
        <label class="form-label small">Full Name *</label>
        <input type="text" name="full_name" class="form-control @error('full_name') is-invalid @enderror" value="{{ old('full_name', $address->full_name ?? '') }}" required>
        @error('full_name')<div class="invalid-feedback">{{ $message }}</div>@enderror
    </div>
    <div class="col-md-6">
        <label class="form-label small">Phone *</label>
        <input type="text" name="phone" class="form-control @error('phone') is-invalid @enderror" value="{{ old('phone', $address->phone ?? '') }}" required>
        @error('phone')<div class="invalid-feedback">{{ $message }}</div>@enderror
    </div>
    <div class="col-12">
        <label class="form-label small">Address Line 1 *</label>
        <input type="text" name="address_line1" class="form-control @error('address_line1') is-invalid @enderror" value="{{ old('address_line1', $address->address_line1 ?? '') }}" required>
        @error('address_line1')<div class="invalid-feedback">{{ $message }}</div>@enderror
    </div>
    <div class="col-12">
        <label class="form-label small">Address Line 2</label>
        <input type="text" name="address_line2" class="form-control" value="{{ old('address_line2', $address->address_line2 ?? '') }}">
    </div>
    <div class="col-md-4">
        <label class="form-label small">City *</label>
        <input type="text" name="city" class="form-control @error('city') is-invalid @enderror" value="{{ old('city', $address->city ?? '') }}" required>
        @error('city')<div class="invalid-feedback">{{ $message }}</div>@enderror
    </div>
    <div class="col-md-4">
        <label class="form-label small">State / Province</label>
        <input type="text" name="state" class="form-control" value="{{ old('state', $address->state ?? '') }}">
    </div>
    <div class="col-md-4">
        <label class="form-label small">Postal Code</label>
        <input type="text" name="postal_code" class="form-control" value="{{ old('postal_code', $address->postal_code ?? '') }}">
    </div>
    <div class="col-12">
        <div class="form-check">
            <input class="form-check-input" type="checkbox" name="is_default" id="is_default" value="1" {{ old('is_default', $address->is_default ?? false) ? 'checked' : '' }}>
            <label class="form-check-label small" for="is_default">Set as default address</label>
        </div>
    </div>
</div>
